Skip to content

Commit

Permalink
检测是否为null
Browse files Browse the repository at this point in the history
  • Loading branch information
冷、秋秋秋秋秋秋秋 committed Jan 18, 2025
1 parent 1e7bb17 commit 0549bd8
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 0549bd8

Please sign in to comment.