diff --git a/src/network/UDPSocket.php b/src/network/UDPSocket.php index 71b8b687b..6eab05bbd 100644 --- a/src/network/UDPSocket.php +++ b/src/network/UDPSocket.php @@ -64,11 +64,11 @@ class UDPSocket{ return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port); } - public function write($data, $dest = false, $port = false){ + public function write($data, $dest, $port){ if($this->connected === false){ return false; } - return @socket_sendto($this->sock, $data, strlen($data), 0, ($dest === false ? $this->server:$dest), ($port === false ? $this->port:$port)); + return @socket_sendto($this->sock, $data, strlen($data), 0, $dest, $port); } } diff --git a/src/network/raknet/RakNetParser.php b/src/network/raknet/RakNetParser.php index dceff50dc..3aa3bc1de 100644 --- a/src/network/raknet/RakNetParser.php +++ b/src/network/raknet/RakNetParser.php @@ -111,8 +111,8 @@ class RakNetParser{ case RakNetInfo::DATA_PACKET_F: $this->packet->seqNumber = $this->getLTriad(); $this->packet->data = array(); - while(!$this->feof()){ - $this->packet->data[] = $this->parseDataPacket(); + while(!$this->feof() and ($pk = $this->parseDataPacket()) instanceof RakNetDataPacket){ + $this->packet->data[] = $pk; } break; case RakNetInfo::NACK: @@ -179,16 +179,7 @@ class RakNetParser{ if($length <= 0 or $orderChannel >= 32 or ($hasSplit === true and $splitIndex >= $splitCount)){ - $data = new UnknownPacket(); - $data->reliability = $reliability; - $data->hasSplit = $hasSplit; - $data->messageIndex = $messageIndex; - $data->orderIndex = $orderIndex; - $data->orderChannel = $orderChannel; - $data->splitCount = $splitCount; - $data->splitID = $splitID; - $data->splitIndex = $splitIndex; - $data->setBuffer($this->get($length)); + return false; }else{ $pid = $this->getByte(); if(isset(ProtocolInfo::$packets[$pid])){