diff --git a/src/TcpConnector.php b/src/TcpConnector.php index ddd5bd3..62d4b5f 100644 --- a/src/TcpConnector.php +++ b/src/TcpConnector.php @@ -65,6 +65,8 @@ public function checkConnectedSocket($socket) // The following hack looks like the only way to // detect connection refused errors with PHP's stream sockets. if (false === stream_socket_get_name($socket, true)) { + fclose($socket); + return Promise\reject(new ConnectionException('Connection refused')); }