From 5b79722fa9cfe4723737acf041c71a013df9f4fc Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 16 Mar 2013 00:16:47 +0100 Subject: [PATCH] Better NACK handling (#133, #16, fixes #75) --- src/Player.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Player.php b/src/Player.php index 80e69d86..224e3119 100644 --- a/src/Player.php +++ b/src/Player.php @@ -428,19 +428,19 @@ class Player{ $this->timeout = microtime(true) + 20; switch($pid){ case 0xa0: //NACK - /*if(isset($this->recovery[$data[2]])){ - array_unshift($this->queue, array(0, $this->recovery[$data[2]][0], $this->recovery[$data[2]][1], $data[2])); + if(isset($this->recovery[$data[2]])){ + $this->directDataPacket($this->recovery[$data[2]][1]["id"], $this->recovery[$data[2]][1]); } if(isset($data[3])){ if(isset($this->recovery[$data[3]])){ - array_unshift($this->queue, array(0, $this->recovery[$data[3]][0], $this->recovery[$data[3]][1], $data[3])); + $this->directDataPacket($this->recovery[$data[3]][1]["id"], $this->recovery[$data[3]][1]); } - }*/ + } break; case 0xc0: //ACK - /*$diff = $data[2] - $this->counter[2]; + $diff = $data[2] - $this->counter[2]; if($diff > 8){ //Packet recovery - array_unshift($this->queue, array(0, $this->recovery[$data[2]][0], $this->recovery[$data[2]][1], $data[2])); + $this->directDataPacket($this->recovery[$data[2]][1]["id"], $this->recovery[$data[2]][1]); } $this->counter[2] = $data[2]; $this->recovery[$data[2]] = null; @@ -449,12 +449,12 @@ class Player{ if(isset($data[3])){ $diff = $data[3] - $this->counter[2]; if($diff > 8){ //Packet recovery - array_unshift($this->queue, array(0, $this->recovery[$data[3]][0], $this->recovery[$data[3]][1], $data[3])); + $this->directDataPacket($this->recovery[$data[3]][1]["id"], $this->recovery[$data[3]][1]); } $this->counter[2] = $data[3]; $this->recovery[$data[3]] = null; unset($this->recovery[$data[3]]); - }*/ + } break; case 0x07: if($this->loggedIn === true){