mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
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:
parent
3b5df90b0b
commit
9f0a184a5d
@ -319,7 +319,7 @@ class NetworkSession{
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
$packet->decode();
|
$packet->decode();
|
||||||
if(!$packet->feof() and !$packet->mayHaveUnreadBytes()){
|
if(!$packet->feof()){
|
||||||
$remains = substr($packet->getBuffer(), $packet->getOffset());
|
$remains = substr($packet->getBuffer(), $packet->getOffset());
|
||||||
$this->logger->debug("Still " . strlen($remains) . " bytes unread in " . $packet->getName() . ": " . bin2hex($remains));
|
$this->logger->debug("Still " . strlen($remains) . " bytes unread in " . $packet->getName() . ": " . bin2hex($remains));
|
||||||
}
|
}
|
||||||
|
@ -56,14 +56,6 @@ abstract class DataPacket extends NetworkBinaryStream implements Packet{
|
|||||||
return false;
|
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
|
* @throws BadPacketException
|
||||||
*/
|
*/
|
||||||
|
@ -82,10 +82,6 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mayHaveUnreadBytes() : bool{
|
|
||||||
return $this->protocol !== null and $this->protocol !== ProtocolInfo::CURRENT_PROTOCOL;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function decodePayload() : void{
|
protected function decodePayload() : void{
|
||||||
$this->protocol = $this->getInt();
|
$this->protocol = $this->getInt();
|
||||||
$this->decodeConnectionRequest();
|
$this->decodeConnectionRequest();
|
||||||
|
@ -48,12 +48,6 @@ interface Packet{
|
|||||||
|
|
||||||
public function canBeSentBeforeLogin() : bool;
|
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
|
* @throws BadPacketException
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user