Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Commit

Permalink
Fixed raw packets
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Jul 5, 2014
1 parent 1aa7c42 commit 740c96f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion raklib/server/ServerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function handlePacket(){
$len = ord($packet{$offset++});
$address = substr($packet, $offset, $len);
$offset += $len;
$port = substr($packet, $offset, 2);
$port = Binary::readShort(substr($packet, $offset, 2), false);
$offset += 2;
$payload = substr($packet, $offset);
$this->instance->handleRaw($address, $port, $payload);
Expand Down
4 changes: 2 additions & 2 deletions raklib/server/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function streamEncapsulated(Session $session, EncapsulatedPacket $packet,

public function streamRaw($address, $port, $payload){
$buffer = chr(RakLib::PACKET_RAW) . chr(strlen($address)) . $address . Binary::writeShort($port) . $payload;
@socket_write($this->socket, Binary::writeInt(strlen($buffer)) . $buffer);
@socket_write($this->internalSocket, Binary::writeInt(strlen($buffer)) . $buffer);
}

protected function streamClose($identifier, $reason){
Expand Down Expand Up @@ -246,7 +246,7 @@ public function receiveStream(){
$len = ord($packet{$offset++});
$address = substr($packet, $offset, $len);
$offset += $len;
$port = substr($packet, $offset, 2);
$port = Binary::readShort(substr($packet, $offset, 2), false);
$offset += 2;
$payload = substr($packet, $offset);
$this->socket->writePacket($payload, $address, $port);
Expand Down

0 comments on commit 740c96f

Please sign in to comment.