Skip to content

Commit

Permalink
Fix error with uninitialized connectionStatistics object
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed Mar 25, 2024
1 parent 5de38f2 commit 4431adb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Server/Connection/TcpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function __construct(
private readonly \Closure|null $onClose = null,
private readonly \Closure|null $onError = null,
) {
$this->connectionStatistics = new ConnectionStatistics();
$clientSocket = \stream_socket_accept($socket, 0, $remoteAddress);
if ($clientSocket === false) {
if ($this->onError) {
Expand All @@ -73,7 +74,6 @@ public function __construct(

\stream_set_blocking($this->socket, false);
$this->onReadableCallbackId = $this->eventLoop->onReadable($this->socket, $this->baseRead(...));
$this->connectionStatistics = new ConnectionStatistics();
ActiveConnection::addConnection($this);

if ($this->onConnect !== null) {
Expand Down

0 comments on commit 4431adb

Please sign in to comment.