summaryrefslogtreecommitdiff
path: root/TAO/tao/Strategies
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 08:02:58 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 08:02:58 +0000
commite588f487fe14b34a642a62bd0cb53877a42b4793 (patch)
tree8c0bc2f7aa508472a4fd98dfca9d6afd60130f52 /TAO/tao/Strategies
parentad7f2d4ae4273710073d841fe5afccaf14e6718a (diff)
downloadATCD-e588f487fe14b34a642a62bd0cb53877a42b4793.tar.gz
ChangeLogTag:Tue Apr 24 00:21:54 2001 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'TAO/tao/Strategies')
-rw-r--r--TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp35
-rw-r--r--TAO/tao/Strategies/SHMIOP_Transport.cpp54
-rw-r--r--TAO/tao/Strategies/SHMIOP_Transport.h8
-rw-r--r--TAO/tao/Strategies/UIOP_Connection_Handler.cpp42
-rw-r--r--TAO/tao/Strategies/UIOP_Transport.cpp50
-rw-r--r--TAO/tao/Strategies/UIOP_Transport.h12
6 files changed, 78 insertions, 123 deletions
diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
index d2b99bec1dc..50dc660bf8e 100644
--- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp
@@ -22,8 +22,6 @@
ACE_RCSID(Strategies, SHMIOP_Connect, "$Id$")
-
-
TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (ACE_Thread_Manager *t)
: TAO_SHMIOP_SVC_HANDLER (t, 0 , 0),
TAO_Connection_Handler (0),
@@ -57,23 +55,8 @@ TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (TAO_ORB_Core *orb_
TAO_SHMIOP_Connection_Handler::~TAO_SHMIOP_Connection_Handler (void)
{
- if (this->transport () != 0)
- {
- // If the socket has not already been closed.
- if (this->get_handle () != ACE_INVALID_HANDLE)
- {
- // Cannot deal with errors, and therefore they are ignored.
- this->transport ()->send_buffered_messages ();
- }
- else
- {
- // Dequeue messages and delete message blocks.
- this->transport ()->dequeue_all ();
- }
- }
}
-
int
TAO_SHMIOP_Connection_Handler::open (void*)
{
@@ -214,9 +197,6 @@ TAO_SHMIOP_Connection_Handler::handle_close (ACE_HANDLE handle,
// Close the handle..
if (this->get_handle () != ACE_INVALID_HANDLE)
{
- // Send the buffered messages first
- this->transport ()->send_buffered_messages ();
-
// Mark the entry as invalid
this->transport ()->mark_invalid ();
@@ -240,28 +220,17 @@ TAO_SHMIOP_Connection_Handler::fetch_handle (void)
return this->get_handle ();
}
-
int
TAO_SHMIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
const void *)
{
- // This method is called when buffering timer expires.
- //
- ACE_Time_Value *max_wait_time = 0;
-
- TAO_Stub *stub = 0;
- int has_timeout;
- this->orb_core ()->call_timeout_hook (stub,
- has_timeout,
- *max_wait_time);
-
// Cannot deal with errors, and therefore they are ignored.
- this->transport ()->send_buffered_messages (max_wait_time);
+ if (this->transport ()->handle_output () == -1)
+ return -1;
return 0;
}
-
int
TAO_SHMIOP_Connection_Handler::add_transport_to_cache (void)
{
diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp
index e6e53353061..ae99103d5f6 100644
--- a/TAO/tao/Strategies/SHMIOP_Transport.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp
@@ -1,14 +1,10 @@
// This may look like C, but it's really -*- C++ -*-
// $Id$
-
#include "SHMIOP_Transport.h"
#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
-ACE_RCSID (Strategies, SHMIOP_Transport, "$Id$")
-
-
#include "SHMIOP_Connection_Handler.h"
#include "SHMIOP_Profile.h"
#include "tao/Timeprobe.h"
@@ -27,6 +23,7 @@ ACE_RCSID (Strategies, SHMIOP_Transport, "$Id$")
# include "SHMIOP_Transport.i"
#endif /* ! __ACE_INLINE__ */
+ACE_RCSID (Strategies, SHMIOP_Transport, "$Id$")
TAO_SHMIOP_Transport::TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handler,
TAO_ORB_Core *orb_core,
@@ -70,12 +67,23 @@ TAO_SHMIOP_Transport::messaging_object (void)
ssize_t
-TAO_SHMIOP_Transport::send_i (const ACE_Message_Block *message_block,
- const ACE_Time_Value *max_wait_time,
- size_t *)
+TAO_SHMIOP_Transport::send_i (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
{
- return this->connection_handler_->peer ().send (message_block,
- max_wait_time);
+ bytes_transferred = 0;
+ for (int i = 0; i < iovcnt; ++i)
+ {
+ ssize_t retval =
+ this->connection_handler_->peer ().send (iov[i].iov_base,
+ iov[i].iov_len,
+ max_wait_time);
+ if (retval > 0)
+ bytes_transferred += retval;
+ if (retval <= 0)
+ return retval;
+ }
+ return bytes_transferred;
}
ssize_t
@@ -127,6 +135,21 @@ TAO_SHMIOP_Transport::read_process_message (ACE_Time_Value *max_wait_time,
int
TAO_SHMIOP_Transport::register_handler_i (void)
{
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Transport::register_handler %d\n",
+ this->id ()));
+ }
+ if (this->connection_handler_->is_registered ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Transport::register_handler %d"
+ ", already registered\n",
+ this->id ()));
+ return 0;
+ }
+
// @@ It seems like this method should go away, the right reactor is
// picked at object creation time.
ACE_Reactor *r = this->orb_core_->reactor ();
@@ -180,7 +203,7 @@ TAO_SHMIOP_Transport::send_message (TAO_OutputCDR &stream,
// versions seem to need it though. Leaving it costs little.
// This guarantees to send all data (bytes) or return an error.
- ssize_t n = this->send_or_buffer (stub,
+ ssize_t n = this->send_message_i (stub,
twoway,
stream.begin (),
max_wait_time);
@@ -196,17 +219,6 @@ TAO_SHMIOP_Transport::send_message (TAO_OutputCDR &stream,
return -1;
}
- // EOF.
- if (n == 0)
- {
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n")
- ACE_TEXT ("EOF, closing transport %d\n"),
- this->id ()));
- return -1;
- }
-
return 1;
}
diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h
index dc679330824..ead847e0e5a 100644
--- a/TAO/tao/Strategies/SHMIOP_Transport.h
+++ b/TAO/tao/Strategies/SHMIOP_Transport.h
@@ -1,5 +1,6 @@
// This may look like C, but it's really -*- C++ -*-
// $Id$
+
// ===================================================================
/**
* @file SHMIOP_Transport.h
@@ -10,6 +11,7 @@
* @author Modified by Balachandran Natarajan <bala@cs.wustl.edu>
*/
// ===================================================================
+
#ifndef TAO_SHMIOP_TRANSPORT_H
#define TAO_SHMIOP_TRANSPORT_H
#include "ace/pre.h"
@@ -67,9 +69,9 @@ protected:
virtual TAO_Pluggable_Messaging *messaging_object (void);
/// Write the complete Message_Block chain to the connection.
- virtual ssize_t send_i (const ACE_Message_Block *mblk,
- const ACE_Time_Value *s = 0,
- size_t *bytes_transferred = 0);
+ virtual ssize_t send_i (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
/// Read len bytes from into buf.
virtual ssize_t recv_i (char *buf,
diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp
index 113f4925512..9b16ca2a6dc 100644
--- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp
+++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp
@@ -4,6 +4,8 @@
#if TAO_HAS_UIOP == 1
+#include "UIOP_Transport.h"
+#include "UIOP_Endpoint.h"
#include "tao/debug.h"
#include "tao/ORB_Core.h"
#include "tao/ORB.h"
@@ -11,18 +13,14 @@
#include "tao/Timeprobe.h"
#include "tao/Server_Strategy_Factory.h"
#include "tao/Messaging_Policy_i.h"
-#include "UIOP_Endpoint.h"
#include "tao/Base_Transport_Property.h"
+#include "tao/GIOP_Message_Lite.h"
#if !defined (__ACE_INLINE__)
# include "UIOP_Connection_Handler.inl"
#endif /* ! __ACE_INLINE__ */
-ACE_RCSID(Strategies, UIOP_Connect, "$Id$")
-
-#include "tao/GIOP_Message_Lite.h"
-
-
+ACE_RCSID(Strategies, UIOP_Connection_Handler, "$Id$")
TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (ACE_Thread_Manager *t)
: TAO_UIOP_SVC_HANDLER (t, 0 , 0),
@@ -60,23 +58,8 @@ TAO_UIOP_Connection_Handler::TAO_UIOP_Connection_Handler (TAO_ORB_Core *orb_core
TAO_UIOP_Connection_Handler::~TAO_UIOP_Connection_Handler (void)
{
- if (this->transport () != 0) {
- // If the socket has not already been closed.
- if (this->get_handle () != ACE_INVALID_HANDLE)
- {
- // Cannot deal with errors, and therefore they are ignored.
- this->transport ()->send_buffered_messages ();
- }
- else
- {
- // Dequeue messages and delete message blocks.
- this->transport ()->dequeue_all ();
- }
- }
}
-
-
int
TAO_UIOP_Connection_Handler::open (void*)
{
@@ -196,9 +179,6 @@ TAO_UIOP_Connection_Handler::handle_close (ACE_HANDLE handle,
// Close the handle..
if (this->get_handle () != ACE_INVALID_HANDLE)
{
- // Send the buffered messages first
- this->transport ()->send_buffered_messages ();
-
// Mark the entry as invalid
this->transport ()->mark_invalid ();
@@ -225,23 +205,13 @@ int
TAO_UIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &,
const void *)
{
- // This method is called when buffering timer expires.
- //
- ACE_Time_Value *max_wait_time = 0;
-
- TAO_Stub *stub = 0;
- int has_timeout;
- this->orb_core ()->call_timeout_hook (stub,
- has_timeout,
- *max_wait_time);
-
// Cannot deal with errors, and therefore they are ignored.
- this->transport ()->send_buffered_messages (max_wait_time);
+ if (this->transport ()->handle_output () == -1)
+ return -1;
return 0;
}
-
int
TAO_UIOP_Connection_Handler::add_transport_to_cache (void)
{
diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp
index 9dbb2bd0019..172ef5260a0 100644
--- a/TAO/tao/Strategies/UIOP_Transport.cpp
+++ b/TAO/tao/Strategies/UIOP_Transport.cpp
@@ -5,10 +5,6 @@
#if TAO_HAS_UIOP == 1
-
-ACE_RCSID (Strategies, UIOP_Transport, "$Id$")
-
-
#include "UIOP_Connection_Handler.h"
#include "UIOP_Profile.h"
#include "tao/Timeprobe.h"
@@ -26,6 +22,7 @@ ACE_RCSID (Strategies, UIOP_Transport, "$Id$")
# include "UIOP_Transport.i"
#endif /* ! __ACE_INLINE__ */
+ACE_RCSID (Strategies, UIOP_Transport, "$Id$")
TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler,
@@ -67,16 +64,17 @@ TAO_UIOP_Transport::messaging_object (void)
return this->messaging_object_;
}
-
ssize_t
-TAO_UIOP_Transport::send_i (const ACE_Message_Block *message_block,
- const ACE_Time_Value *max_wait_time,
- size_t *bytes_transferred)
+TAO_UIOP_Transport::send_i (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
{
- return ACE::send_n (this->connection_handler_->get_handle (),
- message_block,
- max_wait_time,
- bytes_transferred);
+ ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
+ max_wait_time);
+ if (retval > 0)
+ bytes_transferred = retval;
+
+ return retval;
}
ssize_t
@@ -127,6 +125,21 @@ TAO_UIOP_Transport::read_process_message (ACE_Time_Value *max_wait_time,
int
TAO_UIOP_Transport::register_handler_i (void)
{
+ if (TAO_debug_level > 4)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Transport::register_handler %d\n",
+ this->id ()));
+ }
+ if (this->connection_handler_->is_registered ())
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - IIOP_Transport::register_handler %d"
+ ", already registered\n",
+ this->id ()));
+ return 0;
+ }
+
// @@ It seems like this method should go away, the right reactor is
// picked at object creation time.
ACE_Reactor *r = this->orb_core_->reactor ();
@@ -180,7 +193,7 @@ TAO_UIOP_Transport::send_message (TAO_OutputCDR &stream,
// versions seem to need it though. Leaving it costs little.
// This guarantees to send all data (bytes) or return an error.
- ssize_t n = this->send_or_buffer (stub,
+ ssize_t n = this->send_message_i (stub,
twoway,
stream.begin (),
max_wait_time);
@@ -196,17 +209,6 @@ TAO_UIOP_Transport::send_message (TAO_OutputCDR &stream,
return -1;
}
- // EOF.
- if (n == 0)
- {
- if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n")
- ACE_TEXT ("EOF, closing transport %d\n"),
- this->id ()));
- return -1;
- }
-
return 1;
}
diff --git a/TAO/tao/Strategies/UIOP_Transport.h b/TAO/tao/Strategies/UIOP_Transport.h
index de7d68b2e1e..f3bb0b2b920 100644
--- a/TAO/tao/Strategies/UIOP_Transport.h
+++ b/TAO/tao/Strategies/UIOP_Transport.h
@@ -1,13 +1,13 @@
// This may look like C, but it's really -*- C++ -*-
-//
+
// ===================================================================
/**
* @file UIOP_Transport.h
*
* $Id$
*
- * @author Originally by Fred Kuhns <fredk@cs.wustl.edu> and Ossama
- * Othman <ossama@ece.uci.edu>
+ * @author Originally by Fred Kuhns <fredk@cs.wustl.edu>
+ * @author Ossama Othman <ossama@ece.uci.edu>
* @author Modified by Balachandran Natarajan <bala@cs.wustl.edu>
*/
// ===================================================================
@@ -72,9 +72,9 @@ protected:
virtual TAO_Pluggable_Messaging *messaging_object (void);
/// Write the complete Message_Block chain to the connection.
- virtual ssize_t send_i (const ACE_Message_Block *mblk,
- const ACE_Time_Value *s = 0,
- size_t *bytes_transferred = 0);
+ virtual ssize_t send_i (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *timeout = 0);
/// Read len bytes from into buf.
virtual ssize_t recv_i (char *buf,