raklib\server\SessionManager::notifyACK PHP Method

notifyACK() public method

public notifyACK ( Session $session, $identifierACK )
$session Session
    public function notifyACK(Session $session, $identifierACK)
    {
        $this->streamACK($session->getAddress() . ":" . $session->getPort(), $identifierACK);
    }

Usage Example

Ejemplo n.º 1
0
 public function update($time)
 {
     if (!$this->isActive and $this->lastUpdate + 10 < $time) {
         $this->disconnect("超时");
         return;
     }
     $this->isActive = \false;
     if (\count($this->ACKQueue) > 0) {
         $pk = new ACK();
         $pk->packets = $this->ACKQueue;
         $this->sendPacket($pk);
         $this->ACKQueue = [];
     }
     if (\count($this->NACKQueue) > 0) {
         $pk = new NACK();
         $pk->packets = $this->NACKQueue;
         $this->sendPacket($pk);
         $this->NACKQueue = [];
     }
     if (\count($this->packetToSend) > 0) {
         $limit = 16;
         foreach ($this->packetToSend as $k => $pk) {
             $pk->sendTime = $time;
             $pk->encode();
             $this->recoveryQueue[$pk->seqNumber] = $pk;
             unset($this->packetToSend[$k]);
             $this->sendPacket($pk);
             if (--$limit <= 0) {
                 break;
             }
         }
         if (\count($this->packetToSend) > self::$WINDOW_SIZE) {
             $this->packetToSend = [];
         }
     }
     if (\count($this->needACK) > 0) {
         foreach ($this->needACK as $identifierACK => $indexes) {
             if (\count($indexes) === 0) {
                 unset($this->needACK[$identifierACK]);
                 $this->sessionManager->notifyACK($this, $identifierACK);
             }
         }
     }
     foreach ($this->recoveryQueue as $seq => $pk) {
         if ($pk->sendTime < \time() - 8) {
             $this->packetToSend[] = $pk;
             unset($this->recoveryQueue[$seq]);
         } else {
             break;
         }
     }
     foreach ($this->receivedWindow as $seq => $bool) {
         if ($seq < $this->windowStart) {
             unset($this->receivedWindow[$seq]);
         } else {
             break;
         }
     }
     $this->sendQueue();
 }
All Usage Examples Of raklib\server\SessionManager::notifyACK