bool Session_T<ACE_SYNCH_USE>::connect (bool use_reactor) { INET_TRACE ("ACE_FTP_Session::connect"); typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type; this->close (); unsigned long f_reactor = use_reactor ? ACE_Synch_Options::USE_REACTOR : 0; ACE_Synch_Options sync_opt (ACE_Synch_Options::USE_TIMEOUT | f_reactor, this->ftp_timeout_); connector_type connector; connection_type* new_connection = 0; ACE_NEW_RETURN (new_connection, connection_type(sync_opt), false); if (connector.connect (new_connection, ACE_INET_Addr (this->port_, this->host_.c_str ()), ACE_Synch_Options (0,this->ftp_timeout_)) == -1) { INET_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("(%d) ACE_FTP_Session::connect - ") ACE_TEXT ("failed to connect; host=%C, port=%d"), ACE_OS::last_error (), this->host_.c_str (), this->port_)); // as the connection was dynamically allocated // the connector causes it to be destroyed after // the connection failure return false; } this->connection_ = new_connection; this->connection_->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); ACE_NEW_NORETURN (this->sock_stream_, sock_stream_type (this->connection_)); if (this->sock_stream_) { this->new_connect_ = true; this->cannot_reconnect_ = false; this->reactive_ = use_reactor; return true; } else { this->close (); return false; } }
bool Session_T<ACE_SYNCH_USE>::connect_i (const ACE_Synch_Options& sync_opt) { INET_TRACE ("ACE_HTTP_Session::connect_i"); typedef ACE_Connector<connection_type, ACE_SOCK_CONNECTOR> connector_type; connector_type connector; connection_type* new_connection = 0; ACE_NEW_RETURN (new_connection, connection_type(sync_opt), false); if (connector.connect (new_connection, ACE_INET_Addr (this->port_, this->host_.c_str ()), ACE_Synch_Options (0,this->http_timeout_)) == -1) { INET_ERROR (1, (LM_ERROR, DLINFO ACE_TEXT ("(%d) ACE_HTTP_Session::connect_i - ") ACE_TEXT ("failed to connect; host=%C, port=%d\n"), ACE_OS::last_error (), this->host_.c_str (), this->port_)); // as the connection was dynamically allocated // the connector causes it to be destroyed after // the connection failure return false; } this->connection_ = new_connection; this->connection_->reference_counting_policy ().value ( ACE_Event_Handler::Reference_Counting_Policy::ENABLED); ACE_NEW_NORETURN (this->sock_stream_, sock_stream_type (this->connection_)); if (this->sock_stream_) { this->cannot_reconnect_ = false; this->reactive_ = sync_opt[ACE_Synch_Options::USE_REACTOR]; // reset reconnect timer this->reconnect_timer_ = this->keep_alive_timeout_; this->reconnect_countdown_.start (); return true; } else { this->close (); return false; } }
NET *s_traverse_net (TOPLEVEL *pr_current, NET *nets, int starting, OBJECT *object, char *hierarchy_tag, int type) { NET *new_net; CONN *c_current; GList *cl_current; char *temp = NULL; const gchar *netattrib_pinnum = NULL; visit (object); if (connection_type (object) != type) return nets; new_net = nets = s_net_add(nets); new_net->nid = object->sid; /* pins are not allowed to have the netname attribute attached to them */ if (object->type != OBJ_PIN) { /* Ignore netname attributes on buses */ if (object->type == OBJ_NET) temp = o_attrib_search_object_attribs_by_name (object, "netname", 0); if (temp) { new_net->net_name = s_hierarchy_create_netname(pr_current, temp, hierarchy_tag); g_free(temp); } else if (object->type == OBJ_NET) { /* search for the old label= attribute on nets */ temp = o_attrib_search_object_attribs_by_name (object, "label", 0); if (temp) { printf(_("WARNING: Found label=%s. label= is deprecated, please use netname=\n"), temp); new_net->net_name = s_hierarchy_create_netname(pr_current, temp, hierarchy_tag); g_free(temp); } } } #if DEBUG printf("inside traverse: %s\n", object->name); #endif if (object->type == OBJ_PIN) { verbose_print (starting ? "p" : "P"); new_net->connected_to = s_net_return_connected_string (pr_current, object, hierarchy_tag); temp = o_attrib_search_object_attribs_by_name (object, "pinlabel", 0); if (temp) { new_net->pin_label = temp; } /* net= new */ netattrib_pinnum = s_netattrib_connected_string_get_pinnum (nets->connected_to); if (netattrib_pinnum != NULL && type == PIN_TYPE_NET) { #if DEBUG printf("going to find netname %s \n", nets->connected_to); #endif nets->net_name = s_netattrib_return_netname (pr_current, object, nets->connected_to, hierarchy_tag); nets->net_name_has_priority = TRUE; g_free(nets->connected_to); nets->connected_to = NULL; } #if DEBUG printf("traverse connected_to: %s\n", new_net->connected_to); #endif /* Terminate if we hit a pin which isn't the one we started with */ if (!starting) return nets; } /*printf("Found net %s\n", object->name); */ verbose_print("n"); /* this is not perfect yet and won't detect a loop... */ if (is_visited(object) > 100) { fprintf(stderr, _("Found a possible net/pin infinite connection\n")); exit(-1); } cl_current = object->conn_list; while (cl_current != NULL) { c_current = (CONN *) cl_current->data; if (c_current->other_object != NULL) { if (!is_visited(c_current->other_object) && c_current->other_object != object) { nets = s_traverse_net (pr_current, nets, FALSE, c_current->other_object, hierarchy_tag, type); } } cl_current = g_list_next(cl_current); } return (nets); }