Skip to content

Commit 043aad6

Browse files
Reordered error checking in ConnectionPool::acceptConnection to improve coverage
1 parent 2be0ddc commit 043aad6

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/Connection/StreamSocketConnectionPool.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,18 @@ protected function acceptConnection(ConnectionHandlerFactoryInterface $connectio
114114
{
115115
$clientSocket = @stream_socket_accept($this->serverSocket);
116116

117-
if (false === $clientSocket) {
118-
return;
119-
}
120-
121-
stream_set_blocking($clientSocket, 0);
117+
if (false !== $clientSocket) {
118+
stream_set_blocking($clientSocket, 0);
122119

123-
$connection = new StreamSocketConnection($clientSocket);
124-
$handler = $connectionHandlerFactory->createConnectionHandler($connection);
120+
$connection = new StreamSocketConnection($clientSocket);
121+
$handler = $connectionHandlerFactory->createConnectionHandler($connection);
125122

126-
$id = spl_object_hash($connection);
123+
$id = spl_object_hash($connection);
127124

128-
$this->clientSockets[$id] = $clientSocket;
129-
$this->connections[$id] = $connection;
130-
$this->connectionHandlers[$id] = $handler;
125+
$this->clientSockets[$id] = $clientSocket;
126+
$this->connections[$id] = $connection;
127+
$this->connectionHandlers[$id] = $handler;
128+
}
131129
}
132130

133131
/**

0 commit comments

Comments
 (0)