summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2000-05-10 03:06:34 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2000-05-10 03:06:34 +0000
commit4564e5b9318e3127ac8e4f0411406f66f372f404 (patch)
tree641b411e2bd480d707cae6586826307943f3b26b
parent31ef680946c70ed32b8b108da2c9e0e6e02c9ef3 (diff)
downloadATCD-4564e5b9318e3127ac8e4f0411406f66f372f404.tar.gz
ChangeLogTag:Tue May 9 20:01:41 2000 Ossama Othman <ossama@uci.edu>
-rw-r--r--TAO/tao/Acceptor_Registry.cpp13
-rw-r--r--TAO/tao/Acceptor_Registry.h5
-rw-r--r--TAO/tao/Connector_Registry.h4
-rw-r--r--TAO/tao/IIOP_Connector.cpp25
-rw-r--r--TAO/tao/IIOP_Profile.cpp18
-rw-r--r--TAO/tao/IIOP_Profile.h4
-rw-r--r--TAO/tao/IIOP_Profile.i28
-rw-r--r--TAO/tao/ORB_Core.h23
-rw-r--r--TAO/tao/Pluggable.h6
-rw-r--r--TAO/tao/Profile.h4
-rw-r--r--TAO/tao/Resource_Factory.h5
-rw-r--r--TAO/tao/SHMIOP_Connector.cpp17
-rw-r--r--TAO/tao/SHMIOP_Profile.cpp18
-rw-r--r--TAO/tao/SHMIOP_Profile.h6
-rw-r--r--TAO/tao/SHMIOP_Profile.i28
-rw-r--r--TAO/tao/UIOP_Connector.cpp13
-rw-r--r--TAO/tao/UIOP_Profile.cpp7
-rw-r--r--TAO/tao/UIOP_Profile.h6
18 files changed, 172 insertions, 58 deletions
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp
index 52166739b3f..c00dd7c0ba7 100644
--- a/TAO/tao/Acceptor_Registry.cpp
+++ b/TAO/tao/Acceptor_Registry.cpp
@@ -260,14 +260,13 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core,
// specified.
int major = -1;
int minor = -1;
- const char *temp_iop = address.c_str ();
- if (isdigit (temp_iop[0])
- && temp_iop[1] == '.'
- && isdigit (temp_iop[2])
- && temp_iop[3] == '@')
+ if (isdigit (address[0])
+ && address[1] == '.'
+ && isdigit (address[2])
+ && address[3] == '@')
{
- major = temp_iop[0] - '0';
- minor = temp_iop[2] - '0';
+ major = address[0] - '0';
+ minor = address[2] - '0';
address = address.substring (4);
}
diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h
index a862ad9d1cc..39d1afdd682 100644
--- a/TAO/tao/Acceptor_Registry.h
+++ b/TAO/tao/Acceptor_Registry.h
@@ -99,6 +99,11 @@ private:
// Create a default acceptor using the specified protocol factory.
private:
+ // The acceptor registry should not be copied.
+ ACE_UNIMPLEMENTED_FUNC (TAO_Acceptor_Registry (const TAO_Acceptor_Registry&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Acceptor_Registry&))
+
+private:
TAO_Acceptor **acceptors_;
// List of acceptors that are currently open.
diff --git a/TAO/tao/Connector_Registry.h b/TAO/tao/Connector_Registry.h
index f2702e87e3f..dce43c7da60 100644
--- a/TAO/tao/Connector_Registry.h
+++ b/TAO/tao/Connector_Registry.h
@@ -115,6 +115,10 @@ private:
// Put the preconnects in a form that makes it simple for protocol
// implementers to parse.
+ // Prohibited
+ ACE_UNIMPLEMENTED_FUNC (TAO_Connector_Registry (const TAO_Connector_Registry&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Connector_Registry&))
+
private:
TAO_Connector** connectors_;
// List of connectors that are currently open.
diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp
index 7c6ffb58b0d..ecca5e8555d 100644
--- a/TAO/tao/IIOP_Connector.cpp
+++ b/TAO/tao/IIOP_Connector.cpp
@@ -468,6 +468,23 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile,
const ACE_INET_Addr &remote_address =
iiop_profile->object_addr ();
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_INET)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) IIOP connection failed.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
TAO_IIOP_Client_Connection_Handler *svc_handler = 0;
int result = 0;
@@ -501,15 +518,13 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile,
// Give users a clue to the problem.
if (TAO_orbdebug)
{
- char buffer [MAXNAMELEN * 2];
- profile->addr_to_string (buffer,
- (MAXNAMELEN * 2) - 1);
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("(%P|%t) %s:%u, connection to ")
- ACE_TEXT ("%s failed (%p)\n"),
+ ACE_TEXT ("%s:%d failed (%p)\n"),
__FILE__,
__LINE__,
- buffer,
+ iiop_profile->host (),
+ iiop_profile->port (),
"errno"));
}
return -1;
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
index 8b14d986852..8f71c2dd386 100644
--- a/TAO/tao/IIOP_Profile.cpp
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -172,17 +172,6 @@ TAO_IIOP_Profile::decode (TAO_InputCDR& cdr)
return -1;
}
- if (this->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
- {
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - ")
- ACE_TEXT ("ACE_INET_Addr::set() failed\n")));
- }
- return -1;
- }
// ... and object key.
if ((cdr >> this->object_key_) == 0)
@@ -206,7 +195,12 @@ TAO_IIOP_Profile::decode (TAO_InputCDR& cdr)
}
if (cdr.good_bit ())
- return 1;
+ {
+ // Invalidate the object_addr_ until first access.
+ this->object_addr_.set_type (-1);
+
+ return 1;
+ }
return -1;
}
diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h
index 475d5e6d1a1..0f81fc317ab 100644
--- a/TAO/tao/IIOP_Profile.h
+++ b/TAO/tao/IIOP_Profile.h
@@ -153,10 +153,6 @@ private:
int set (const ACE_INET_Addr &addr);
// helper method to set the INET_Addr.
- ACE_UNIMPLEMENTED_FUNC (TAO_IIOP_Profile (const TAO_IIOP_Profile &))
- ACE_UNIMPLEMENTED_FUNC (TAO_IIOP_Profile & operator= (const TAO_IIOP_Profile &))
- // Profiles should not be copied.
-
private:
void create_profile_body (TAO_OutputCDR &cdr) const;
diff --git a/TAO/tao/IIOP_Profile.i b/TAO/tao/IIOP_Profile.i
index 7fb7ce710a8..94669b12db0 100644
--- a/TAO/tao/IIOP_Profile.i
+++ b/TAO/tao/IIOP_Profile.i
@@ -19,9 +19,35 @@ TAO_IIOP_Profile::_key (void) const
return key;
}
-ACE_INLINE const ACE_INET_Addr&
+ACE_INLINE const ACE_INET_Addr &
TAO_IIOP_Profile::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..
+
+ // We need to modify the object_addr_ in this method. Do so using a
+ // non-const copy of the <this> pointer.
+ TAO_IIOP_Profile *profile =
+ ACE_const_cast (TAO_IIOP_Profile *,
+ this);
+
+ if (this->object_addr_.get_type () != AF_INET
+ && profile->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.
+ profile->object_addr_.set_type (-1);
+ }
+
return this->object_addr_;
}
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index e182e184b4e..74f4e5660ba 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -84,6 +84,12 @@ public:
~TAO_ORB_Core_TSS_Resources (void);
// destructor
+private:
+ // The ORB Core TSS resources should not be copied
+ ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Core_TSS_Resources (const TAO_ORB_Core_TSS_Resources&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_ORB_Core_TSS_Resources&))
+
+public:
// = The rest of the resources are not currently in use, just a plan
// for the future...
@@ -462,6 +468,11 @@ protected:
// previously-specified port for requests. Returns -1 on failure,
// else 0.
+private:
+ // The ORB Core should not be copied
+ ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Core(const TAO_ORB_Core&))
+ ACE_UNIMPLEMENTED_FUNC (void operator=(const TAO_ORB_Core&))
+
protected:
ACE_SYNCH_MUTEX lock_;
// Synchronize internal state...
@@ -681,6 +692,13 @@ public:
~TAO_TSS_Resources (void);
// destructor
+private:
+ // Do not copy TSS resources
+ ACE_UNIMPLEMENTED_FUNC (TAO_TSS_Resources(const TAO_TSS_Resources&))
+ ACE_UNIMPLEMENTED_FUNC (void operator=(const TAO_TSS_Resources&))
+
+public:
+
TAO_POA_Current_Impl *poa_current_impl_;
// Points to structure containing state for the current upcall
// context in this thread. Note that it does not come from the
@@ -757,6 +775,11 @@ protected:
// Constructor
private:
+ // Prevent copying
+ ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Table (const TAO_ORB_Table&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_ORB_Table&))
+
+private:
Table table_;
// The implementation.
diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h
index dcdb9001662..748b4bf9927 100644
--- a/TAO/tao/Pluggable.h
+++ b/TAO/tao/Pluggable.h
@@ -227,6 +227,12 @@ protected:
size_t bytes_delivered,
int queued_message);
+private:
+ // Prohibited
+ ACE_UNIMPLEMENTED_FUNC (TAO_Transport (const TAO_Transport&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Transport&))
+
+protected:
CORBA::ULong tag_;
// IOP protocol tag.
diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h
index a64c1a8a78b..032304fe66d 100644
--- a/TAO/tao/Profile.h
+++ b/TAO/tao/Profile.h
@@ -122,6 +122,10 @@ private:
TAO_MProfile *forward_to_i (void);
// this object keeps ownership of this object
+ // Profiles should not be copied!
+ ACE_UNIMPLEMENTED_FUNC (TAO_Profile (const TAO_Profile&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Profile&))
+
protected:
TAO_Tagged_Components tagged_components_;
// The tagged components
diff --git a/TAO/tao/Resource_Factory.h b/TAO/tao/Resource_Factory.h
index b7e0c9577ed..30691f3aa4c 100644
--- a/TAO/tao/Resource_Factory.h
+++ b/TAO/tao/Resource_Factory.h
@@ -73,6 +73,11 @@ public:
// set the factory pointer's value.
private:
+ // Prohibited
+ ACE_UNIMPLEMENTED_FUNC (TAO_Protocol_Item (const TAO_Protocol_Item&))
+ ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_Protocol_Item&))
+
+private:
ACE_CString name_;
// protocol factory name.
diff --git a/TAO/tao/SHMIOP_Connector.cpp b/TAO/tao/SHMIOP_Connector.cpp
index 7f349c59325..058c4e2e660 100644
--- a/TAO/tao/SHMIOP_Connector.cpp
+++ b/TAO/tao/SHMIOP_Connector.cpp
@@ -453,6 +453,23 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile,
const ACE_INET_Addr &remote_address =
shmiop_profile->object_addr ();
+ // Verify that the remote ACE_INET_Addr was initialized properly.
+ // Failure can occur if hostname lookup failed when initializing the
+ // remote ACE_INET_Addr.
+ if (remote_address.get_type () != AF_INET)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) SHMIOP connection failed.\n")
+ ACE_TEXT ("TAO (%P|%t) This is most likely ")
+ ACE_TEXT ("due to a hostname lookup ")
+ ACE_TEXT ("failure.\n")));
+ }
+
+ return -1;
+ }
+
TAO_SHMIOP_Client_Connection_Handler* svc_handler = 0;
int result = 0;
diff --git a/TAO/tao/SHMIOP_Profile.cpp b/TAO/tao/SHMIOP_Profile.cpp
index ccb1f11a24a..891821f1785 100644
--- a/TAO/tao/SHMIOP_Profile.cpp
+++ b/TAO/tao/SHMIOP_Profile.cpp
@@ -167,17 +167,6 @@ TAO_SHMIOP_Profile::decode (TAO_InputCDR& cdr)
return -1;
}
- if (this->object_addr_.set (this->port_,
- this->host_.in ()) == -1)
- {
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) SHMIOP_Profile::decode - ")
- ACE_TEXT ("ACE_INET_Addr::set() failed\n")));
- }
- return -1;
- }
// ... and object key.
if ((cdr >> this->object_key_) == 0)
@@ -202,7 +191,12 @@ TAO_SHMIOP_Profile::decode (TAO_InputCDR& cdr)
}
if (cdr.good_bit ())
- return 1;
+ {
+ // Invalidate the object_addr_ until first access.
+ this->object_addr_.set_type (-1);
+
+ return 1;
+ }
return -1;
}
diff --git a/TAO/tao/SHMIOP_Profile.h b/TAO/tao/SHMIOP_Profile.h
index c54bce9f640..84c58f5c567 100644
--- a/TAO/tao/SHMIOP_Profile.h
+++ b/TAO/tao/SHMIOP_Profile.h
@@ -120,7 +120,7 @@ public:
// Return a string representation for the address.
const ACE_INET_Addr &object_addr (void) const;
- // return a reference to the object_addr.
+ // Return a reference to the object_addr.
const char *host (void) const;
// Return a pointer to the host string. This object maintains
@@ -153,10 +153,6 @@ private:
int set (const ACE_INET_Addr &addr);
// helper method to set the INET_Addr.
- ACE_UNIMPLEMENTED_FUNC (TAO_SHMIOP_Profile (const TAO_SHMIOP_Profile &))
- ACE_UNIMPLEMENTED_FUNC (TAO_SHMIOP_Profile & operator= (const TAO_SHMIOP_Profile &))
- // Profiles should not be copied.
-
private:
void create_profile_body (TAO_OutputCDR &cdr) const;
diff --git a/TAO/tao/SHMIOP_Profile.i b/TAO/tao/SHMIOP_Profile.i
index 8bac34bc175..a5fb3610ddd 100644
--- a/TAO/tao/SHMIOP_Profile.i
+++ b/TAO/tao/SHMIOP_Profile.i
@@ -19,9 +19,35 @@ TAO_SHMIOP_Profile::_key (void) const
return key;
}
-ACE_INLINE const ACE_INET_Addr&
+ACE_INLINE const ACE_INET_Addr &
TAO_SHMIOP_Profile::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..
+
+ // We need to modify the object_addr_ in this method. Do so using a
+ // non-const copy of the <this> pointer.
+ TAO_SHMIOP_Profile *profile =
+ ACE_const_cast (TAO_SHMIOP_Profile *,
+ this);
+
+ if (this->object_addr_.get_type () != AF_INET
+ && profile->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.
+ profile->object_addr_.set_type (-1);
+ }
+
return this->object_addr_;
}
diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp
index c3c0c6c2ec1..8f32720db10 100644
--- a/TAO/tao/UIOP_Connector.cpp
+++ b/TAO/tao/UIOP_Connector.cpp
@@ -472,6 +472,13 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile,
const ACE_UNIX_Addr &remote_address =
uiop_profile->object_addr ();
+ // @@ Note, POSIX.1g renames AF_UNIX to AF_LOCAL.
+
+ // Verify that the remote ACE_UNIX_Addr was initialized properly.
+ // Failure should never occur in the case of an ACE_UNIX_Addr!
+ if (remote_address.get_type () != AF_UNIX)
+ return -1;
+
TAO_UIOP_Client_Connection_Handler *svc_handler = 0;
int result = 0;
@@ -505,17 +512,15 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile,
// Give users a clue to the problem.
if (TAO_orbdebug)
{
- char buffer [MAXNAMELEN * 2];
- profile->addr_to_string (buffer,
- (MAXNAMELEN * 2) - 1);
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("(%P|%t) %s:%u, connection to ")
ACE_TEXT ("%s failed (%p)\n"),
__FILE__,
__LINE__,
- buffer,
+ uiop_profile->rendezvous_point (),
"errno"));
}
+
return -1;
}
diff --git a/TAO/tao/UIOP_Profile.cpp b/TAO/tao/UIOP_Profile.cpp
index 9db7961bbc3..67b39e1c226 100644
--- a/TAO/tao/UIOP_Profile.cpp
+++ b/TAO/tao/UIOP_Profile.cpp
@@ -306,13 +306,18 @@ TAO_UIOP_Profile::decode (TAO_InputCDR& cdr)
if (this->object_addr_.set (rendezvous) == -1)
{
+ // In the case of an ACE_UNIX_Addr, this should call should
+ // never fail!
+ //
+ // If the call fails, allow the profile to be created, and rely
+ // on TAO's connection handling to throw the appropriate
+ // exception.
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) UIOP_Profile::decode - ")
ACE_TEXT ("ACE_UNIX_Addr::set() failed\n")));
}
- return -1;
}
// Clean up
diff --git a/TAO/tao/UIOP_Profile.h b/TAO/tao/UIOP_Profile.h
index c054371f257..c7c4ad89964 100644
--- a/TAO/tao/UIOP_Profile.h
+++ b/TAO/tao/UIOP_Profile.h
@@ -139,12 +139,6 @@ public:
private:
- ACE_UNIMPLEMENTED_FUNC (TAO_UIOP_Profile (const TAO_UIOP_Profile &))
- ACE_UNIMPLEMENTED_FUNC (TAO_UIOP_Profile & operator= (const TAO_UIOP_Profile &))
- // Profiles should not be copied.
-
-private:
-
void create_profile_body (TAO_OutputCDR &cdr) const;
// Create an encapsulation of the struct ProfileBody in <cdr>