zaphoyd/websocketpp — Issue #69: Policy Refactor: Not easy to check if connection is established.
Author: megabyte1024
Created: 2012-02-16 11:33:56+00:00
State: open

Now I have the following situation. A client uses a thread pool with a asio::io_service::work class instance to prevent the io_service::run method exit. The client tries to connect to a server using a deadline timer. The client::connect method uses the boost::asio::async_connect method, i.e. after the connect method is finished is not clear either the connection established or not. The client::handle_connect method is executed in some time and even if there is an error, then the connection stays in the CONNECTING state. Now I use a timeout. If during this timeout the connection is still in the CONNECTION state then the code decides that is necessary to reconnect. It would be nice to have more reliable way to define if the client::handle_connect method executed with error.