Skip to content

Commit

Permalink
Merge pull request #292 from clue-labs/unneeded-nonblock
Browse files Browse the repository at this point in the history
Avoid unneeded syscall on socket close
  • Loading branch information
WyriHaximus authored May 20, 2022
2 parents ccca668 + fe9999d commit dd3c325
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,9 @@ public function handleClose()
}

// Try to cleanly shut down socket and ignore any errors in case other
// side already closed. Shutting down may return to blocking mode on
// some legacy versions, so reset to non-blocking just in case before
// continuing to close the socket resource.
// Underlying Stream implementation will take care of closing file
// handle, so we otherwise keep this open here.
// side already closed. Underlying Stream implementation will take care
// of closing stream resource, so we otherwise keep this open here.
@\stream_socket_shutdown($this->stream, \STREAM_SHUT_RDWR);
\stream_set_blocking($this->stream, false);
}

public function getRemoteAddress()
Expand Down

0 comments on commit dd3c325

Please sign in to comment.