diff --git a/src/Connection.php b/src/Connection.php index b7f9874..411e043 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -88,8 +88,8 @@ public function getMessage(null|int|float $timeout = 0): ?Message return $message; } } elseif ($this->activityAt && $this->activityAt + $this->config->timeout < $now) { - if ($this->pingAt + $this->config->pingInterval < $now) { - if ($this->prolongateTill < $now) { + if ($this->pingAt && $this->pingAt + $this->config->pingInterval < $now) { + if ($this->prolongateTill && $this->prolongateTill < $now) { $this->sendMessage(new Ping()); } } @@ -103,9 +103,9 @@ public function getMessage(null|int|float $timeout = 0): ?Message } } - if ($this->activityAt + $this->config->timeout < $now) { - if ($this->pongAt + $this->config->pingInterval < $now) { - if ($this->prolongateTill < $now) { + if ($this->activityAt && $this->activityAt + $this->config->timeout < $now) { + if ($this->pongAt && $this->pongAt + $this->config->pingInterval < $now) { + if ($this->prolongateTill && $this->prolongateTill < $now) { $this->processException(new LogicException('Socket read timeout')); } }