summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 05:12:06 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-04-24 05:12:06 +0000
commitcb3b4b362075b809efc6d2eefabe80801894972a (patch)
tree4a0e8ef5428d6e4478da2a46b566c84df67ef376
parent17bad8909a7a0ea742c0621107d40736907b0648 (diff)
downloadATCD-fix_bug132_iter04.tar.gz
ChangeLogTag:Mon Apr 23 22:05:56 2001 Carlos O'Ryan <coryan@uci.edu>fix_bug132_iter04
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a10
-rw-r--r--TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp36
-rw-r--r--TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp179
-rw-r--r--TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h7
-rw-r--r--TAO/tao/IIOP_Transport.cpp16
5 files changed, 32 insertions, 216 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 50c0f539f67..f3d7ced978b 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,13 @@
+Mon Apr 23 22:05:56 2001 Carlos O'Ryan <coryan@uci.edu>
+
+ * examples/PluggableUDP/DIOP/DIOP_Transport.cpp:
+ * examples/PluggableUDP/DIOP/DIOP_Transport.h:
+ * examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp:
+ Update to match the new Transport classes.
+
+ * tao/IIOP_Transport.cpp:
+ Cosmetic fixes
+
Mon Apr 23 21:10:40 2001 Carlos O'Ryan <coryan@uci.edu>
* tests/AMI_Buffering/client.cpp:
diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp
index eaee0dd00cd..2a1930d7551 100644
--- a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp
+++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp
@@ -59,23 +59,7 @@ TAO_DIOP_Connection_Handler::TAO_DIOP_Connection_Handler (TAO_ORB_Core *orb_core
TAO_DIOP_Connection_Handler::~TAO_DIOP_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 ();
- }
- }
- // @@ Frank: Added from DIOP_Connect.cpp
- this->handle_cleanup ();
-
- udp_socket_.close ();
+ this->udp_socket_.close ();
}
// DIOP Additions - Begin
@@ -247,9 +231,6 @@ TAO_DIOP_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 ();
-
// Purge the entry too
this->transport ()->mark_invalid ();
@@ -281,18 +262,11 @@ int
TAO_DIOP_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;
}
diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp
index 5b0e362a66e..06005ab724e 100644
--- a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp
+++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp
@@ -1,6 +1,10 @@
// This may look like C, but it's really -*- C++ -*-
// $Id$
+#include "DIOP_Transport.h"
+#include "DIOP_Connection_Handler.h"
+#include "DIOP_Acceptor.h"
+#include "DIOP_Profile.h"
#include "tao/Acceptor_Registry.h"
#include "tao/operation_details.h"
#include "tao/Timeprobe.h"
@@ -14,12 +18,6 @@
#include "tao/GIOP_Message_Base.h"
#include "tao/GIOP_Message_Lite.h"
-
-#include "DIOP_Transport.h"
-#include "DIOP_Connection_Handler.h"
-#include "DIOP_Acceptor.h"
-#include "DIOP_Profile.h"
-
#if !defined (__ACE_INLINE__)
# include "DIOP_Transport.i"
#endif /* ! __ACE_INLINE__ */
@@ -69,154 +67,17 @@ TAO_DIOP_Transport::messaging_object (void)
return this->messaging_object_;
}
-
ssize_t
-TAO_DIOP_Transport::send_i (const ACE_Message_Block *message_block,
- const ACE_Time_Value * /*max_wait_time*/,
- size_t *bt)
+TAO_DIOP_Transport::send_i (iovec *iov, int iovcnt,
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
{
- const ACE_INET_Addr &addr = this->connection_handler_->addr ();
+ ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
+ max_wait_time);
+ if (retval > 0)
+ bytes_transferred = retval;
- /*size_t temp = 0;
- size_t &bytes_transferred = bt == 0 ? temp : *bt;
- bytes_transferred = 0;*/
- ssize_t bytes_transferred = 0;
- if (bt)
- {
- bytes_transferred = *bt;
- }
-
- char stack_buffer[ACE_MAX_DGRAM_SIZE];
- size_t stack_offset=0;
- size_t message_length=0;
-
- iovec iov[IOV_MAX];
- int iovcnt = 0;
-
- while (message_block != 0)
- {
- // Our current message block chain.
- const ACE_Message_Block *current_message_block = message_block;
-
- while (current_message_block != 0)
- {
- size_t current_message_block_length =
- current_message_block->length ();
-
- message_length += current_message_block_length;
-
- if(message_length > ACE_MAX_DGRAM_SIZE)
- {
- // This is an error as we do not send more.
- // Silently drop the message but log an error.
-
- // Pluggable_Messaging::transport_message only
- // cares if it gets -1 or 0 so we can return a
- // partial length and it will think all has gone
- // well.
-
-
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("\n\nTAO (%P|%t) ")
- ACE_TEXT ("DIOP_Transport::send ")
- ACE_TEXT ("Message length %d exceeds ACE_MAX_DGRAM_SIZE=%d\n"),
- message_length,
- ACE_MAX_DGRAM_SIZE));
- }
-
- return 1; // Pretend it is o.k.
- // This is a problem in the message
- // catalogue.
- }
-
- // Check if this block has any data to be sent.
- if (current_message_block_length > 0)
- {
- if(iovcnt < (IOV_MAX-1))
- {
- // Collect the data in the iovec.
- iov[iovcnt].iov_base = current_message_block->rd_ptr ();
- iov[iovcnt].iov_len = current_message_block_length;
-
- // Increment iovec counter.
- iovcnt++;
-
- // The buffer is full make a OS call. @@ TODO find a way to
- // find IOV_MAX for platforms that do not define it rather
- // than simply setting IOV_MAX to some arbitrary value such
- // as 16.
- }
- else
- {
- // @@ John Mackenzie. If we reach IOVMAX-1 we need to pack
- // the remanining blocks into the last available buffer.
-
- ACE_OS::memcpy(stack_buffer+stack_offset,
- current_message_block->rd_ptr (),
- current_message_block_length);
- stack_offset += current_message_block_length;
-
- iovcnt = IOV_MAX; // We just stay with the last buffer.
- iov[iovcnt-1].iov_base = stack_buffer;
- iov[iovcnt-1].iov_len = stack_offset;
- }
- }
-
- // Select the next message block in the chain.
- current_message_block = current_message_block->cont ();
- }
-
- // Selection of the next message block chain.
- message_block = message_block->next ();
- }
-
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("\n\nTAO (%P|%t) ")
- ACE_TEXT ("iovcnt is %d \n."),iovcnt));
- }
-
- // Send the buffers.
-
- if (iovcnt != 0)
- {
- bytes_transferred =
- this->connection_handler_->dgram ().send (iov,
- iovcnt,
- addr);
-
- /*
- ACE_DEBUG ((LM_DEBUG,
- "TAO_DIOP_Transport::send_i: sent %d bytes to %s:%d\n",
- bytes_transferred,
- addr.get_host_name (),
- addr.get_port_number ()));
- */
-
- // Errors.
- // @@ John Mackenzie. We cannot propogate errors up in DIOP
- // as it will cause transport recycle which makes no sense
- // Error could be ECONNREFUSED if transport reports ICMP errors.
- }
-
- if (bytes_transferred == -1 || bytes_transferred == 0)
- {
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("\n\nTAO (%P|%t) ")
- ACE_TEXT ("DIOP_Transport::send")
- ACE_TEXT (" %p\n\n"),
- ACE_TEXT ("Error returned from transport:")));
- }
- return 1; // Fake a good return.
- }
-
- // Return total bytes transferred.
- return bytes_transferred;
+ return retval;
}
ssize_t
@@ -284,7 +145,7 @@ int
TAO_DIOP_Transport::register_handler_i (void)
{
// @@ Michael:
- //
+ //
// We do never register register the handler with the reactor
// as we never need to be informed about any incoming data,
// assuming we only use one-ways.
@@ -348,7 +209,7 @@ TAO_DIOP_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);
@@ -364,17 +225,6 @@ TAO_DIOP_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;
}
@@ -671,4 +521,3 @@ TAO_DIOP_Transport::transition_handler_state_i (void)
{
this->connection_handler_ = 0;
}
-
diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h
index c4585141dd1..3e4abd9c43e 100644
--- a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h
+++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h
@@ -72,10 +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 *max_wait_time);
/// Read len bytes from into buf.
virtual ssize_t recv_i (char *buf,
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp
index b9dd65ee1ff..d927938164d 100644
--- a/TAO/tao/IIOP_Transport.cpp
+++ b/TAO/tao/IIOP_Transport.cpp
@@ -51,14 +51,6 @@ TAO_IIOP_Transport::~TAO_IIOP_Transport (void)
delete this->messaging_object_;
}
-#if 0
-ACE_HANDLE
-TAO_IIOP_Transport::handle (void)
-{
- return this->connection_handler_->get_handle ();
-}
-#endif
-
ACE_Event_Handler *
TAO_IIOP_Transport::event_handler_i (void)
{
@@ -523,11 +515,3 @@ TAO_IIOP_Transport::transition_handler_state_i (void)
{
this->connection_handler_ = 0;
}
-
-#if 0
-TAO_Connection_Handler*
-TAO_IIOP_Transport::connection_handler (void) const
-{
- return this->connection_handler_;
-}
-#endif