@@ -39,42 +39,40 @@ using websocketpp::lib::placeholders::_1;
3939using websocketpp::lib::placeholders::_2;
4040using websocketpp::lib::bind;
4141
42- namespace asio = websocketpp::lib::asio;
43-
4442struct tcp_echo_session : websocketpp::lib::enable_shared_from_this<tcp_echo_session> {
4543 typedef websocketpp::lib::shared_ptr<tcp_echo_session> ptr;
4644
47- tcp_echo_session (asio::io_context & context) : m_socket(context) {}
45+ tcp_echo_session (websocketpp::lib:: asio::io_context & context) : m_socket(context) {}
4846
4947 void start () {
50- m_socket.async_read_some (asio::buffer (m_buffer, sizeof (m_buffer)),
48+ m_socket.async_read_some (websocketpp::lib:: asio::buffer (m_buffer, sizeof (m_buffer)),
5149 websocketpp::lib::bind (
5250 &tcp_echo_session::handle_read, shared_from_this (), _1, _2));
5351 }
5452
55- void handle_read (const asio::error_code & ec, size_t transferred) {
53+ void handle_read (const websocketpp::lib:: asio::error_code & ec, size_t transferred) {
5654 if (!ec) {
57- asio::async_write (m_socket,
58- asio::buffer (m_buffer, transferred),
55+ websocketpp::lib:: asio::async_write (m_socket,
56+ websocketpp::lib:: asio::buffer (m_buffer, transferred),
5957 bind (&tcp_echo_session::handle_write, shared_from_this (), _1));
6058 }
6159 }
6260
63- void handle_write (const asio::error_code & ec) {
61+ void handle_write (const websocketpp::lib:: asio::error_code & ec) {
6462 if (!ec) {
65- m_socket.async_read_some (asio::buffer (m_buffer, sizeof (m_buffer)),
63+ m_socket.async_read_some (websocketpp::lib:: asio::buffer (m_buffer, sizeof (m_buffer)),
6664 bind (&tcp_echo_session::handle_read, shared_from_this (), _1, _2));
6765 }
6866 }
6967
70- asio::ip::tcp::socket m_socket;
68+ websocketpp::lib:: asio::ip::tcp::socket m_socket;
7169 char m_buffer[1024 ];
7270};
7371
7472struct tcp_echo_server {
75- tcp_echo_server (asio::io_context & context, short port)
73+ tcp_echo_server (websocketpp::lib:: asio::io_context & context, short port)
7674 : m_context(context)
77- , m_acceptor(context, asio::ip::tcp::endpoint(asio::ip::tcp::v6(), port))
75+ , m_acceptor(context, websocketpp::lib:: asio::ip::tcp::endpoint(websocketpp::lib:: asio::ip::tcp::v6(), port))
7876 {
7977 this ->start_accept ();
8078 }
@@ -85,13 +83,13 @@ struct tcp_echo_server {
8583 bind (&tcp_echo_server::handle_accept, this , new_session, _1));
8684 }
8785
88- void handle_accept (tcp_echo_session::ptr new_session, const asio::error_code & ec) {
86+ void handle_accept (tcp_echo_session::ptr new_session, const websocketpp::lib:: asio::error_code & ec) {
8987 if (!ec) {
9088 new_session->start ();
9189 }
9290 start_accept ();
9391 }
9492
95- asio::io_context & m_context;
96- asio::ip::tcp::acceptor m_acceptor;
93+ websocketpp::lib:: asio::io_context & m_context;
94+ websocketpp::lib:: asio::ip::tcp::acceptor m_acceptor;
9795};
0 commit comments