mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
better multiack handling, fixed ack negative ranges
This commit is contained in:
parent
3978b95843
commit
81cfb6b705
4 changed files with 7 additions and 4 deletions
|
|
@ -3574,8 +3574,10 @@ class Player{
|
||||||
foreach($packet->packets as $count){
|
foreach($packet->packets as $count){
|
||||||
if(isset($this->packetAlwaysRecoverQueue[$count])){
|
if(isset($this->packetAlwaysRecoverQueue[$count])){
|
||||||
$this->resendQueue[$count] = $this->packetAlwaysRecoverQueue[$count];
|
$this->resendQueue[$count] = $this->packetAlwaysRecoverQueue[$count];
|
||||||
|
$this->resendQueue[$count]->incrementAllowedAck = false;
|
||||||
}else if(isset($this->recoveryQueue[$count])){
|
}else if(isset($this->recoveryQueue[$count])){
|
||||||
$this->resendQueue[$count] =& $this->recoveryQueue[$count];
|
$this->resendQueue[$count] =& $this->recoveryQueue[$count];
|
||||||
|
$this->resendQueue[$count]->incrementAllowedAck = false;
|
||||||
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
||||||
unset($this->recoveryQueue[$count]);
|
unset($this->recoveryQueue[$count]);
|
||||||
}else{ //lost and wont be recovered
|
}else{ //lost and wont be recovered
|
||||||
|
|
@ -3595,8 +3597,8 @@ class Player{
|
||||||
}else if(isset($this->recoveryQueue[$count])){
|
}else if(isset($this->recoveryQueue[$count])){
|
||||||
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
$this->lag[] = $time - $this->recoveryQueue[$count]->sendtime;
|
||||||
unset($this->recoveryQueue[$count]);
|
unset($this->recoveryQueue[$count]);
|
||||||
unset($this->resendQueue[$count]);
|
|
||||||
}
|
}
|
||||||
|
unset($this->resendQueue[$count]);
|
||||||
++$this->packetStats[0];
|
++$this->packetStats[0];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ class MinecraftInterface{
|
||||||
|
|
||||||
$packet = RakNetParser::parse($buffer, $acks, $ackCnt);
|
$packet = RakNetParser::parse($buffer, $acks, $ackCnt);
|
||||||
if($packet !== false){
|
if($packet !== false){
|
||||||
if($ackCnt != 0 && isset($this->maxACKsAllowed[$id])){
|
if($ackCnt != 0 && isset($this->maxACKsAllowed[$id]) && $packet->pid() != RakNetInfo::NACK){
|
||||||
$this->maxACKsAllowed[$id] = $acks - $ackCnt;
|
$this->maxACKsAllowed[$id] = $acks - $ackCnt;
|
||||||
}
|
}
|
||||||
$packet->ip = $source;
|
$packet->ip = $source;
|
||||||
|
|
@ -100,7 +100,7 @@ class MinecraftInterface{
|
||||||
return 0;
|
return 0;
|
||||||
}elseif($packet instanceof RakNetPacket){
|
}elseif($packet instanceof RakNetPacket){
|
||||||
RakNetCodec::encode($packet);
|
RakNetCodec::encode($packet);
|
||||||
if($packet->pid() >= RakNetInfo::DATA_PACKET_0 && $packet->pid() <= RakNetInfo::DATA_PACKET_F){
|
if($packet->pid() >= RakNetInfo::DATA_PACKET_0 && $packet->pid() <= RakNetInfo::DATA_PACKET_F && $packet->incrementAllowedAck){
|
||||||
$id = "{$packet->ip}:{$packet->port}";
|
$id = "{$packet->ip}:{$packet->port}";
|
||||||
if(isset($this->maxACKsAllowed[$id])){
|
if(isset($this->maxACKsAllowed[$id])){
|
||||||
++$this->maxACKsAllowed[$id];
|
++$this->maxACKsAllowed[$id];
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ class RakNetPacket extends Packet{
|
||||||
public $packetID;
|
public $packetID;
|
||||||
public $seqNumber;
|
public $seqNumber;
|
||||||
public $sendtime;
|
public $sendtime;
|
||||||
|
public $incrementAllowedAck = true;
|
||||||
|
|
||||||
public function __construct($packetID){
|
public function __construct($packetID){
|
||||||
$this->packetID = (int) $packetID;
|
$this->packetID = (int) $packetID;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class RakNetParser{
|
||||||
$offset += 3;
|
$offset += 3;
|
||||||
$end = Utils::readTriad(strrev(substr($buffer, $offset - 3, 3)));
|
$end = Utils::readTriad(strrev(substr($buffer, $offset - 3, 3)));
|
||||||
$acks += ($end - $start)+1;
|
$acks += ($end - $start)+1;
|
||||||
if($maxACKAllowed >= 0 && ($maxACKAllowed - $acks) < 0){
|
if($acks <= 0 || $maxACKAllowed >= 0 && ($maxACKAllowed - $acks) < 0){
|
||||||
$packet = false;
|
$packet = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue