Skip to content

Commit

Permalink
check current timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
ro0NL authored and nekufa committed Mar 22, 2024
1 parent ab52b59 commit 986c8ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand All @@ -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'));
}
}
Expand Down

0 comments on commit 986c8ef

Please sign in to comment.