| 361 | } |
| 362 | |
| 363 | Future<Socket> accept() |
| 364 | { |
| 365 | // NOTE: We save a reference to the listening socket itself |
| 366 | // (i.e., 'this') so that we don't close the listening socket |
| 367 | // while 'accept' is in flight. |
| 368 | std::shared_ptr<SocketImpl> self = impl->shared_from_this(); |
| 369 | |
| 370 | return impl->accept() |
| 371 | // TODO(benh): Use && for `accepted` here! |
| 372 | .then([self](const std::shared_ptr<SocketImpl>& accepted) { |
| 373 | return Socket(accepted); |
| 374 | }); |
| 375 | } |
| 376 | |
| 377 | // NOTE: Calling this overload when `kind() == SSL` will result |
| 378 | // in program termination. |