public function process()
 {
     if (count($this->identifiers) > 0) {
         foreach ($this->identifiers as $id => $player) {
             $player->handleACK($id);
         }
     }
     while (strlen($buffer = $this->thread->readThreadToMainPacket()) > 0) {
         $offset = 1;
         $pid = ord($buffer[0]);
         if ($pid === ServerManager::PACKET_SEND_PACKET) {
             $id = Binary::readInt(substr($buffer, $offset, 4));
             $offset += 4;
             if (isset($this->sessionsPlayers[$id])) {
                 $payload = substr($buffer, $offset);
                 try {
                     $this->handlePacket($this->sessionsPlayers[$id], $payload);
                 } catch (\Exception $e) {
                     if (\pocketmine\DEBUG > 1) {
                         $logger = $this->server->getLogger();
                         if ($logger instanceof MainLogger) {
                             $logger->debug("DesktopPacket 0x" . bin2hex($payload));
                             $logger->logException($e);
                         }
                     }
                 }
             }
         } elseif ($pid === ServerManager::PACKET_OPEN_SESSION) {
             $id = Binary::readInt(substr($buffer, $offset, 4));
             $offset += 4;
             if (isset($this->sessionsPlayers[$id])) {
                 continue;
             }
             $len = ord($buffer[$offset++]);
             $address = substr($buffer, $offset, $len);
             $offset += $len;
             $port = Binary::readShort(substr($buffer, $offset, 2));
             $identifier = "{$id}:{$address}:{$port}";
             $player = new DesktopPlayer($this, $identifier, $address, $port, $this->plugin);
             $this->sessions->attach($player, $id);
             $this->sessionsPlayers[$id] = $player;
             $this->plugin->getServer()->addPlayer($identifier, $player);
         } elseif ($pid === ServerManager::PACKET_CLOSE_SESSION) {
             $id = Binary::readInt(substr($buffer, $offset, 4));
             $offset += 4;
             $flag = Binary::readInt(substr($buffer, $offset, 4));
             if (isset($this->sessionsPlayers[$id])) {
                 if ($flag === 0) {
                     $this->close($this->sessionsPlayers[$id]);
                 } else {
                     $this->closeSession($id);
                 }
             }
         }
     }
     return true;
 }