mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Encode IP in OPEN_CONNECTION_REPLY_2 for RakNet compatibility
NC would crash Jenkins' RakNet clients compiled with assertions.
This commit is contained in:
parent
401e3fac21
commit
a0f7607d7e
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,12 @@
|
|||
<?php
|
||||
|
||||
class RakNetCodec{
|
||||
private static function encodeIPAddress(RakNetPacket $packet) {
|
||||
$packet->buffer .= chr(4);
|
||||
$packet->buffer .= Utils::writeInt($packet->ip);
|
||||
$packet->buffer .= Utils::writeShort($packet->port);
|
||||
}
|
||||
|
||||
public static function encode(RakNetPacket $packet){
|
||||
if($packet->buffer != null && strlen($packet->buffer) > 0){
|
||||
return;
|
||||
|
|
@ -17,7 +23,7 @@ class RakNetCodec{
|
|||
case RakNetInfo::OPEN_CONNECTION_REPLY_2:
|
||||
$packet->buffer .= RakNetInfo::MAGIC;
|
||||
$packet->buffer .= Utils::writeLong($packet->serverID);
|
||||
$packet->buffer .= Utils::writeShort($packet->port);
|
||||
static::encodeIPAddress($packet);
|
||||
$packet->buffer .= Utils::writeShort($packet->mtuSize);
|
||||
$packet->buffer .= chr(0); //Server security
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue