Skip to content

Commit

Permalink
Avoid unneeded syscall on socket close
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed May 20, 2022
1 parent ccca668 commit fe9999d
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 fe9999d

Please sign in to comment.