diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-22 21:33:56 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-02-22 21:33:56 +0000 |
commit | 05d854873e30493c87f9ea7f09476205c8cedb7c (patch) | |
tree | cb7ee48ded452c763a673953c7edec9f5ea5e1b4 | |
parent | ef83ce957e08b8fa537aaf3c58869910ae6fb08d (diff) | |
download | ATCD-05d854873e30493c87f9ea7f09476205c8cedb7c.tar.gz |
ChangeLogTag: Tue Feb 22 13:57:32 2000 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 6 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 6 | ||||
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 36 | ||||
-rw-r--r-- | TAO/tao/GIOP.cpp | 11 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 49 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Connector.cpp | 47 | ||||
-rw-r--r-- | TAO/tao/UIOP_Connector.cpp | 59 | ||||
-rw-r--r-- | TAO/tao/Wait_Strategy.cpp | 31 | ||||
-rw-r--r-- | ace/ACE.cpp | 126 | ||||
-rw-r--r-- | ace/ACE.i | 108 |
12 files changed, 295 insertions, 198 deletions
diff --git a/ChangeLog b/ChangeLog index aee14f31c97..1f0fc0aff52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Feb 22 13:57:32 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/ACE.cpp (send_n and recv_n): Reduced the number of calls to + message_block->length () by caching the value. Also inlined + some of the smaller functions. + Tue Feb 22 12:29:44 2000 Ossama Othman <ossama@uci.edu> * m4/threads.m4 (ACE_CHECK_THREAD_FLAGS): diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index aee14f31c97..1f0fc0aff52 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,9 @@ +Tue Feb 22 13:57:32 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/ACE.cpp (send_n and recv_n): Reduced the number of calls to + message_block->length () by caching the value. Also inlined + some of the smaller functions. + Tue Feb 22 12:29:44 2000 Ossama Othman <ossama@uci.edu> * m4/threads.m4 (ACE_CHECK_THREAD_FLAGS): diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index aee14f31c97..1f0fc0aff52 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,9 @@ +Tue Feb 22 13:57:32 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * ace/ACE.cpp (send_n and recv_n): Reduced the number of calls to + message_block->length () by caching the value. Also inlined + some of the smaller functions. + Tue Feb 22 12:29:44 2000 Ossama Othman <ossama@uci.edu> * m4/threads.m4 (ACE_CHECK_THREAD_FLAGS): diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 797897dae0e..164f0061568 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,10 +1,34 @@ +Tue Feb 22 13:57:32 2000 Irfan Pyarali <irfan@cs.wustl.edu> + + * TAO/tao/Invocation.cpp (start and invoke): Removed extra updates + that were being called on the countdown timer. + + * TAO/tao/GIOP.cpp (send_message): Optimized away a call to + TAO_OutputCDR::length(). + + * TAO/tao/Wait_Strategy.cpp (sending_request): The assignment of + <reply_received_>, <expecting_response_>, and <calling_thread_> + was protected by the leader/followers lock. In the case of + oneways, these fields are not used, so this seems excessive. In + the case of twoways, this stuff is done before the request is + actually sent, therefore, there isn't any chance of the leader + resetting these fields simultaneously. Therefore, the lock has + been removed. + + * TAO/tao/IIOP_Connector.cpp (connect): + * TAO/tao/UIOP_Connector.cpp (connect): + * TAO/tao/SHMIOP_Connector.cpp (connect): + + Optimize the creation of the synch options. Only create it is + there is a timeout specified by the user. + Tue Feb 22 14:51:32 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_generator.cpp: Changes to create_module() to handle a module which is - reopened by appearing once in each of a chain of - #inclusions. Thanks to Lothar Werzinger - <werzinger.lothar@krones.de> for the example IDL file + reopened by appearing once in each of a chain of + #inclusions. Thanks to Lothar Werzinger + <werzinger.lothar@krones.de> for the example IDL file that uncovered this bug. * tests/IDL_Test/included.idl: @@ -14,11 +38,11 @@ Tue Feb 22 14:51:32 2000 Jeff Parsons <parsons@cs.wustl.edu> Tue Feb 22 13:28:19 2000 Nagarajan Surendran <naga@cs.wustl.edu> - * orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp: - + * orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp: + Fixed compile errors on Redhat Linux. Thanks to Alex Luk <fluk7@ie.cuhk.edu.hk> for reporting this. - + Tue Feb 22 10:33:24 2000 Jeff Parsons <parsons@cs.wustl.edu> * TAO_IDL/be/be_codegen.cpp: diff --git a/TAO/tao/GIOP.cpp b/TAO/tao/GIOP.cpp index 66dea8c3130..4e6598c8b1e 100644 --- a/TAO/tao/GIOP.cpp +++ b/TAO/tao/GIOP.cpp @@ -448,10 +448,13 @@ TAO_GIOP::send_message (TAO_Transport *transport, // socket never gets set to a nonblocking mode ... some Linux // versions seem to need it though. Leaving it costs little. - TAO_GIOP::dump_msg ("send", - ACE_reinterpret_cast (u_char *, - buf), - stream.length ()); + if (TAO_debug_level >= 5) + { + TAO_GIOP::dump_msg ("send", + ACE_reinterpret_cast (u_char *, + buf), + stream.length ()); + } // This guarantees to send all data (bytes) or return an error. ssize_t n = transport->send (stub, diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index f401a0bd724..b887d26dbe9 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -454,25 +454,40 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile, if (iiop_profile == 0) return -1; - const ACE_INET_Addr &oa = + const ACE_INET_Addr &remote_address = iiop_profile->object_addr (); - ACE_Synch_Options synch_options; + TAO_IIOP_Client_Connection_Handler *svc_handler = 0; + int result = 0; + if (max_wait_time != 0) - synch_options.set (ACE_Synch_Options::USE_TIMEOUT, - *max_wait_time); - - TAO_IIOP_Client_Connection_Handler* result; - - // The connect call will set the hint () stored in the Profile - // object; but we obtain the transport in the <result> - // variable. Other threads may modify the hint, but we are not - // affected. - if (this->base_connector_.connect (iiop_profile->hint (), - result, - oa, - synch_options) == -1) - { // Give users a clue to the problem. + { + ACE_Synch_Options synch_options (ACE_Synch_Options::USE_TIMEOUT, + *max_wait_time); + + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (iiop_profile->hint (), + svc_handler, + remote_address, + synch_options); + } + else + { + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (iiop_profile->hint (), + svc_handler, + remote_address); + } + + if (result == -1) + { + // Give users a clue to the problem. if (TAO_orbdebug) { char buffer [MAXNAMELEN * 2]; @@ -489,7 +504,7 @@ TAO_IIOP_Connector::connect (TAO_Profile *profile, return -1; } - transport = result->transport (); + transport = svc_handler->transport (); return 0; } diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index d0dcca3f2a8..6e4c24683be 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -268,11 +268,9 @@ TAO_GIOP_Invocation::start (CORBA::Environment &ACE_TRY_ENV) if (this->transport_ != 0) this->transport_->idle (); - countdown.update (); int result = conn_reg->connect (this->profile_, this->transport_, this->max_wait_time_); - countdown.update (); if (result == 0) break; @@ -293,12 +291,12 @@ TAO_GIOP_Invocation::start (CORBA::Environment &ACE_TRY_ENV) TAO_INVOCATION_CONNECT_MINOR_CODE, errno), CORBA::COMPLETED_NO)); + + countdown.update (); } // Obtain unique request id from the RMS. this->request_id_ = this->transport_->tms ()->request_id (); - - countdown.update (); } void @@ -351,7 +349,6 @@ TAO_GIOP_Invocation::invoke (CORBA::Boolean is_roundtrip, // Even for oneways: with AMI it is possible to wait for a // response (empty) for oneways, just to make sure that they // arrive, there are policies to control that. - countdown.update (); int result = this->transport_->send_request (this->stub_, @@ -359,7 +356,6 @@ TAO_GIOP_Invocation::invoke (CORBA::Boolean is_roundtrip, this->out_stream_, is_roundtrip, this->max_wait_time_); - countdown.update (); // // @@ highly desirable to know whether we wrote _any_ data; if diff --git a/TAO/tao/SHMIOP_Connector.cpp b/TAO/tao/SHMIOP_Connector.cpp index 4c2659324b8..c8fe1994bba 100644 --- a/TAO/tao/SHMIOP_Connector.cpp +++ b/TAO/tao/SHMIOP_Connector.cpp @@ -440,24 +440,39 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile, if (shmiop_profile == 0) return -1; - const ACE_INET_Addr &oa = + const ACE_INET_Addr &remote_address = shmiop_profile->object_addr (); - ACE_Synch_Options synch_options; + TAO_SHMIOP_Client_Connection_Handler* svc_handler = 0; + int result = 0; + if (max_wait_time != 0) - synch_options.set (ACE_Synch_Options::USE_TIMEOUT, - *max_wait_time); - - TAO_SHMIOP_Client_Connection_Handler* result; - - // The connect call will set the hint () stored in the Profile - // object; but we obtain the transport in the <result> - // variable. Other threads may modify the hint, but we are not - // affected. - if (this->base_connector_.connect (shmiop_profile->hint (), - result, - oa, - synch_options) == -1) + { + ACE_Synch_Options synch_options; + synch_options.set (ACE_Synch_Options::USE_TIMEOUT, + *max_wait_time); + + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (shmiop_profile->hint (), + svc_handler, + remote_address, + synch_options); + } + else + { + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (shmiop_profile->hint (), + svc_handler, + remote_address); + } + + if (result == -1) { // Give users a clue to the problem. if (TAO_orbdebug) { @@ -475,7 +490,7 @@ TAO_SHMIOP_Connector::connect (TAO_Profile *profile, return -1; } - transport = result->transport (); + transport = svc_handler->transport (); return 0; } diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp index 0be764a1d60..2762f2fe4ab 100644 --- a/TAO/tao/UIOP_Connector.cpp +++ b/TAO/tao/UIOP_Connector.cpp @@ -453,32 +453,48 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile, if (uiop_profile == 0) return -1; - const ACE_UNIX_Addr &oa = + const ACE_UNIX_Addr &remote_address = uiop_profile->object_addr (); - ACE_Synch_Options synch_options; + TAO_UIOP_Client_Connection_Handler *svc_handler = 0; + int result = 0; + if (max_wait_time != 0) - synch_options.set (ACE_Synch_Options::USE_TIMEOUT, - *max_wait_time); - - TAO_UIOP_Client_Connection_Handler* result; - - // The connect call will set the hint () stored in the Profile - // object; but we obtain the transport in the <result> - // variable. Other threads may modify the hint, but we are not - // affected. - if (this->base_connector_.connect (uiop_profile->hint (), - result, - oa, - synch_options) == -1) - { // Give users a clue to the problem. + { + ACE_Synch_Options synch_options (ACE_Synch_Options::USE_TIMEOUT, + *max_wait_time); + + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (uiop_profile->hint (), + svc_handler, + remote_address, + synch_options); + } + else + { + // The connect call will set the hint () stored in the Profile + // object; but we obtain the transport in the <svc_handler> + // variable. Other threads may modify the hint, but we are not + // affected. + result = this->base_connector_.connect (uiop_profile->hint (), + svc_handler, + remote_address); + } + + if (result == -1) + { + // Give users a clue to the problem. if (TAO_orbdebug) { - char buffer [MAXPATHLEN + 1]; - profile->addr_to_string (buffer, MAXPATHLEN); + char buffer [MAXNAMELEN * 2]; + profile->addr_to_string (buffer, + (MAXNAMELEN * 2) - 1); ACE_DEBUG ((LM_ERROR, - "(%P|%t) %s:%u, connection to " - "%s failed (%p)\n", + ASYS_TEXT ("(%P|%t) %s:%u, connection to ") + ASYS_TEXT ("%s failed (%p)\n"), __FILE__, __LINE__, buffer, @@ -487,8 +503,7 @@ TAO_UIOP_Connector::connect (TAO_Profile *profile, return -1; } - transport = result->transport (); - + transport = svc_handler->transport (); return 0; } diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp index 9ad209b0a2e..f6a9eb319ff 100644 --- a/TAO/tao/Wait_Strategy.cpp +++ b/TAO/tao/Wait_Strategy.cpp @@ -173,23 +173,28 @@ int TAO_Exclusive_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core, int two_way) { - { - ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, - orb_core->leader_follower ().lock (), -1); + // + // Note that in previous versions of this code, the assignment of + // the following three variables was protected by the + // leader/followers lock. In the case of oneways, these fields are + // not used, so this seems excessive. In the case of twoways, this + // stuff is done before the request is actually sent, therefore, + // there isn't any chance of the leader resetting these fields + // simultaneously. Therefore, the lock has been removed. + // - // The last request may have left this unitialized - this->reply_received_ = 0; + // The last request may have left this unitialized + this->reply_received_ = 0; - // Set the state so that we know we're looking for a response. - this->expecting_response_ = two_way; + // Set the state so that we know we're looking for a response. + this->expecting_response_ = two_way; - // remember in which thread the client connection handler was running - this->calling_thread_ = ACE_Thread::self (); + // remember in which thread the client connection handler was running + this->calling_thread_ = ACE_Thread::self (); - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("TAO (%P|%t) - sending request for <%x>\n"), - this->transport_)); - } + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("TAO (%P|%t) - sending request for <%x>\n"), + this->transport_)); // Register the handler. this->transport_->register_handler (); diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 171abad7403..c23a0b07856 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1190,26 +1190,6 @@ ACE::recvfrom (ACE_HANDLE handle, } ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len, - flags); - else - return ACE::recv_n_i (handle, - buf, - len, - flags, - timeout); -} - -ssize_t ACE::recv_n_i (ACE_HANDLE handle, void *buf, size_t len, @@ -1301,23 +1281,6 @@ ACE::recv_n_i (ACE_HANDLE handle, } ssize_t -ACE::recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::recv_n_i (handle, - buf, - len); - else - return ACE::recv_n_i (handle, - buf, - len, - timeout); -} - -ssize_t ACE::recv_n_i (ACE_HANDLE handle, void *buf, size_t len) @@ -1470,23 +1433,6 @@ ACE::recvv (ACE_HANDLE handle, } ssize_t -ACE::recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::recvv_n_i (handle, - iov, - iovcnt); - else - return ACE::recvv_n_i (handle, - iov, - iovcnt, - timeout); -} - -ssize_t ACE::recvv_n_i (ACE_HANDLE handle, iovec *iov, int iovcnt) @@ -1619,18 +1565,21 @@ ACE::recv_n (ACE_HANDLE handle, while (current_message_block != 0) { + size_t current_message_block_length = + current_message_block->length (); + // Check if this block has any space for incoming data. - if (current_message_block->length () > 0) + if (current_message_block_length > 0) { // Collect the data in the iovec. iov[iovcnt].iov_base = current_message_block->rd_ptr (); - iov[iovcnt].iov_len = current_message_block->length (); + iov[iovcnt].iov_len = current_message_block_length; // Increment iovec counter. iovcnt++; // Keep track of the number of bytes for this recv. - recv_size += current_message_block->length (); + recv_size += current_message_block_length; // The buffer is full make a OS call. @@ TODO find a way to // find IOV_MAX for platforms that do not define it rather @@ -1819,26 +1768,6 @@ ACE::sendto (ACE_HANDLE handle, } ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len, - flags); - else - return ACE::send_n_i (handle, - buf, - len, - flags, - timeout); -} - -ssize_t ACE::send_n_i (ACE_HANDLE handle, const void *buf, size_t len, @@ -1930,23 +1859,6 @@ ACE::send_n_i (ACE_HANDLE handle, } ssize_t -ACE::send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::send_n_i (handle, - buf, - len); - else - return ACE::send_n_i (handle, - buf, - len, - timeout); -} - -ssize_t ACE::send_n_i (ACE_HANDLE handle, const void *buf, size_t len) @@ -2098,23 +2010,6 @@ ACE::sendv (ACE_HANDLE handle, } ssize_t -ACE::sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout) -{ - if (timeout == 0) - return ACE::sendv_n_i (handle, - iov, - iovcnt); - else - return ACE::sendv_n_i (handle, - iov, - iovcnt, - timeout); -} - -ssize_t ACE::sendv_n_i (ACE_HANDLE handle, const iovec *i, int iovcnt) @@ -2251,18 +2146,21 @@ ACE::send_n (ACE_HANDLE handle, while (current_message_block != 0) { + size_t current_message_block_length = + current_message_block->length (); + // Check if this block has any data to be sent. - if (current_message_block->length () > 0) + if (current_message_block_length > 0) { // Collect the data in the iovec. iov[iovcnt].iov_base = current_message_block->rd_ptr (); - iov[iovcnt].iov_len = current_message_block->length (); + iov[iovcnt].iov_len = current_message_block_length; // Increment iovec counter. iovcnt++; // Keep track of the number of bytes for this send. - send_size += current_message_block->length (); + send_size += current_message_block_length; // The buffer is full make a OS call. @@ TODO find a way to // find IOV_MAX for platforms that do not define it rather diff --git a/ace/ACE.i b/ace/ACE.i index 8d69ea3a139..b2db5c6cdbb 100644 --- a/ace/ACE.i +++ b/ace/ACE.i @@ -20,6 +20,114 @@ ACE::write_n (ACE_HANDLE handle, } ASYS_INLINE ssize_t +ACE::recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::recv_n_i (handle, + buf, + len, + flags); + else + return ACE::recv_n_i (handle, + buf, + len, + flags, + timeout); +} + +ASYS_INLINE ssize_t +ACE::recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::recv_n_i (handle, + buf, + len); + else + return ACE::recv_n_i (handle, + buf, + len, + timeout); +} + +ASYS_INLINE ssize_t +ACE::recvv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::recvv_n_i (handle, + iov, + iovcnt); + else + return ACE::recvv_n_i (handle, + iov, + iovcnt, + timeout); +} + +ASYS_INLINE ssize_t +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::send_n_i (handle, + buf, + len, + flags); + else + return ACE::send_n_i (handle, + buf, + len, + flags, + timeout); +} + +ASYS_INLINE ssize_t +ACE::send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::send_n_i (handle, + buf, + len); + else + return ACE::send_n_i (handle, + buf, + len, + timeout); +} + +ASYS_INLINE ssize_t +ACE::sendv_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout) +{ + if (timeout == 0) + return ACE::sendv_n_i (handle, + iov, + iovcnt); + else + return ACE::sendv_n_i (handle, + iov, + iovcnt, + timeout); +} + +ASYS_INLINE ssize_t ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len) { #if defined (ACE_WIN32) || defined (ACE_PSOS) |