summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Endpoint.cpp
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-06-07 14:03:55 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-06-07 14:03:55 +0000
commitb30238cef6fa0b3e0d37d40a48c3401d649de6d2 (patch)
treef64d3e70a9d65fbc60b65fb536934208d2303c49 /TAO/tao/IIOP_Endpoint.cpp
parentd29f08923e48aaf06b2fd344a50195895ea5a09e (diff)
downloadATCD-b30238cef6fa0b3e0d37d40a48c3401d649de6d2.tar.gz
ChangeLogTag:Sat Jun 07 08:50:13 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/tao/IIOP_Endpoint.cpp')
-rw-r--r--TAO/tao/IIOP_Endpoint.cpp111
1 files changed, 71 insertions, 40 deletions
diff --git a/TAO/tao/IIOP_Endpoint.cpp b/TAO/tao/IIOP_Endpoint.cpp
index ffc372da2e3..bdddb474641 100644
--- a/TAO/tao/IIOP_Endpoint.cpp
+++ b/TAO/tao/IIOP_Endpoint.cpp
@@ -15,49 +15,51 @@ ACE_RCSID (tao,
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const ACE_INET_Addr &addr,
int use_dotted_decimal_addresses)
- : TAO_Endpoint (IOP::TAG_INTERNET_IOP),
- host_ (),
- port_ (683), // default port (IANA assigned)
- object_addr_ (addr),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
{
this->set (addr, use_dotted_decimal_addresses);
}
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
CORBA::UShort port,
- const ACE_INET_Addr &addr)
- : TAO_Endpoint (IOP::TAG_INTERNET_IOP),
- host_ (),
- port_ (port),
- object_addr_ (addr),
- object_addr_set_ (0),
- next_ (0)
+ const ACE_INET_Addr &addr,
+ CORBA::Short priority)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP,
+ priority)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ (addr)
+ , object_addr_set_ (0)
+ , next_ (0)
{
if (host != 0)
this->host_ = host;
}
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (void)
- : TAO_Endpoint (IOP::TAG_INTERNET_IOP),
- host_ (),
- port_ (683), // default port (IANA assigned)
- object_addr_ (),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
+ , host_ ()
+ , port_ (683) // default port (IANA assigned)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
{
}
TAO_IIOP_Endpoint::TAO_IIOP_Endpoint (const char *host,
CORBA::UShort port,
CORBA::Short priority)
- : TAO_Endpoint (IOP::TAG_INTERNET_IOP),
- host_ (),
- port_ (port),
- object_addr_ (),
- object_addr_set_ (0),
- next_ (0)
+ : TAO_Endpoint (IOP::TAG_INTERNET_IOP)
+ , host_ ()
+ , port_ (port)
+ , object_addr_ ()
+ , object_addr_set_ (0)
+ , next_ (0)
{
if (host != 0)
this->host_ = host;
@@ -126,14 +128,6 @@ TAO_IIOP_Endpoint::host (const char *h)
return this->host_.in ();
}
-void
-TAO_IIOP_Endpoint::reset_hint (void)
-{
- // Commented out for the time being....
- /* if (this->hint_)
- this->hint_->cleanup_hint ((void **) &this->hint_); */
-}
-
TAO_Endpoint *
TAO_IIOP_Endpoint::next (void)
{
@@ -143,23 +137,60 @@ TAO_IIOP_Endpoint::next (void)
TAO_Endpoint *
TAO_IIOP_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_IIOP_Endpoint *endpoint = 0;
ACE_NEW_RETURN (endpoint,
TAO_IIOP_Endpoint (this->host_.in (),
this->port_,
- this->object_addr_),
+ this->object_addr_,
+ this->priority ()),
0);
return endpoint;
}
+const ACE_INET_Addr &
+TAO_IIOP_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_;
+}
+
CORBA::Boolean
TAO_IIOP_Endpoint::is_equivalent (const TAO_Endpoint *other_endpoint)
{