|
|
@@ -890,11 +890,6 @@ class TcpConnection extends ConnectionInterface
|
|
|
Worker::$globalEvent->del($this->_socket, EventInterface::EV_WRITE);
|
|
|
// Close socket.
|
|
|
@fclose($this->_socket);
|
|
|
- // Remove from worker->connections.
|
|
|
- if ($this->worker) {
|
|
|
- unset($this->worker->connections[$this->_id]);
|
|
|
- }
|
|
|
- unset(static::$connections[$this->_id]);
|
|
|
$this->_status = self::STATUS_CLOSED;
|
|
|
// Try to emit onClose callback.
|
|
|
if ($this->onClose) {
|
|
|
@@ -923,6 +918,11 @@ class TcpConnection extends ConnectionInterface
|
|
|
if ($this->_status === self::STATUS_CLOSED) {
|
|
|
// Cleaning up the callback to avoid memory leaks.
|
|
|
$this->onMessage = $this->onClose = $this->onError = $this->onBufferFull = $this->onBufferDrain = null;
|
|
|
+ // Remove from worker->connections.
|
|
|
+ if ($this->worker) {
|
|
|
+ unset($this->worker->connections[$this->_id]);
|
|
|
+ }
|
|
|
+ unset(static::$connections[$this->_id]);
|
|
|
}
|
|
|
}
|
|
|
|