-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forcibly disconnect sessions on split packet errors
since split packets are usually reliable, we're breaking the reliability promise if we don't fully process these packets. worse, if the packet in question is reliable-ordered (always the case with Minecraft), no further packets will be processed anyway, causing the session to break down.
- Loading branch information
Showing
5 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of RakLib. | ||
* Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/RakLib> | ||
* | ||
* RakLib is not affiliated with Jenkins Software LLC nor RakNet. | ||
* | ||
* RakLib is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace raklib\generic; | ||
|
||
class PacketHandlingException extends \RuntimeException{ | ||
|
||
/** @phpstan-var DisconnectReason::* */ | ||
private int $disconnectReason; | ||
|
||
/** | ||
* @phpstan-param DisconnectReason::* $disconnectReason | ||
*/ | ||
public function __construct(string $message, int $disconnectReason, int $code = 0, ?\Throwable $previous = null){ | ||
$this->disconnectReason = $disconnectReason; | ||
parent::__construct($message, $code, $previous); | ||
} | ||
|
||
/** | ||
* @phpstan-return DisconnectReason::* | ||
*/ | ||
public function getDisconnectReason() : int{ | ||
return $this->disconnectReason; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters