Fixed bigRaw packets reliability

This commit is contained in:
Shoghi Cervantes Pueyo 2013-05-19 16:47:57 +02:00
parent 2c4a428698
commit e3de52ba8b

View File

@ -39,7 +39,7 @@ class Player{
private $clientID; private $clientID;
private $ip; private $ip;
private $port; private $port;
private $counter = array(0, 0, 0, 0, 0); private $counter = array(0, 0, 0, 0);
private $username; private $username;
private $iusername; private $iusername;
private $eid = false; private $eid = false;
@ -1002,7 +1002,7 @@ class Player{
if(($this->hasItem($data["block"], $data["meta"]) or $this->itemEnforcement !== true) and $this->server->handle("player.equipment.change", $data) !== false){ if(($this->hasItem($data["block"], $data["meta"]) or $this->itemEnforcement !== true) and $this->server->handle("player.equipment.change", $data) !== false){
$this->equipment = $data["item"]; $this->equipment = $data["item"];
}elseif($this->itemEnforcement === true){ }elseif($this->itemEnforcement === true){
$this->sendSettings(); $this->sendInventory();
} }
break; break;
case MC_REQUEST_CHUNK: case MC_REQUEST_CHUNK:
@ -1377,8 +1377,7 @@ class Player{
); );
$size = $this->MTU - 32; $size = $this->MTU - 32;
$buffer = str_split(chr($id).$buffer, $size); $buffer = str_split(chr($id).$buffer, $size);
$h = strrev(Utils::writeTriad($this->counter[4]++))."\x00".Utils::writeInt(count($buffer)).Utils::writeShort($this->bigCnt); $h = Utils::writeInt(count($buffer)).Utils::writeShort($this->bigCnt);
$this->counter[4] %= 0x1000000;
$this->bigCnt = ($this->bigCnt + 1) % 0x10000; $this->bigCnt = ($this->bigCnt + 1) % 0x10000;
foreach($buffer as $i => $buf){ foreach($buffer as $i => $buf){
$data["raw"] = Utils::writeShort(strlen($buf) << 3).strrev(Utils::writeTriad($this->counter[3]++)).$h.Utils::writeInt($i).$buf; $data["raw"] = Utils::writeShort(strlen($buf) << 3).strrev(Utils::writeTriad($this->counter[3]++)).$h.Utils::writeInt($i).$buf;
@ -1394,7 +1393,7 @@ class Player{
$this->recovery[$count] = $data; $this->recovery[$count] = $data;
$this->send(0x80, array( $this->send(0x80, array(
$count, $count,
0x70, 0x50, //0b01010000
$data, $data,
)); ));
} }