Packet: Remove mayHaveUnreadBytes()

this was an old hack to prevent debug spam being emitted when we halted decoding of logins over breaking protocol changes. Since then, we've gone back to trying to decode the packet regardless, so this property is useless.
This commit is contained in:
Dylan K. Taylor 2019-06-05 15:37:35 +01:00
parent 3b5df90b0b
commit 9f0a184a5d
4 changed files with 1 additions and 19 deletions

View File

@ -319,7 +319,7 @@ class NetworkSession{
try{
$packet->decode();
if(!$packet->feof() and !$packet->mayHaveUnreadBytes()){
if(!$packet->feof()){
$remains = substr($packet->getBuffer(), $packet->getOffset());
$this->logger->debug("Still " . strlen($remains) . " bytes unread in " . $packet->getName() . ": " . bin2hex($remains));
}

View File

@ -56,14 +56,6 @@ abstract class DataPacket extends NetworkBinaryStream implements Packet{
return false;
}
/**
* Returns whether the packet may legally have unread bytes left in the buffer.
* @return bool
*/
public function mayHaveUnreadBytes() : bool{
return false;
}
/**
* @throws BadPacketException
*/

View File

@ -82,10 +82,6 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
return true;
}
public function mayHaveUnreadBytes() : bool{
return $this->protocol !== null and $this->protocol !== ProtocolInfo::CURRENT_PROTOCOL;
}
protected function decodePayload() : void{
$this->protocol = $this->getInt();
$this->decodeConnectionRequest();

View File

@ -48,12 +48,6 @@ interface Packet{
public function canBeSentBeforeLogin() : bool;
/**
* Returns whether the packet may legally have unread bytes left in the buffer.
* @return bool
*/
public function mayHaveUnreadBytes() : bool;
/**
* @throws BadPacketException
*/