| 158 | { |
| 159 | SocketDescriptor acceptedClient; |
| 160 | Result accepted = result.moveTo(acceptedClient); |
| 161 | if (not accepted) |
| 162 | { |
| 163 | if (onError.isValid()) |
| 164 | { |
| 165 | onError(accepted); |
| 166 | } |
| 167 | return; |
| 168 | } |
| 169 | HttpConnection::ID idx; |
| 170 | // Activation always succeeds because we pause asyncAccept when the there are not available clients |
| 171 | SC_HTTP_ASSERT_RELEASE(connections.activateNew(idx)); |
| 172 | |
| 173 | HttpConnection& client = static_cast<HttpConnection&>(connections.getConnection(idx)); |
| 174 | |
| 175 | SC_HTTP_ASSERT_RELEASE(client.readableSocketStream.request.isFree()); |
| 176 | SC_HTTP_ASSERT_RELEASE(client.writableSocketStream.request.isFree()); |
| 177 | |
| 178 | client.socket = move(acceptedClient); |
| 179 | SC_HTTP_TRUST_RESULT(client.readableSocketStream.init(client.buffersPool, *eventLoop, client.socket)); |
| 180 | SC_HTTP_TRUST_RESULT(client.writableSocketStream.init(client.buffersPool, *eventLoop, client.socket)); |
| 181 | client.resetTransportStreams(); |
| 182 | client.readableSocketStream.setAutoDestroy(true); |
| 183 | client.writableSocketStream.setAutoDestroy(false); // needed for keep-alive logic |
| 184 | |
| 185 | Result setup = beginTransportConnection(client); |
| 186 | if (not setup) |
| 187 | { |
| 188 | if (onError.isValid()) |
| 189 | { |
| 190 | onError(setup); |
| 191 | } |
| 192 | closeAsync(client); |
| 193 | } |
| 194 | |
| 195 | // Only reactivate asyncAccept if there are available clients (otherwise it's being reactivated in closeAsync) |
| 196 | result.reactivateRequest(connections.getNumActiveConnections() < connections.getNumTotalConnections()); |
| 197 | } |
| 198 |
nothing calls this directly
no test coverage detected