diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-21 04:38:50 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-21 04:38:50 +0000 |
commit | 0421c8fe951b96801ca88680b33bbe5f20000a55 (patch) | |
tree | d166e3fc97293b80f2e1c6e8f8acc81785de2377 /TAO/tao | |
parent | f8774380d9654b8375f475b73873d55e62622f95 (diff) | |
download | ATCD-0421c8fe951b96801ca88680b33bbe5f20000a55.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/ORB.cpp | 66 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 17 | ||||
-rw-r--r-- | TAO/tao/orbconf.h | 10 |
3 files changed, 52 insertions, 41 deletions
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 62f60b7eeb1..49b6072623c 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -354,7 +354,7 @@ CORBA_ORB::resolve_poa_current (void) CORBA_Object_ptr -CORBA_ORB::resolve_name_service (void) +CORBA_ORB::resolve_name_service (ACE_Time_Value *timeout) { CORBA::Environment env; CORBA_Object_ptr return_value = CORBA_Object::_nil (); @@ -402,7 +402,9 @@ CORBA_ORB::resolve_name_service (void) } this->name_service_ = - this->multicast_to_service (TAO_SERVICEID_NAMESERVICE, port); + this->multicast_to_service (TAO_SERVICEID_NAMESERVICE, + port, + timeout); } // Return ior. @@ -411,7 +413,7 @@ CORBA_ORB::resolve_name_service (void) } CORBA_Object_ptr -CORBA_ORB::resolve_trading_service (void) +CORBA_ORB::resolve_trading_service (ACE_Time_Value *timeout) { CORBA::Environment env; CORBA_Object_ptr return_value = CORBA_Object::_nil (); @@ -458,7 +460,9 @@ CORBA_ORB::resolve_trading_service (void) } this->trading_service_ = - this->multicast_to_service (TAO_SERVICEID_TRADINGSERVICE, port); + this->multicast_to_service (TAO_SERVICEID_TRADINGSERVICE, + port, + timeout); } } @@ -469,7 +473,8 @@ CORBA_ORB::resolve_trading_service (void) CORBA_Object_ptr CORBA_ORB::multicast_to_service (TAO_Service_ID service_id, - u_short port) + u_short port, + ACE_Time_Value *timeout) { CORBA::Environment env; // Use UDP multicast to locate the service. @@ -493,36 +498,33 @@ CORBA_ORB::multicast_to_service (TAO_Service_ID service_id, // Choose any local port, we don't really care. if (response.open (ACE_Addr::sap_any) == -1) - { - ACE_ERROR ((LM_ERROR, "open failed.\n")); - return return_value; - } + ACE_ERROR_RETURN ((LM_ERROR, + "open failed.\n"), + return_value); if (response.get_local_addr (response_addr) == -1) - { - ACE_ERROR ((LM_ERROR, "get_local_addr failed.\n")); - return return_value; - } - + ACE_ERROR ((LM_ERROR, + "get_local_addr failed.\n"), + return_value); struct { u_short reply_port; CORBA::Short service_id; } mcast_info; - // Figure out what port to listen on for server replies, - // and convert to network byte order. + // Figure out what port to listen on for server replies, and convert + // to network byte order. mcast_info.reply_port = htons (response_addr.get_port_number ()); mcast_info.service_id = htons (service_id); // Send multicast of one byte, enough to wake up server. - ssize_t n_bytes = - multicast.send (&mcast_info, sizeof (mcast_info)); - + ssize_t n_bytes = multicast.send (&mcast_info, + sizeof (mcast_info)); if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "sent multicast request.")); + ACE_DEBUG ((LM_DEBUG, + "sent multicast request.")); - // check for errors + // Check for errors. if (n_bytes == -1) return return_value; if (TAO_debug_level > 0) @@ -533,22 +535,21 @@ CORBA_ORB::multicast_to_service (TAO_Service_ID service_id, response_addr.get_port_number (), n_bytes)); - - // Wait for response until TAO_DEFAULT_NAME_SERVER_TIMEOUT. - ACE_Time_Value timeout (TAO_DEFAULT_NAME_SERVER_TIMEOUT); + // Wait for response until TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT. + ACE_Time_Value tv (timeout == 0 ? TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT : *timeout); // receive response message char buf[ACE_MAX_DGRAM_SIZE]; - n_bytes = response.recv (buf, BUFSIZ, remote_addr, 0, &timeout); + n_bytes = response.recv (buf, BUFSIZ, remote_addr, 0, &tv); // Close endpoint for response. int retval = response.close (); - // check for errors + // Check for errors. if (n_bytes == -1 || retval == -1) return return_value; - // null terminate message + // Null terminate message. buf[n_bytes] = 0; if (TAO_debug_level > 0) @@ -557,11 +558,11 @@ CORBA_ORB::multicast_to_service (TAO_Service_ID service_id, __FILE__, buf)); - // convert ior to an object reference + // Convert ior to an object reference. CORBA_Object_ptr objectified_ior = this->string_to_object ((CORBA::String) buf, env); - // check for errors + // Check for errors. if (env.exception () == 0) return_value = objectified_ior; @@ -570,12 +571,13 @@ CORBA_ORB::multicast_to_service (TAO_Service_ID service_id, } CORBA_Object_ptr -CORBA_ORB::resolve_initial_references (CORBA::String name) +CORBA_ORB::resolve_initial_references (CORBA::String name, + ACE_Time_Value *timeout) { if (ACE_OS::strcmp (name, TAO_OBJID_NAMESERVICE) == 0) - return this->resolve_name_service (); + return this->resolve_name_service (timeout); if (ACE_OS::strcmp (name, TAO_OBJID_TRADINGSERVICE) == 0) - return this->resolve_trading_service (); + return this->resolve_trading_service (timeout); else if (ACE_OS::strcmp (name, TAO_OBJID_ROOTPOA) == 0) return this->resolve_root_poa (); else if (ACE_OS::strcmp (name, TAO_OBJID_POACURRENT) == 0) diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index a0a0ace54dc..9cfbfefb8fd 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -883,11 +883,20 @@ public: // has completed. <[NOTE]> <wait_for_completion>=TRUE is not // currently supported. - CORBA_Object_ptr resolve_initial_references (CORBA::String name); + CORBA_Object_ptr resolve_initial_references (CORBA::String name, + ACE_Time_Value *timeout = 0); // This method acts as a mini-bootstrapping Naming Service, which is // provided by the ORB for certain well-known object references. // TAO supports the "NameService", "TradingService", "RootPOA", and - // "POACurrent" via this method. + // "POACurrent" via this method. The <timeout> value bounds the + // amount of time the ORB blocks waiting to resolve the service. + // This is most useful for bootstrapping remote services, such as + // the "NameService" or "TradingService", that are commonly resolved + // via multicast. By default, the value is 0, which means "use the + // <TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT> timeout period". Note + // that by using a default value for the <timeout> parameter, TAO + // will remains compliant with the CORBA + // <resolve_initial_references> specification. // = TAO-specific extensions to the CORBA specification. @@ -967,10 +976,10 @@ protected: // Resolve the POA current. private: - CORBA_Object_ptr resolve_name_service (void); + CORBA_Object_ptr resolve_name_service (ACE_Time_Value *timeout); // Resolve the name service object reference. - CORBA_Object_ptr resolve_trading_service (void); + CORBA_Object_ptr resolve_trading_service (ACE_Time_Value *timeout); // Resolve the trading object reference. CORBA_Object_ptr multicast_to_service (TAO_Service_ID service_id, diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index ce2623b66f6..387745fc9bd 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -106,11 +106,11 @@ #define TAO_DEFAULT_TRADING_SERVER_REPLY_PORT 10017 #endif /* TAO_DEFAULT_NAME_SERVER_REPLY_PORT */ -// The default timeout receiving the location request to -// the TAO Naming Service. -#if !defined (TAO_DEFAULT_NAME_SERVER_TIMEOUT) -#define TAO_DEFAULT_NAME_SERVER_TIMEOUT 5 -#endif /* TAO_DEFAULT_NAME_SERVER_TIMEOUT */ +// The default timeout receiving the location request to the TAO +// Naming Service and Trading Service. +#if !defined (TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT) +#define TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT 3 +#endif /* TAO_DEFAULT_SERVICE_RESOLUTION_TIMEOUT */ // The default starting port number for TAO servers. #if !defined (TAO_DEFAULT_SERVER_PORT) |