diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-03 08:51:04 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-03 08:51:04 +0000 |
commit | aa5be78b82f88b31ec631665d56b4fce581cfc1a (patch) | |
tree | 9e844fd250857ec71cbca0ff09e9d5cdc1fcf0ed | |
parent | e3097005652a2f9fbb1c54f5604c96deb003cc33 (diff) | |
download | ATCD-aa5be78b82f88b31ec631665d56b4fce581cfc1a.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tao/SHMIOP_Acceptor.cpp | 75 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Acceptor.h | 19 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Acceptor.i | 6 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Connector.cpp | 49 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Connector.h | 5 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Profile.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Profile.h | 4 | ||||
-rw-r--r-- | ace/MEM_Acceptor.cpp | 20 | ||||
-rw-r--r-- | ace/MEM_Acceptor.h | 13 | ||||
-rw-r--r-- | ace/MEM_Acceptor.i | 21 | ||||
-rw-r--r-- | ace/MEM_Connector.cpp | 44 | ||||
-rw-r--r-- | ace/MEM_Connector.h | 19 | ||||
-rw-r--r-- | ace/MEM_Connector.i | 6 | ||||
-rw-r--r-- | ace/OS.h | 6 | ||||
-rw-r--r-- | ace/ace_dll.dsp | 35 | ||||
-rw-r--r-- | ace/ace_lib.dsp | 35 |
16 files changed, 208 insertions, 159 deletions
diff --git a/TAO/tao/SHMIOP_Acceptor.cpp b/TAO/tao/SHMIOP_Acceptor.cpp index 3403a2a4876..43197bb552a 100644 --- a/TAO/tao/SHMIOP_Acceptor.cpp +++ b/TAO/tao/SHMIOP_Acceptor.cpp @@ -51,7 +51,9 @@ TAO_SHMIOP_Acceptor::TAO_SHMIOP_Acceptor (void) base_acceptor_ (), creation_strategy_ (0), concurrency_strategy_ (0), - accept_strategy_ (0) + accept_strategy_ (0), + mmap_file_prefix_ (0), + mmap_size_ (1024 * 1024) { } @@ -83,7 +85,7 @@ TAO_SHMIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, TAO_SHMIOP_Profile (this->host_.c_str (), this->address_.get_port_number (), object_key, - this->address_, + this->address_.get_remote_addr (), this->version_, this->orb_core_), -1); @@ -120,7 +122,7 @@ TAO_SHMIOP_Acceptor::is_collocated (const TAO_Profile *pfile) pfile); // compare the port and sin_addr (numeric host address) - return profile->object_addr () == this->address_; + return this->address_.same_host (profile->object_addr ()); } int @@ -133,12 +135,9 @@ int TAO_SHMIOP_Acceptor::open (TAO_ORB_Core *orb_core, int major, int minor, - const char *address, + const char *port, const char *options) { - if (address == 0) - return -1; - if (major >=0 && minor >= 0) this->version_.set_version (ACE_static_cast (CORBA::Octet, major), @@ -148,40 +147,13 @@ TAO_SHMIOP_Acceptor::open (TAO_ORB_Core *orb_core, if (this->parse_options (options) == -1) return -1; - ACE_INET_Addr addr; + this->base_acceptor_.acceptor().malloc_options ().minimum_bytes_ + = this->mmap_size_; - if (ACE_OS::strchr (address, ':') == address) - { - // The address is a port number or port name, and obtain the - // fully qualified domain name. No hostname was specified. - - char buffer[MAXHOSTNAMELEN + 1]; - if (addr.get_host_name (buffer, - sizeof (buffer)) != 0) - return -1; - - // First convert the port into a usable form. - if (addr.set (address + sizeof (':')) != 0) - return -1; - - // Now reset the port and set the host. - if (addr.set (addr.get_port_number (), - buffer, - 1) != 0) - return -1; - } - else if (ACE_OS::strchr (address, ':') == 0) - { - // The address is a hostname. No port was specified, so assume - // port zero (port will be chosen for us). - if (addr.set ((unsigned short) 0, address) != 0) - return -1; - } - else if (addr.set (address) != 0) - // Host and port were specified. - return -1; + if (port) + this->address_.set (port); - return this->open_i (orb_core, addr); + return this->open_i (orb_core); } int @@ -196,26 +168,13 @@ TAO_SHMIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, // pick the "default interface" and only listen on that IP // address. - ACE_INET_Addr addr; - char buffer[MAXHOSTNAMELEN + 1]; - if (addr.get_host_name (buffer, - sizeof (buffer)) != 0) - return -1; - - if (addr.set (u_short(0), - buffer, - 1) != 0) - return -1; - - this->host_ = buffer; + this->host_ = this->address_.get_host_name (); - return this->open_i (orb_core, - addr); + return this->open_i (orb_core); } int -TAO_SHMIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, - const ACE_INET_Addr& addr) +TAO_SHMIOP_Acceptor::open_i (TAO_ORB_Core* orb_core) { this->orb_core_ = orb_core; @@ -233,7 +192,7 @@ TAO_SHMIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, // We only accept connection on localhost. // ACE_INET_Addr local_addr (addr.get_port_number (), ASYS_TEXT ("localhost")); - if (this->base_acceptor_.open (addr, + if (this->base_acceptor_.open (this->address_, this->orb_core_->reactor (this), this->creation_strategy_, this->accept_strategy_, @@ -258,8 +217,8 @@ TAO_SHMIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, // This will be the actualy host name of the original endpoint. char tmp_host[MAXHOSTNAMELEN+1]; - if (addr.get_host_name (tmp_host, - sizeof tmp_host) != 0) + if (this->address_.get_host_name (tmp_host, + sizeof tmp_host) != 0) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/tao/SHMIOP_Acceptor.h b/TAO/tao/SHMIOP_Acceptor.h index 6c214fa33cb..985b907e804 100644 --- a/TAO/tao/SHMIOP_Acceptor.h +++ b/TAO/tao/SHMIOP_Acceptor.h @@ -51,10 +51,6 @@ public: ~TAO_SHMIOP_Acceptor (void); // Destructor. - const ACE_INET_Addr& address (void) const; - // @@ Helper method for the implementation repository, should go - // away - typedef ACE_Strategy_Acceptor<TAO_SHMIOP_Server_Connection_Handler, ACE_MEM_ACCEPTOR> TAO_SHMIOP_BASE_ACCEPTOR; typedef TAO_Creation_Strategy<TAO_SHMIOP_Server_Connection_Handler> TAO_SHMIOP_CREATION_STRATEGY; typedef TAO_Concurrency_Strategy<TAO_SHMIOP_Server_Connection_Handler> TAO_SHMIOP_CONCURRENCY_STRATEGY; @@ -65,7 +61,7 @@ public: virtual int open (TAO_ORB_Core *orb_core, int version_major, int version_minor, - const char *address, + const char *port, const char *options = 0); virtual int open_default (TAO_ORB_Core *orb_core, const char *options = 0); @@ -76,15 +72,13 @@ public: virtual CORBA::ULong endpoint_count (void); private: - int open_i (TAO_ORB_Core* orb_core, - const ACE_INET_Addr& addr); + int open_i (TAO_ORB_Core* orb_core); // Implement the common part of the open*() methods. virtual int parse_options (const char *options); // Parse protocol specific options. protected: - ACE_INET_Addr address_; ACE_CString host_; // Cache the information about the endpoint serviced by this // acceptor. @@ -93,6 +87,9 @@ protected: // (0.0.0.0) then there will be possibly a different hostname for // each interface. + ACE_MEM_Addr address_; + // A local endpoint. + TAO_GIOP_Version version_; // The GIOP version for this endpoint @@ -108,6 +105,12 @@ private: TAO_SHMIOP_ACCEPT_STRATEGY *accept_strategy_; // Acceptor strategies. + ASYS_TCHAR *mmap_file_prefix_; + // Determine the prefix (include path name) of the mmap file. + + off_t mmap_size_; + // Determine the minimum size of mmap file. This dictate the + // maximum size of a CORBA method invocation. }; #if defined(__ACE_INLINE__) diff --git a/TAO/tao/SHMIOP_Acceptor.i b/TAO/tao/SHMIOP_Acceptor.i index 6c9ad6709f6..c130d6682b1 100644 --- a/TAO/tao/SHMIOP_Acceptor.i +++ b/TAO/tao/SHMIOP_Acceptor.i @@ -1,8 +1,2 @@ // -*- C++ -*- // $Id$ - -ACE_INLINE const ACE_INET_Addr& -TAO_SHMIOP_Acceptor::address (void) const -{ - return this->address_; -} diff --git a/TAO/tao/SHMIOP_Connector.cpp b/TAO/tao/SHMIOP_Connector.cpp index 9eed862e33b..7f393521804 100644 --- a/TAO/tao/SHMIOP_Connector.cpp +++ b/TAO/tao/SHMIOP_Connector.cpp @@ -113,7 +113,7 @@ TAO_SHMIOP_Connector::make_caching_strategy (void) #if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) #define TAO_SVC_TUPLE ACE_Svc_Tuple<TAO_SHMIOP_Client_Connection_Handler> #define CACHED_CONNECT_STRATEGY ACE_Cached_Connect_Strategy<TAO_SHMIOP_Client_Connection_Handler, ACE_MEM_CONNECTOR, TAO_Cached_Connector_Lock> -#define TAO_ADDR ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> +#define TAO_ADDR ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> #define TAO_HANDLER TAO_SHMIOP_Client_Connection_Handler #define TAO_HASH_KEY ACE_Hash<TAO_ADDR> #define TAO_COMPARE_KEYS ACE_Equal_To<TAO_ADDR> @@ -127,9 +127,9 @@ template class ACE_Auto_Basic_Array_Ptr<TAO_SHMIOP_Client_Connection_Handler*>; template class auto_ptr<TAO_SHMIOP_Connect_Creation_Strategy>; template class ACE_Auto_Basic_Ptr<TAO_SHMIOP_Connect_Creation_Strategy>; -template class ACE_Node<ACE_INET_Addr>; -template class ACE_Unbounded_Stack<ACE_INET_Addr>; -template class ACE_Unbounded_Stack_Iterator<ACE_INET_Addr>; +template class ACE_Node<ACE_MEM_Addr>; +template class ACE_Unbounded_Stack<ACE_MEM_Addr>; +template class ACE_Unbounded_Stack_Iterator<ACE_MEM_Addr>; #if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) template class CACHED_CONNECT_STRATEGY; @@ -137,15 +137,15 @@ template class TAO_ADDR; #endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ template class ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH>; -template class ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr>; +template class ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr>; template class ACE_NOOP_Creation_Strategy<TAO_HANDLER>; template class ACE_Concurrency_Strategy<TAO_HANDLER>; template class ACE_Connect_Strategy<TAO_HANDLER, ACE_MEM_CONNECTOR>; template class ACE_Connector<TAO_HANDLER, ACE_MEM_CONNECTOR>; template class ACE_Creation_Strategy<TAO_HANDLER>; template class ACE_Hash_Map_Entry<TAO_ADDR, TAO_HANDLER *>; -template class ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> >; -template class ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> >; +template class ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> >; +template class ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> >; template class ACE_Map_Entry<ACE_HANDLE, TAO_SVC_TUPLE *>; template class ACE_Map_Manager<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; template class ACE_Map_Iterator_Base<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX>; @@ -221,9 +221,9 @@ template class ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_ADDR, TAO_C #pragma instantiate auto_ptr<TAO_SHMIOP_Connect_Creation_Strategy> #pragma instantiate ACE_Auto_Basic_Ptr<TAO_SHMIOP_Connect_Creation_Strategy> -#pragma instantiate ACE_Node<ACE_INET_Addr> -#pragma instantiate ACE_Unbounded_Stack<ACE_INET_Addr> -#pragma instantiate ACE_Unbounded_Stack_Iterator<ACE_INET_Addr> +#pragma instantiate ACE_Node<ACE_MEM_Addr> +#pragma instantiate ACE_Unbounded_Stack<ACE_MEM_Addr> +#pragma instantiate ACE_Unbounded_Stack_Iterator<ACE_MEM_Addr> #if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) #pragma instantiate CACHED_CONNECT_STRATEGY @@ -231,15 +231,15 @@ template class ACE_Refcounted_Recyclable_Handler_Caching_Utility<TAO_ADDR, TAO_C #endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ #pragma instantiate ACE_Svc_Handler<ACE_MEM_STREAM, ACE_NULL_SYNCH> -#pragma instantiate ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> +#pragma instantiate ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> #pragma instantiate ACE_NOOP_Creation_Strategy<TAO_HANDLER> #pragma instantiate ACE_Concurrency_Strategy<TAO_HANDLER> #pragma instantiate ACE_Connect_Strategy<TAO_HANDLER, ACE_MEM_CONNECTOR> #pragma instantiate ACE_Connector<TAO_HANDLER, ACE_MEM_CONNECTOR> #pragma instantiate ACE_Creation_Strategy<TAO_HANDLER> #pragma instantiate ACE_Hash_Map_Entry<TAO_ADDR, TAO_HANDLER *> -#pragma instantiate ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> > -#pragma instantiate ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> > +#pragma instantiate ACE_Hash<ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> > +#pragma instantiate ACE_Equal_To<ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> > #pragma instantiate ACE_Map_Entry<ACE_HANDLE, TAO_SVC_TUPLE *> #pragma instantiate ACE_Map_Manager<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> #pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, TAO_SVC_TUPLE *, ACE_SYNCH_RW_MUTEX> @@ -460,6 +460,21 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile, const ACE_INET_Addr &oa = shmiop_profile->object_addr (); + if (! this->address_.same_host (oa)) + { + if (TAO_orbdebug) + ACE_DEBUG ((LM_ERROR, + ASYS_TEXT ("(%P|%t) %s:%u, is not local ") + ASYS_TEXT ("SHMIOP endpoint)\n"), + __FILE__, + __LINE__, + oa.get_host_name (), + oa.get_port_number ())); + return -1; + } + + this->address_.set (oa.get_port_number ()); + ACE_Synch_Options synch_options; if (max_wait_time != 0) synch_options.set (ACE_Synch_Options::USE_TIMEOUT, @@ -473,7 +488,7 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile, // affected. if (this->base_connector_.connect (shmiop_profile->hint (), result, - oa, + this->address_, synch_options) == -1) { // Give users a clue to the problem. if (TAO_orbdebug) @@ -496,9 +511,11 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile, return 0; } + int TAO_SHMIOP_Connector::preconnect (const char *preconnects) { +#if 0 // Check for the proper protocol prefix. if (this->check_prefix (preconnects) != 0) return 0; // Failure: zero successful preconnections @@ -645,6 +662,10 @@ TAO_SHMIOP_Connector::preconnect (const char *preconnects) num_connections - successes)); } return successes; +#else + ACE_UNUSED_ARG (preconnects); + ACE_NOTSUP_RETURN (-1); +#endif } TAO_Profile * diff --git a/TAO/tao/SHMIOP_Connector.h b/TAO/tao/SHMIOP_Connector.h index 078ead3a007..39d887a64e4 100644 --- a/TAO/tao/SHMIOP_Connector.h +++ b/TAO/tao/SHMIOP_Connector.h @@ -128,7 +128,7 @@ public: typedef ACE_Pair<TAO_SHMIOP_Client_Connection_Handler *, TAO_ATTRIBUTES> TAO_CACHED_HANDLER; - typedef ACE_Refcounted_Hash_Recyclable<ACE_INET_Addr> + typedef ACE_Refcounted_Hash_Recyclable<ACE_MEM_Addr> TAO_IADDR; typedef ACE_Hash<TAO_IADDR> TAO_HASH_KEY; typedef ACE_Equal_To<TAO_IADDR> TAO_COMPARE_KEYS; @@ -188,6 +188,9 @@ protected: // ORB Core. private: + ACE_MEM_Addr address_; + // local address + TAO_NULL_ACTIVATION_STRATEGY null_activation_strategy_; TAO_NULL_CREATION_STRATEGY null_creation_strategy_; diff --git a/TAO/tao/SHMIOP_Profile.cpp b/TAO/tao/SHMIOP_Profile.cpp index 8181c36eee3..d73f1cab936 100644 --- a/TAO/tao/SHMIOP_Profile.cpp +++ b/TAO/tao/SHMIOP_Profile.cpp @@ -24,7 +24,7 @@ static const char prefix_[] = "shmiop"; const char TAO_SHMIOP_Profile::object_key_delimiter = '/'; -TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const ACE_INET_Addr &addr, +TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const ACE_MEM_Addr &addr, const TAO_ObjectKey &object_key, const TAO_GIOP_Version &version, TAO_ORB_Core *orb_core) @@ -33,11 +33,11 @@ TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const ACE_INET_Addr &addr, port_ (0), version_ (version), object_key_ (object_key), - object_addr_ (addr), + object_addr_ (addr.get_remote_addr ()), hint_ (0), orb_core_ (orb_core) { - this->set (addr); + this->set (addr.get_remote_addr ()); } TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const char* host, @@ -201,7 +201,7 @@ TAO_SHMIOP_Profile::decode (TAO_InputCDR& cdr) int TAO_SHMIOP_Profile::parse_string (const char *string, - CORBA::Environment &ACE_TRY_ENV) + CORBA::Environment &ACE_TRY_ENV) { if (!string || !*string) { @@ -318,7 +318,7 @@ TAO_SHMIOP_Profile::is_equivalent (const TAO_Profile *other_profile) CORBA::ULong TAO_SHMIOP_Profile::hash (CORBA::ULong max, - CORBA::Environment &) + CORBA::Environment &) { CORBA::ULong hashval; diff --git a/TAO/tao/SHMIOP_Profile.h b/TAO/tao/SHMIOP_Profile.h index b7084983cba..5a733474331 100644 --- a/TAO/tao/SHMIOP_Profile.h +++ b/TAO/tao/SHMIOP_Profile.h @@ -34,7 +34,7 @@ #include "tao/GIOP.h" #include "ace/Synch.h" -#include "ace/INET_Addr.h" +#include "ace/MEM_Addr.h" class TAO_SHMIOP_Client_Connection_Handler; @@ -55,7 +55,7 @@ public: static const char *prefix (void); // Return the char string prefix. - TAO_SHMIOP_Profile (const ACE_INET_Addr &addr, + TAO_SHMIOP_Profile (const ACE_MEM_Addr &addr, const TAO_ObjectKey &object_key, const TAO_GIOP_Version &version, TAO_ORB_Core *orb_core); diff --git a/ace/MEM_Acceptor.cpp b/ace/MEM_Acceptor.cpp index ee2d1ac7349..5b1d953537b 100644 --- a/ace/MEM_Acceptor.cpp +++ b/ace/MEM_Acceptor.cpp @@ -34,14 +34,14 @@ ACE_MEM_Acceptor::~ACE_MEM_Acceptor (void) // General purpose routine for performing server ACE_SOCK creation. -ACE_MEM_Acceptor::ACE_MEM_Acceptor (const u_short local_port, +ACE_MEM_Acceptor::ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap, int reuse_addr, int backlog, int protocol) : mmap_prefix_ (0) { ACE_TRACE ("ACE_MEM_Acceptor::ACE_MEM_Acceptor"); - if (this->open (local_port, + if (this->open (remote_sap, reuse_addr, backlog, protocol) == -1) @@ -49,16 +49,13 @@ ACE_MEM_Acceptor::ACE_MEM_Acceptor (const u_short local_port, "ACE_MEM_Acceptor::ACE_MEM_Acceptor")); } -ACE_MEM_Acceptor::open (const u_short local_port, +ACE_MEM_Acceptor::open (const ACE_MEM_Addr &remote_sap, int reuse_addr, int back_log, int protocol) { ACE_TRACE ("ACE_MEM_Acceptor::open"); - ACE_INET_Addr local_addr (local_port, - ASYS_TEXT ("localhost")); - - return this->ACE_SOCK_Acceptor::open (local_addr, + return this->ACE_SOCK_Acceptor::open (remote_sap.get_local_addr (), reuse_addr, PF_INET, back_log, @@ -69,7 +66,7 @@ ACE_MEM_Acceptor::open (const u_short local_port, int ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, - u_short *remote_port, + ACE_MEM_Addr *remote_sap, ACE_Time_Value *timeout, int restart, int reset_new_handle) @@ -95,8 +92,11 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, && errno == EINTR && timeout == 0); - if (remote_port != 0) - *remote_port = (* (sockaddr_in*) addr).sin_port; + if (remote_sap != 0) + { + ACE_INET_Addr temp ((sockaddr_in *) addr, *len_ptr); + remote_sap->set_port_number(temp.get_port_number ()); + } } if (this->shared_accept_finish (new_stream, diff --git a/ace/MEM_Acceptor.h b/ace/MEM_Acceptor.h index 3e008dc9481..0233d02fcad 100644 --- a/ace/MEM_Acceptor.h +++ b/ace/MEM_Acceptor.h @@ -23,6 +23,7 @@ #include "ace/SOCK_Acceptor.h" #include "ace/MEM_Stream.h" +#include "ace/MEM_Addr.h" // Forward decl. class ACE_Reactor; @@ -47,13 +48,13 @@ public: ~ACE_MEM_Acceptor (void); // destructor. - ACE_MEM_Acceptor (const u_short local_port, + ACE_MEM_Acceptor (const ACE_MEM_Addr &remote_sap, int reuse_addr = 0, int backlog = ACE_DEFAULT_BACKLOG, int protocol = 0); // Initiate a passive mode socket. - int open (const u_short local_port, + int open (const ACE_MEM_Addr &local_sap, int reuse_addr = 0, int backlog = ACE_DEFAULT_BACKLOG, int protocol = 0); @@ -64,7 +65,7 @@ public: // -1 on failure. int accept (ACE_MEM_Stream &new_ipc_sap, - u_short * = 0, + ACE_MEM_Addr *remote_addr = 0, ACE_Time_Value *timeout = 0, int restart = 1, int reset_new_handle = 0); @@ -86,11 +87,15 @@ public: // within the same host can located the mmap file. // Example: /tmp/mmapfile + int get_local_addr (ACE_MEM_Addr &) const; + // Return the local endpoint address in the referenced <ACE_Addr>. + // Returns 0 if successful, else -1. + ACE_MEM_SAP::MALLOC_OPTIONS& malloc_options (void); // Accessor to the mmap options. // = Meta-type info - typedef u_short PEER_ADDR; + typedef ACE_MEM_Addr PEER_ADDR; typedef ACE_MEM_Stream PEER_STREAM; void dump (void) const; diff --git a/ace/MEM_Acceptor.i b/ace/MEM_Acceptor.i index 96ea55ce4c7..bdc1c1af7ef 100644 --- a/ace/MEM_Acceptor.i +++ b/ace/MEM_Acceptor.i @@ -5,17 +5,6 @@ ASYS_INLINE int ACE_MEM_Acceptor::open (const ACE_Addr &local_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) -{ - return this->ACE_SOCK_Acceptor:: open - (local_sap, reuse_addr, protocol_family, backlog, protocol); -} - -ASYS_INLINE int -ACE_MEM_Acceptor::open (const ACE_Addr &local_sap, ACE_Protocol_Info *protocolinfo, ACE_SOCK_GROUP g, u_long flags, @@ -52,6 +41,16 @@ ACE_MEM_Acceptor::accept (ACE_SOCK_Stream &new_stream, (new_stream, qos_params, remote_addr, timeout, restart, reset_new_handle); } +ASYS_INLINE int +ACE_MEM_Acceptor::get_local_addr (ACE_MEM_Addr &sap) const +{ + ACE_INET_Addr temp; + + this->ACE_SOCK_Acceptor::get_local_addr (temp); + sap.set_port_number (temp.get_port_number ()); + return 0; +} + ASYS_INLINE const ASYS_TCHAR * ACE_MEM_Acceptor::mmap_prefix (void) const { diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index fa4ff630eb7..1dac7a97252 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -29,9 +29,9 @@ ACE_MEM_Connector::ACE_MEM_Connector (void) // Establish a connection. ACE_MEM_Connector::ACE_MEM_Connector (ACE_MEM_Stream &new_stream, - const u_short remote_port, + const ACE_MEM_Addr &remote_sap, ACE_Time_Value *timeout, - const u_short &local_port, + const ACE_Addr &local_sap, int reuse_addr, int flags, int perms, @@ -41,9 +41,9 @@ ACE_MEM_Connector::ACE_MEM_Connector (ACE_MEM_Stream &new_stream, // This is necessary due to the weird inheritance relationships of // ACE_MEM_Stream. this->connect (new_stream, - remote_port, + remote_sap, timeout, - local_port, + local_sap, reuse_addr, flags, perms, @@ -52,9 +52,9 @@ ACE_MEM_Connector::ACE_MEM_Connector (ACE_MEM_Stream &new_stream, int ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, - const u_short remote_port, + const ACE_MEM_Addr &remote_sap, ACE_Time_Value *timeout, - const u_short &local_port, + const ACE_Addr &local_sap, int reuse_addr, int flags, int perms, @@ -63,28 +63,12 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, ACE_TRACE ("ACE_MEM_Connector::connect"); ACE_SOCK_Stream temp_stream; - ACE_INET_Addr remote_sap = ACE_INET_Addr (remote_port, - ASYS_TEXT ("localhost")); - - if (local_port != 0) - { - ACE_INET_Addr local_sap = ACE_INET_Addr (local_port, - ASYS_TEXT ("localhost")); - - if (ACE_SOCK_Connector::connect (temp_stream, remote_sap, - timeout, local_sap, - reuse_addr, flags, perms, - PF_INET, protocol) == -1) - return -1; - } - else - { - if (ACE_SOCK_Connector::connect (temp_stream, remote_sap, - timeout, ACE_Addr::sap_any, - reuse_addr, flags, perms, - PF_INET, protocol) == -1) - return -1; - } + + if (ACE_SOCK_Connector::connect (temp_stream, remote_sap.get_local_addr (), + timeout, local_sap, + reuse_addr, flags, perms, + PF_INET, protocol) == -1) + return -1; ACE_HANDLE new_handle = temp_stream.get_handle (); new_stream.set_handle (new_handle); @@ -102,9 +86,7 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, if (ACE::recv (new_handle, buf, buf_len) == -1) return -1; - ACE_MEM_SAP::MALLOC_OPTIONS options; - - if (new_stream.create_shm_malloc (buf, &options) == -1) + if (new_stream.create_shm_malloc (buf, &this->malloc_options_) == -1) return -1; return 0; diff --git a/ace/MEM_Connector.h b/ace/MEM_Connector.h index da2b692e9c7..fc57002db26 100644 --- a/ace/MEM_Connector.h +++ b/ace/MEM_Connector.h @@ -23,8 +23,9 @@ #include "ace/SOCK_Connector.h" #include "ace/MEM_Stream.h" +#include "ace/MEM_Addr.h" -class ACE_Export ACE_MEM_Connector : protected ACE_SOCK_Connector +class ACE_Export ACE_MEM_Connector : public ACE_SOCK_Connector { // = TITLE // Defines the format and interface for the connector side of @@ -35,9 +36,9 @@ public: // Default constructor. ACE_MEM_Connector (ACE_MEM_Stream &new_stream, - const u_short remote_port, + const ACE_MEM_Addr &remote_sap, ACE_Time_Value *timeout = 0, - const u_short &local_sap = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, int reuse_addr = 0, int flags = 0, int perms = 0, @@ -57,9 +58,9 @@ public: // <local_addr> is reused, even if it hasn't been cleanedup yet. int connect (ACE_MEM_Stream &new_stream, - const u_short remote_port, + const ACE_MEM_Addr &remote_sap, ACE_Time_Value *timeout = 0, - const u_short &local_sap = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, int reuse_addr = 0, int flags = 0, int perms = 0, @@ -78,8 +79,11 @@ public: // the OS do the binding. If <reuse_addr> == 1 then the // <local_addr> is reused, even if it hasn't been cleanedup yet. + ACE_MEM_SAP::MALLOC_OPTIONS &malloc_options (void); + // Accessor to underlying malloc options. + // = Meta-type info - typedef u_short PEER_ADDR; + typedef ACE_MEM_Addr PEER_ADDR; typedef ACE_MEM_Stream PEER_STREAM; void dump (void) const; @@ -87,6 +91,9 @@ public: ACE_ALLOC_HOOK_DECLARE; // Declare the dynamic allocation hooks. + +private: + ACE_MEM_SAP::MALLOC_OPTIONS malloc_options_; }; #if !defined (ACE_LACKS_INLINE_FUNCTIONS) diff --git a/ace/MEM_Connector.i b/ace/MEM_Connector.i index 5030a777e52..3fdf59e19e0 100644 --- a/ace/MEM_Connector.i +++ b/ace/MEM_Connector.i @@ -4,3 +4,9 @@ // MEM_Connector.i // Establish a connection. + +ASYS_INLINE ACE_MEM_SAP::MALLOC_OPTIONS & +ACE_MEM_Connector::malloc_options (void) +{ + return this->malloc_options_; +} @@ -1714,9 +1714,9 @@ private: ACE_Time_Value *max_wait_time_; # define ACE_SOCK_STREAM ACE_SOCK_Stream, ACE_INET_Addr // Handle ACE_MEM_* -# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, u_short -# define ACE_MEM_CONNECTOR ACE_MEM_Connector, u_short -# define ACE_MEM_STREAM ACE_MEM_Stream, u_short +# define ACE_MEM_ACCEPTOR ACE_MEM_Acceptor, ACE_MEM_Addr +# define ACE_MEM_CONNECTOR ACE_MEM_Connector, ACE_MEM_Addr +# define ACE_MEM_STREAM ACE_MEM_Stream, ACE_Addr // Handle ACE_LSOCK_* # define ACE_LSOCK_ACCEPTOR ACE_LSOCK_Acceptor, ACE_UNIX_Addr diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 8c56814a8e3..75cec281276 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -2183,6 +2183,33 @@ SOURCE=.\MEM_Acceptor.cpp # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.cpp
+
+!IF "$(CFG)" == "ACE DLL - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Alpha Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 Alpha Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Debug"
+
+!ELSEIF "$(CFG)" == "ACE DLL - Win32 MFC Release"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.cpp
!IF "$(CFG)" == "ACE DLL - Win32 Debug"
@@ -5499,6 +5526,10 @@ SOURCE=.\MEM_Acceptor.h # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.h
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.h
# End Source File
# Begin Source File
@@ -6347,6 +6378,10 @@ SOURCE=.\MEM_Acceptor.i # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.i
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.i
# End Source File
# Begin Source File
diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index 440d26d189d..87536b1c360 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -2109,6 +2109,33 @@ SOURCE=.\MEM_Acceptor.cpp # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.cpp
+
+!IF "$(CFG)" == "ACE LIB - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Alpha Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Alpha Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Alpha Unicode Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 Alpha Unicode Release"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 PharLap ETS Debug"
+
+!ELSEIF "$(CFG)" == "ACE LIB - Win32 PharLap ETS Release"
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.cpp
!IF "$(CFG)" == "ACE LIB - Win32 Debug"
@@ -5425,6 +5452,10 @@ SOURCE=.\MEM_Acceptor.h # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.h
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.h
# End Source File
# Begin Source File
@@ -6273,6 +6304,10 @@ SOURCE=.\MEM_Acceptor.i # End Source File
# Begin Source File
+SOURCE=.\MEM_Addr.i
+# End Source File
+# Begin Source File
+
SOURCE=.\MEM_Connector.i
# End Source File
# Begin Source File
|