void TAO_Blocked_Connect_Strategy::synch_options (ACE_Time_Value *timeout, ACE_Synch_Options &options) { if (timeout != 0) { // Blocking with a timeout options.set (ACE_Synch_Options::USE_TIMEOUT, *timeout); } else { // Making it sure it is blocking. options.set (0, ACE_Time_Value::zero); } }
void TAO_Reactive_Connect_Strategy::synch_options (ACE_Time_Value *timeout, ACE_Synch_Options &options) { if (timeout != 0) { options.set (ACE_Synch_Options::USE_REACTOR, *timeout); } else { // Making it sure it is blocking. options.set (ACE_Synch_Options::USE_REACTOR, ACE_Time_Value::zero); } }
NNTDECL_SIGNALS_END void SocketClientAsync::connect_to(core::NetAddress const& addr, core::Timeout const& tm) { // connect. # ifdef USE_REACTOR_MODE ACE_Synch_Options opt = ACE_Synch_Options::synch; if (tm.infinate()) { opt.set(ACE_Synch_Options::USE_REACTOR, ACE_Time_Value::zero, 0); } else { opt.timeout(ace::type_cast<ACE_Time_Value>(tm)); } d_ptr->handler = new _aceasync_handler; # endif # ifdef USE_PROACTOR_MODE d_ptr->handler = new _ace_handler_async; d_ptr->handler->_owner = this; # endif // connect. # ifdef USE_REACTOR_MODE int ret = d_ptr->connector.connect(d_ptr->handler, ace::type_cast<ACE_INET_Addr>(addr), opt ); # endif # ifdef USE_PROACTOR_MODE int ret = d_ptr->connector.open(d_ptr->handler); if (ret == 0) { ret = d_ptr->connector.connect(ace::type_cast<ACE_INET_Addr>(addr)); } # endif if (ret == 0) { # ifdef USE_REACTOR_MODE emit(kSignalSuccess); # endif } else { emit(kSignalFailed); trace_msg("socketclient: failed to connect server."); } }