Skip to content

Commit

Permalink
Merge pull request #1086 from lengqiuqiuqiu/master
Browse files Browse the repository at this point in the history
检测是否为null
  • Loading branch information
walkor authored Jan 19, 2025
2 parents 1e7bb17 + 0549bd8 commit 7eaf223
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Connection/TcpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@ public function getRecvBufferQueueSize(): int
*/
public function pauseRecv(): void
{
$this->eventLoop->offReadable($this->socket);
if($this->eventLoop !== null){
$this->eventLoop->offReadable($this->socket);
}
$this->isPaused = true;
}

Expand Down Expand Up @@ -1037,10 +1039,12 @@ public function destroy(): void
return;
}
// Remove event listener.
$this->eventLoop->offReadable($this->socket);
$this->eventLoop->offWritable($this->socket);
if (DIRECTORY_SEPARATOR === '\\' && method_exists($this->eventLoop, 'offExcept')) {
$this->eventLoop->offExcept($this->socket);
if($this->eventLoop !== null){
$this->eventLoop->offReadable($this->socket);
$this->eventLoop->offWritable($this->socket);
if (DIRECTORY_SEPARATOR === '\\' && method_exists($this->eventLoop, 'offExcept')) {
$this->eventLoop->offExcept($this->socket);
}
}

// Close socket.
Expand Down

0 comments on commit 7eaf223

Please sign in to comment.