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

Commit

Permalink
Fixed clients not having a timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Jul 12, 2014
1 parent df53c08 commit 243e611
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions raklib/server/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ public function update($time){
if(!$this->isActive and ($this->lastUpdate + 10) < $time){
$this->disconnect("timeout");
return;
}else{
$this->lastUpdate = $time;
}
$this->isActive = false;

Expand Down Expand Up @@ -299,6 +297,7 @@ protected function handleEncapsulatedPacket(EncapsulatedPacket $packet){

public function handlePacket(Packet $packet){
$this->isActive = true;
$this->lastUpdate = microtime(true);
if($this->state === self::STATE_CONNECTED or $this->state === self::STATE_CONNECTING_2){
if($packet::$ID >= 0x80 and $packet::$ID <= 0x8f and $packet instanceof DataPacket){ //Data packet
$packet->decode();
Expand Down
2 changes: 1 addition & 1 deletion raklib/server/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function receiveStream(){

++$this->ticks;
if(($this->ticks & 0b1111) === 0){
$diff = $time - $this->lastMeasure;
$diff = max(0.005, $time - $this->lastMeasure);
$this->streamOption("bandwidth", serialize([
"up" => $this->sendBytes / $diff,
"down" => $this->receiveBytes / $diff
Expand Down

0 comments on commit 243e611

Please sign in to comment.