summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-06-09 17:33:55 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-06-09 17:33:55 +0000
commit6f252a0941c0043ef40ea7d2520143b36ac7f646 (patch)
treea3b3fa717492688048951362ccadaf3409488bf2 /TAO/tao
parentcf2089c5edef81bc42ea1a2594af2e22e40c9908 (diff)
downloadATCD-6f252a0941c0043ef40ea7d2520143b36ac7f646.tar.gz
ChangeLogTag:Mon Jun 9 12:33:20 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.cpp117
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.h8
-rw-r--r--TAO/tao/Strategies/SCIOP_Endpoint.i42
3 files changed, 77 insertions, 90 deletions
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.cpp b/TAO/tao/Strategies/SCIOP_Endpoint.cpp
index 7f584ee7620..59769e29ccb 100644
--- a/TAO/tao/Strategies/SCIOP_Endpoint.cpp
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.cpp
@@ -1,4 +1,4 @@
-#include "SCIOP_Endpoint.h"
+ #include "SCIOP_Endpoint.h"
#include "tao/debug.h"
#if TAO_HAS_SCIOP == 1
@@ -15,49 +15,51 @@ ACE_RCSID (tao,
TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
int use_dotted_decimal_addresses)
- : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE),
- host_ (),
- port_ (683), // default port (IANA assigned)
- object_addr_ (addr),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
{
this->set (addr, use_dotted_decimal_addresses);
}
TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const char *host,
- CORBA::UShort port,
- const ACE_INET_Addr &addr)
- : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE),
- host_ (),
- port_ (port),
- object_addr_ (addr),
- object_addr_set_ (0),
- next_ (0)
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE,
+ priority)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
{
if (host != 0)
this->host_ = host;
}
TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (void)
- : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE),
- host_ (),
- port_ (683), // default port (IANA assigned)
- object_addr_ (),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
{
}
TAO_SCIOP_Endpoint::TAO_SCIOP_Endpoint (const char *host,
CORBA::UShort port,
CORBA::Short priority)
- : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE),
- host_ (),
- port_ (port),
- object_addr_ (),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (TAO_TAG_SCIOP_PROFILE)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
{
if (host != 0)
this->host_ = host;
@@ -126,14 +128,6 @@ TAO_SCIOP_Endpoint::host (const char *h)
return this->host_.in ();
}
-void
-TAO_SCIOP_Endpoint::reset_hint (void)
-{
- // Commented out for the time being....
- /* if (this->hint_)
- this->hint_->cleanup_hint ((void **) &this->hint_); */
-}
-
TAO_Endpoint *
TAO_SCIOP_Endpoint::next (void)
{
@@ -143,18 +137,13 @@ TAO_SCIOP_Endpoint::next (void)
TAO_Endpoint *
TAO_SCIOP_Endpoint::duplicate (void)
{
- // @@ Bala, we probably need to make sure that the duplicate has the
- // same priority as the original. Although it does not matter in
- // the context this method is currently used, if somebody ends up
- // using this method for some other purpose later, this will be a
- // seed for bugs.
-
TAO_SCIOP_Endpoint *endpoint = 0;
ACE_NEW_RETURN (endpoint,
TAO_SCIOP_Endpoint (this->host_.in (),
- this->port_,
- this->object_addr_),
+ this->port_,
+ this->object_addr_,
+ this->priority ()),
0);
return endpoint;
@@ -185,4 +174,46 @@ TAO_SCIOP_Endpoint::hash (void)
return this->object_addr ().get_ip_address () + this->port ();
}
+const ACE_INET_Addr &
+TAO_SCIOP_Endpoint::object_addr (void) const
+{
+ // The object_addr_ is initialized here, rather than at IOR decode
+ // time for several reasons:
+ // 1. A request on the object may never be invoked.
+ // 2. The DNS setup may have changed dynamically.
+ // ...etc..
+
+ // Double checked locking optimization.
+ if (!this->object_addr_set_)
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
+ guard,
+ this->addr_lookup_lock_,
+ this->object_addr_);
+
+ if (!this->object_addr_set_)
+ {
+ if (this->object_addr_.set (this->port_,
+ this->host_.in ()) == -1)
+ {
+ // If this call fails, it most likely due a hostname
+ // lookup failure caused by a DNS misconfiguration. If
+ // a request is made to the object at the given host and
+ // port, then a CORBA::TRANSIENT() exception should be
+ // thrown.
+
+ // Invalidate the ACE_INET_Addr. This is used as a flag
+ // to denote that ACE_INET_Addr initialization failed.
+ this->object_addr_.set_type (-1);
+ }
+ else
+ {
+ this->object_addr_set_ = 1;
+ }
+ }
+ }
+
+ return this->object_addr_;
+}
+
#endif /* TAO_HAS_SCIOP == 1 */
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.h b/TAO/tao/Strategies/SCIOP_Endpoint.h
index b24a148f1a8..e0e69ab867b 100644
--- a/TAO/tao/Strategies/SCIOP_Endpoint.h
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.h
@@ -56,8 +56,9 @@ public:
/// Constructor. This is the most efficient constructor since it
/// does not require any address resolution processing.
TAO_SCIOP_Endpoint (const char *host,
- CORBA::UShort port,
- const ACE_INET_Addr &addr);
+ CORBA::UShort port,
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority = TAO_INVALID_PRIORITY);
/// Constructor.
TAO_SCIOP_Endpoint (const ACE_INET_Addr &addr,
@@ -76,9 +77,6 @@ public:
virtual TAO_Endpoint *next (void);
virtual int addr_to_string (char *buffer, size_t length);
- virtual void reset_hint (void);
-
- /// Makes a copy of <this>
virtual TAO_Endpoint *duplicate (void);
/// Return true if this endpoint is equivalent to <other_endpoint>. Two
diff --git a/TAO/tao/Strategies/SCIOP_Endpoint.i b/TAO/tao/Strategies/SCIOP_Endpoint.i
index 86cb178c2f5..fd182741c6b 100644
--- a/TAO/tao/Strategies/SCIOP_Endpoint.i
+++ b/TAO/tao/Strategies/SCIOP_Endpoint.i
@@ -1,48 +1,6 @@
// -*- C++ -*-
// $Id$
-ACE_INLINE const ACE_INET_Addr &
-TAO_SCIOP_Endpoint::object_addr (void) const
-{
- // The object_addr_ is initialized here, rather than at IOR decode
- // time for several reasons:
- // 1. A request on the object may never be invoked.
- // 2. The DNS setup may have changed dynamically.
- // ...etc..
-
- // Double checked locking optimization.
- if (!this->object_addr_set_)
- {
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
- guard,
- this->addr_lookup_lock_,
- this->object_addr_);
-
- if (!this->object_addr_set_)
- {
- if (this->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
- {
- // If this call fails, it most likely due a hostname
- // lookup failure caused by a DNS misconfiguration. If
- // a request is made to the object at the given host and
- // port, then a CORBA::TRANSIENT() exception should be
- // thrown.
-
- // Invalidate the ACE_INET_Addr. This is used as a flag
- // to denote that ACE_INET_Addr initialization failed.
- this->object_addr_.set_type (-1);
- }
- else
- {
- this->object_addr_set_ = 1;
- }
- }
- }
-
- return this->object_addr_;
-}
-
ACE_INLINE const char *
TAO_SCIOP_Endpoint::host (void) const
{