Esempio n. 1
0
 void Connector::post_connect(
     SocketType & peer, 
     boost::system::error_code & ec)
 {
     if (!non_block_ && time_out_) {
         boost::asio::socket_base::non_blocking_io cmd(false);
         boost::system::error_code ec1;
         peer.io_control(cmd, ec1);
     }
     // support non-blocking mode
     if (ec == boost::asio::error::in_progress || 
         ec == boost::asio::error::already_started || 
         ec == boost::asio::error::would_block) {
             ec = boost::asio::error::would_block;
     } else if (ec == boost::asio::error::already_connected) {
         ec = boost::system::error_code();
     } else {
         connect_started_ = false;
     }
 }
Esempio n. 2
0
 void Connector::start_connect(
     SocketType & peer, 
     Endpoint const & ep, 
     boost::system::error_code & ec)
 {
     if (!non_block_ && time_out_) {
         boost::asio::socket_base::non_blocking_io cmd(true);
         peer.io_control(cmd, ec);
         if (ec)
             return;
     }
     if (!connect_started_) {
         connect_started_ = true;
         peer.connect(ep, ec);
     }
     if ((ec == boost::asio::error::in_progress || 
         ec == boost::asio::error::already_started)) {
             ec = boost::asio::error::would_block;
     }
 }