| 41 | } |
| 42 | |
| 43 | void connect_handler(const boost::system::error_code& e, tcp::socket* s) |
| 44 | { |
| 45 | boost::asio::execution_context& context = boost::asio::query( |
| 46 | s->get_executor(), boost::asio::execution::context); |
| 47 | services::logger logger(context, "connect_handler"); |
| 48 | |
| 49 | if (!e) |
| 50 | { |
| 51 | logger.log("Connection established"); |
| 52 | |
| 53 | s->async_read_some(boost::asio::buffer(read_buffer), |
| 54 | std::bind(read_handler, boost::asio::placeholders::error, |
| 55 | boost::asio::placeholders::bytes_transferred, s)); |
| 56 | } |
| 57 | else |
| 58 | { |
| 59 | std::string msg = "Unable to establish connection: "; |
| 60 | msg += e.message(); |
| 61 | logger.log(msg); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | int main(int argc, char* argv[]) |
| 66 | { |
nothing calls this directly
no test coverage detected