Skip to content

Commit 215a8bb

Browse files
committed
bugfix
1 parent b676fd1 commit 215a8bb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

multiplayer_server/PR2Client.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ class PR2Client extends \chabot\SocketServerClient
1515
public $login_id;
1616
public $process = false;
1717
public $ip;
18+
public $id;
1819

1920
public function __construct($socket)
2021
{
2122
parent::__construct($socket);
23+
$this->id = spl_object_id($socket);
2224
$time = time();
2325
$this->last_action = $time;
2426
$this->last_user_action = $time;

vend/socket/SocketDaemon.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ private function cleanSockets()
9191
{
9292
# maybe could do this instead: $this->clients = array_filter($this->clients, fn($s) => !$s->disconnected && $this->socket instanceof \Socket)
9393
foreach ($this->clients as $socket) {
94-
if ($socket->disconnected || !$socket instanceof \Socket) {
95-
if (isset($this->clients[spl_object_id($socket->socket)])) {
96-
unset($this->clients[spl_object_id($socket->socket)]);
94+
if ($socket->disconnected || !$socket->socket instanceof \Socket) {
95+
if (isset($this->clients[$socket->id])) {
96+
unset($this->clients[$socket->id]);
9797
}
9898
}
9999
}

0 commit comments

Comments
 (0)