From 5164e0082fb013ee89642149b6d5179e2bf7e7c5 Mon Sep 17 00:00:00 2001 From: fredk Date: Mon, 24 May 1999 23:52:42 +0000 Subject: Added support for caching host and port. --- TAO/tao/IIOP_Acceptor.cpp | 21 ++++++++++++++++++++- TAO/tao/IIOP_Acceptor.h | 9 +++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index 7b51933f2b2..0e04e32d910 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -105,9 +105,12 @@ int TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, ACE_CString &address) { - + // address is in the for host:port ACE_INET_Addr addr (address.c_str ()); + // open endpoint. If port ==0 then + // calling the open method will cause the system to assign + // an ephemeral port number number. if (this->base_acceptor_.open ( // orb_core->orb_params ()->addr (), addr, @@ -118,6 +121,22 @@ TAO_IIOP_Acceptor::open (TAO_ORB_Core *orb_core, orb_core->server_factory ()->scheduling_strategy ()) == -1) return -1; // Failure + char tmp_host[MAXHOSTNAMELEN+1]; + this->port_ = addr.get_port_number (); + if (orb_core->orb_params ()->use_dotted_decimal_addresses ()) + { + const char *tmp; + if ((tmp = addr.get_host_addr ()) == 0) + return -1; + this->host_ = tmp; + } + else + { + if (addr.get_host_name (tmp_host, MAXHOSTNAMELEN + 1) != 0) + return -1; + this->host_ = tmp_host; + } + return 0; // Success } diff --git a/TAO/tao/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index 43ea952e915..be13bd794bd 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -69,6 +69,15 @@ public: private: TAO_IIOP_BASE_ACCEPTOR base_acceptor_; // the concrete acceptor, as a pointer to it's base class. + + ACE_CString host_; + // the host name for this endpoint + // @@ there may in fact be multiple hostnames for this endpoint. + // @@ for example it the IP address is INADDR_ANY (0.0.0.0) then + // @@ there will be possibly a different hostname for each interface. + + CORBA::UShort port_; + // port number for this host. This shouyld be non-zero. }; #endif /* TAO_IIOP_ACCEPTOR_H */ -- cgit v1.2.1