Handle completion of a accept operation.
| 62 | |
| 63 | /// Handle completion of a accept operation. |
| 64 | void handle_accept(const boost::system::error_code& e, connection_ptr conn) |
| 65 | { |
| 66 | if (!e) |
| 67 | { |
| 68 | // Successfully accepted a new connection. Send the list of stocks to the |
| 69 | // client. The connection::async_write() function will automatically |
| 70 | // serialize the data structure for us. |
| 71 | conn->async_write(stocks_, |
| 72 | std::bind(&server::handle_write, this, |
| 73 | boost::asio::placeholders::error, conn)); |
| 74 | } |
| 75 | |
| 76 | // Start an accept operation for a new connection. |
| 77 | connection_ptr new_conn(new connection(acceptor_.get_executor())); |
| 78 | acceptor_.async_accept(new_conn->socket(), |
| 79 | std::bind(&server::handle_accept, this, |
| 80 | boost::asio::placeholders::error, new_conn)); |
| 81 | } |
| 82 | |
| 83 | /// Handle completion of a write operation. |
| 84 | void handle_write(const boost::system::error_code& e, connection_ptr conn) |
nothing calls this directly
no test coverage detected