/** * DGS_MMU_Acceptor::close */ void DGS_MMU_Acceptor::close (void) { ACE_Unbounded_Set_Iterator<DGSNetworkHandler *> iter (clients_.begin ()); DGSNetworkHandler **ih; while (iter.next (ih)) delete *ih; }
template <typename SVC_HANDLER, typename PEER_CONNECTOR> int ACE_Connector<SVC_HANDLER, PEER_CONNECTOR>::close (void) { // If there are no non-blocking handle pending, return immediately. if (this->non_blocking_handles ().size () == 0) return 0; // Exclusive access to the Reactor. ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1); // Go through all the non-blocking handles. It is necessary to // create a new iterator each time because we remove from the handle // set when we cancel the Svc_Handler. ACE_HANDLE *handle = 0; while (1) { ACE_Unbounded_Set_Iterator<ACE_HANDLE> iterator (this->non_blocking_handles ()); if (!iterator.next (handle)) break; ACE_Event_Handler *handler = this->reactor ()->find_handler (*handle); if (handler == 0) { ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%t: Connector::close h %d, no handler\n"), *handle)); // Remove handle from the set of non-blocking handles. this->non_blocking_handles ().remove (*handle); continue; } // find_handler() incremented handler's refcount; ensure it's decremented ACE_Event_Handler_var safe_handler (handler); NBCH *nbch = dynamic_cast<NBCH *> (handler); if (nbch == 0) { ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("%t: Connector::close h %d handler %@ ") ACE_TEXT ("not a legit handler\n"), *handle, handler)); // Remove handle from the set of non-blocking handles. this->non_blocking_handles ().remove (*handle); continue; } SVC_HANDLER *svc_handler = nbch->svc_handler (); // Cancel the non-blocking connection. this->cancel (svc_handler); // Close the associated Svc_Handler. svc_handler->close (NORMAL_CLOSE_OPERATION); } return 0; }
int ACE_URL_Local_Locator::url_query (const ACE_URL_Locator::ACE_Selection_Criteria how, const ACE_URL_Property_Seq *pseq, const size_t how_many, size_t &num_query, ACE_URL_Offer_Seq *offer) { ACE_URL_Record *item = 0; ACE_NEW_RETURN (offer, ACE_URL_Offer_Seq (how_many), -1); if (how >= ACE_URL_Locator::INVALID_SELECTION) { errno = ACE_URL_Locator::INVALID_ARGUMENT; return -1; } num_query = 0; for (ACE_Unbounded_Set_Iterator<ACE_URL_Record> iter (this->repository_); iter.next (item) != 0; iter.advance ()) { size_t i_query; size_t i_db; int found = 0; // Now this is a stupid implementation. Perhaps we can // implement this using Hash_Map. Better yet, I think we should // put this in a database and put SQL query here. for (i_query = 0; found == 0 && i_query < pseq->size (); i_query++) for (i_db = 0; i_db < item->offer_->url_properties ().size (); i_db++) { if ((*pseq)[i_query].name () == item->offer_->url_properties ()[i_db].name ()) if (how == ACE_URL_Locator::SOME) ; // if match and Some, copy to <offer>, inc <num_query>, advance iterator // else if All, advance iterator // else if None, check next property in <pseq>. if (all properties checked and found and ALL) copy to <offer>; inc <num_query>; else if (all properties checked and not found and NONE) copy to <offer>; inc <num_query>; else shouldn't happen, internal error if (num_query == how_many) break; }
int Task_Entry::prohibit_dispatches (Dependency_Type dt) { // Iterate over the set of dependencies, ensuring none of them has // the given dependency type. for (ACE_Unbounded_Set_Iterator <Task_Entry_Link *> iter (callers_); ! iter.done (); iter.advance ()) { Task_Entry_Link **link; if (iter.next (link) == 0 || link == 0 || *link == 0 || (*link)->dependency_type () == dt) return -1; } return 0; }
int Task_Entry::disjunctive_merge (Dependency_Type dt, ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, ACE_CString &unresolved_locals, ACE_CString &unresolved_remotes) { char string_buffer[BUFSIZ]; // Iterate over the set of dependencies, merging dispatches of the // callers over the enclosing frame size. for (ACE_Unbounded_Set_Iterator <Task_Entry_Link *> iter (callers_); ! iter.done (); iter.advance ()) { Task_Entry_Link **link; if (iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given if ((*link)->dependency_type () == dt) { // Check for and warn about unresolved remote dependencies // in the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_remote_dependencies () && ! this->has_unresolved_remote_dependencies ()) { // Propagate the unresolved remote dependency flag, and // issue a debug scheduler warning. this->has_unresolved_remote_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved remote dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved remote // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_remotes += ACE_CString (string_buffer); } // Check for and warn about unresolved local dependencies in // the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_local_dependencies () && ! this->has_unresolved_local_dependencies ()) { // Propagate the unresolved local dependency flag, and // issue a debug scheduler warning. this->has_unresolved_local_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved local dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved local // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_locals += ACE_CString (string_buffer); } // Merge the caller's dispatches into the current set. if (merge_frames (dispatch_entries, *this, dispatches_, (*link)->caller ().dispatches_, effective_period_, (*link)->caller ().effective_period_, (*link)->number_of_calls ()) < 0) return -1; } } return 0; }