| 63 | externalListener = true; |
| 64 | state = State::Started; |
| 65 | return Result(true); |
| 66 | } |
| 67 | |
| 68 | Result HttpAsyncServer::acceptExternalConnection(HttpConnection& connection, AsyncReadableStream& readable, |
| 69 | AsyncWritableStream& writable) |
| 70 | { |
| 71 | SC_TRY_MSG(state == State::Started and externalListener, |
| 72 | "HttpAsyncServer::acceptExternalConnection requires an external listener"); |
| 73 | HttpConnection::ID connectionID; |
| 74 | SC_TRY_MSG(connections.activate(connection, connectionID), |
| 75 | "HttpAsyncServer::acceptExternalConnection slot unavailable"); |
| 76 | |
| 77 | connection.resetTransportStreams(); |
| 78 | connection.setTransportStreams(readable, writable); |
| 79 | Result setup = beginTransportConnection(connection); |
| 80 | if (not setup) |
| 81 | { |
| 82 | closeAsync(connection); |
| 83 | return setup; |
| 84 | } |
| 85 | return Result(true); |
| 86 | } |
| 87 | |