diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-08 05:47:11 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-08 05:47:11 +0000 |
commit | 39c71ecef71154ac80b4ba2fcb400f2f1fbc6daa (patch) | |
tree | 3654d9e5b125fd36efa1fb45f70851f528c0923f | |
parent | 0a5a8665433b3354657b8c356d45d46176b4d290 (diff) | |
download | ATCD-39c71ecef71154ac80b4ba2fcb400f2f1fbc6daa.tar.gz |
*** empty log message ***
-rw-r--r-- | ChangeLog-98a | 13 | ||||
-rw-r--r-- | TAO/ChangeLog-98c | 25 | ||||
-rw-r--r-- | TAO/tao/IIOP_Object.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 32 | ||||
-rw-r--r-- | ace/ACE.cpp | 10 | ||||
-rw-r--r-- | ace/ACE.h | 3 | ||||
-rw-r--r-- | ace/SOCK_Acceptor.cpp | 22 |
7 files changed, 79 insertions, 30 deletions
diff --git a/ChangeLog-98a b/ChangeLog-98a index 15d5e43eb42..15ce9edaacb 100644 --- a/ChangeLog-98a +++ b/ChangeLog-98a @@ -1,3 +1,16 @@ +Wed Apr 08 00:37:33 1998 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/ACE.cpp (bind_port): This call was not flexible enough as it + always assumed that the user wanted INADDR_ANY. Added an extra + parameter to this function where the user can pass in the addr + that she is interested in. This extra parameter defaults to + INADDR_ANY, so no existing should break. + + * ace/SOCK_Acceptor.cpp (open): Not enough information was being + passed to the new ACE::bind_port() call. Changed open() so that + the sin_addr part of the address is passed along to + ACE::bind_port(). + Tue Apr 07 15:25:08 1998 David L. Levine <levine@cs.wustl.edu> * ace/config-irix*.h: fixed determination of ACE_SIZEOF_LONG_DOUBLE, diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 6c5788bfe42..4a2ea3c58a9 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,10 +1,27 @@ +Wed Apr 08 00:31:08 1998 Irfan Pyarali <irfan@cs.wustl.edu> + + * tao/ORB_Core.cpp (init): If the host is not supplied by the + user, we will go ahead and call ACE_OS::hostname immediately. + This will help later down the road, since ACE_OS::hostname will + not have to be called each time an IIOP_Profile is created. + + * tao/IIOP_Object.cpp (set): Changed the calls to get_host_addr() + to get_host_name(). The name is more readable than the IP + address. + + * tao/ORB_Core.cpp (init): If the user explicitly specifies + -ORBport 0, we choose a port and start listening. This will + make sure that all IORs produced will be correct. If -ORBport 0 + is not specified, lazy listening is done as usual (on + orb->run()). + Tue Apr 7 18:25:09 1998 Michael Kircher <mk1@cs.wustl.edu> - * tests/Quoter/quoter.idl: Extended the interface by - a Factory Finder. + * tests/Quoter/quoter.idl: Extended the interface by a Factory + Finder. - * tests/Quoter/QuoterFactoryFinder.{cpp,h}: Server and Implementation - of the Factory Finder. + * tests/Quoter/QuoterFactoryFinder.{cpp,h}: Server and + Implementation of the Factory Finder. Tue Apr 7 16:22:09 1998 Carlos O'Ryan <coryan@cs.wustl.edu> diff --git a/TAO/tao/IIOP_Object.cpp b/TAO/tao/IIOP_Object.cpp index d3e9e12c6ce..6066b2cf140 100644 --- a/TAO/tao/IIOP_Object.cpp +++ b/TAO/tao/IIOP_Object.cpp @@ -108,7 +108,7 @@ IIOP::Profile::set (const ACE_INET_Addr &addr, } else { - const char *tempaddr = addr.get_host_addr (); + const char *tempaddr = addr.get_host_name (); if (tempaddr == 0) return -1; else @@ -139,7 +139,7 @@ IIOP::Profile::set (const ACE_INET_Addr &addr, } else { - const char *tempaddr = addr.get_host_addr (); + const char *tempaddr = addr.get_host_name (); if (tempaddr == 0) return -1; else diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 53a1d7976ab..a966171125c 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -318,22 +318,22 @@ TAO_ORB_Core::init (int& argc, char** argv) ACE_INET_Addr rendezvous; - // The conditional catches errors in hbuf. - if (ACE_OS::strlen (host) > 0) + // No host specified; find it + if (ACE_OS::strlen (host) == 0) { - if (rendezvous.set (port, (char*)host) == -1) + char buffer[MAXHOSTNAMELEN + 1]; + if (rendezvous.get_host_name (buffer, sizeof (buffer)) != 0) ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) TAO_ORB_Core::init failed to resolve host %s, %p.\n", - (char*)host, "reason"), -1); + "(%P|%t) TAO_ORB_Core::init failed to resolve local host %p.\n"), -1); + + host = CORBA::string_dup (buffer); } - else - { - if (rendezvous.set (port) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) TAO_ORB_Core::init failed to set rendesvous to port %d, %p.\n", - (char*)host, "reason"), -1); - } - + + if (rendezvous.set (port, (char *) host) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) TAO_ORB_Core::init failed to resolve host %s, %p.\n", + (char*)host, "reason"), -1); + #if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS) // There's really no way to deal with this in a portable manner, so // we just have to suck it up and get preprocessor conditional and @@ -431,7 +431,11 @@ TAO_ORB_Core::init (int& argc, char** argv) if (preconnections) this->preconnect (preconnections); - return 0; + // Port not specified: find one for the user + if (port == 0) + return this_orb->open (); + else + return 0; } int diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 773abd02b07..109d57de86f 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1526,12 +1526,12 @@ ACE::handle_timed_accept (ACE_HANDLE listener, // Bind socket to an unused port. int -ACE::bind_port (ACE_HANDLE handle) +ACE::bind_port (ACE_HANDLE handle, + ACE_UINT32 ip_addr) { ACE_TRACE ("ACE::bind_port"); + sockaddr_in sin; - // This should be a constant, so I hope they never change the number - // of bits in a port number! static u_short upper_limit = ACE_MAX_DEFAULT_PORT; int lower_limit = IPPORT_RESERVED; int round_trip = upper_limit; @@ -1541,7 +1541,7 @@ ACE::bind_port (ACE_HANDLE handle) #if defined (ACE_HAS_SIN_LEN) sin.sin_len = sizeof sin; #endif /* ACE_HAS_SIN_LEN */ - sin.sin_addr.s_addr = INADDR_ANY; + sin.sin_addr.s_addr = ip_addr; for (;;) { @@ -1551,7 +1551,7 @@ ACE::bind_port (ACE_HANDLE handle) { #if defined (ACE_WIN32) upper_limit--; -#endif +#endif /* ACE_WIN32 */ return 0; } else if (errno != EADDRINUSE) diff --git a/ace/ACE.h b/ace/ACE.h index f225071c1b8..fb6bc8522f4 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -307,7 +307,8 @@ public: // = Socket connection establishment calls. - static int bind_port (ACE_HANDLE handle); + static int bind_port (ACE_HANDLE handle, + ACE_UINT32 ip_addr = INADDR_ANY); // Bind a new unused port to <handle>. static int get_bcast_addr (ACE_UINT32 &bcast_addr, diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp index 612d4a6b993..e32d1bd121d 100644 --- a/ace/SOCK_Acceptor.cpp +++ b/ace/SOCK_Acceptor.cpp @@ -70,14 +70,28 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, { ACE_TRACE ("ACE_SOCK_Acceptor::open"); int error = 0; - + if (ACE_SOCK::open (SOCK_STREAM, protocol_family, protocol, reuse_addr) == -1) error = 1; - else if (local_sap == ACE_Addr::sap_any - && protocol_family == PF_INET) + + else if (protocol_family == PF_INET) { - if (ACE::bind_port (this->get_handle ()) == -1) + sockaddr_in local_inet_addr; + ACE_OS::memset ((void *) &local_inet_addr, + 0, + sizeof local_inet_addr); + + if (local_sap == ACE_Addr::sap_any) + { + local_inet_addr.sin_port = 0; + local_inet_addr.sin_addr.s_addr = htonl (INADDR_ANY); + } + else + local_inet_addr = *(sockaddr_in *) local_sap.get_addr (); + + if (ACE::bind_port (this->get_handle (), + local_inet_addr.sin_addr.s_addr) == -1) error = 1; } else if (ACE_OS::bind (this->get_handle (), (sockaddr *) local_sap.get_addr (), |