#include <TcpSendStrategy.h>
Public Member Functions | |
TcpSendStrategy (std::size_t id, TcpDataLink &link, TcpSynchResource *synch_resource, const TransportReactorTask_rch &task, Priority priority) | |
virtual | ~TcpSendStrategy () |
int | reset (bool reset_mode=false) |
virtual void | schedule_output () |
Enable or disable output processing by the reactor according to mode. | |
Protected Member Functions | |
virtual ssize_t | send_bytes (const iovec iov[], int n, int &bp) |
virtual ACE_HANDLE | get_handle () |
virtual ssize_t | send_bytes_i (const iovec iov[], int n) |
virtual void | relink (bool do_suspend=true) |
virtual void | stop_i () |
Let the subclass stop. | |
virtual void | add_delayed_notification (TransportQueueElement *element) |
Private Attributes | |
TcpDataLink & | link_ |
TransportReactorTask_rch | reactor_task_ |
Definition at line 25 of file TcpSendStrategy.h.
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TcpSendStrategy::TcpSendStrategy | ( | std::size_t | id, | |
TcpDataLink & | link, | |||
TcpSynchResource * | synch_resource, | |||
const TransportReactorTask_rch & | task, | |||
Priority | priority | |||
) |
Definition at line 22 of file TcpSendStrategy.cpp.
References DBG_ENTRY_LVL.
00028 : TransportSendStrategy(id, link.impl(), 00029 synch_resource, priority, 00030 make_rch<ReactorSynchStrategy>(this,task->get_reactor())) 00031 , link_(link) 00032 , reactor_task_(task) 00033 { 00034 DBG_ENTRY_LVL("TcpSendStrategy","TcpSendStrategy",6); 00035 00036 }
OpenDDS::DCPS::TcpSendStrategy::~TcpSendStrategy | ( | ) | [virtual] |
Definition at line 38 of file TcpSendStrategy.cpp.
References DBG_ENTRY_LVL.
00039 { 00040 DBG_ENTRY_LVL("TcpSendStrategy","~TcpSendStrategy",6); 00041 }
void OpenDDS::DCPS::TcpSendStrategy::add_delayed_notification | ( | TransportQueueElement * | element | ) | [protected, virtual] |
Reimplemented from OpenDDS::DCPS::TransportSendStrategy.
Definition at line 132 of file TcpSendStrategy.cpp.
References OpenDDS::DCPS::TransportQueueElement::is_request_ack().
00133 { 00134 if (!element->is_request_ack()) { 00135 // only add the notification when we are not sending REQUEST_ACK message 00136 TransportSendStrategy::add_delayed_notification(element); 00137 } 00138 }
ACE_HANDLE OpenDDS::DCPS::TcpSendStrategy::get_handle | ( | void | ) | [protected, virtual] |
Reimplemented from OpenDDS::DCPS::TransportSendStrategy.
Definition at line 90 of file TcpSendStrategy.cpp.
References OpenDDS::DCPS::TcpDataLink::get_connection(), and link_.
Referenced by schedule_output().
00091 { 00092 TcpConnection_rch connection = link_.get_connection(); 00093 00094 if (!connection) 00095 return ACE_INVALID_HANDLE; 00096 00097 return connection->peer().get_handle(); 00098 }
void OpenDDS::DCPS::TcpSendStrategy::relink | ( | bool | do_suspend = true |
) | [protected, virtual] |
Delegate to the connection object to re-establish the connection.
Reimplemented from OpenDDS::DCPS::TransportSendStrategy.
Definition at line 115 of file TcpSendStrategy.cpp.
References DBG_ENTRY_LVL, OpenDDS::DCPS::TcpDataLink::get_connection(), and link_.
00116 { 00117 DBG_ENTRY_LVL("TcpSendStrategy","relink",6); 00118 TcpConnection_rch connection = link_.get_connection(); 00119 00120 if (connection) { 00121 connection->relink_from_send(do_suspend); 00122 } 00123 }
int OpenDDS::DCPS::TcpSendStrategy::reset | ( | bool | reset_mode = false |
) |
This is called by the datalink object to associate with the "new" connection object. The "old" connection object is unregistered with the reactor and the "new" connection object is registered for sending. The implementation of this method is borrowed from the ReceiveStrategy.
Definition at line 67 of file TcpSendStrategy.cpp.
References OpenDDS::DCPS::TransportSendStrategy::clear(), DBG_ENTRY_LVL, OpenDDS::DCPS::TransportSendStrategy::MODE_DIRECT, and OpenDDS::DCPS::TransportSendStrategy::set_graceful_disconnecting().
Referenced by OpenDDS::DCPS::TcpDataLink::reconnect(), and OpenDDS::DCPS::TcpDataLink::reuse_existing_connection().
00068 { 00069 DBG_ENTRY_LVL("TcpSendStrategy","reset",6); 00070 //For the case of a send_strategy being reused for a new connection (not reconnect) 00071 //need to reset the state 00072 if (reset_mode) { 00073 //Need to make sure that the send mode is set back to MODE_DIRECT in case 00074 //it was terminated prior to being reused/reset. 00075 this->clear(MODE_DIRECT); 00076 //reset graceful_disconnecting_ to initial state 00077 this->set_graceful_disconnecting(false); 00078 } 00079 return 0; 00080 }
void OpenDDS::DCPS::TcpSendStrategy::schedule_output | ( | ) | [virtual] |
Enable or disable output processing by the reactor according to mode.
Reimplemented from OpenDDS::DCPS::ThreadSynchWorker.
Definition at line 44 of file TcpSendStrategy.cpp.
References ACE_TEXT(), DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, get_handle(), LM_DEBUG, OpenDDS::DCPS::TransportSendStrategy::mode(), OpenDDS::DCPS::TransportSendStrategy::MODE_DIRECT, OpenDDS::DCPS::TransportSendStrategy::MODE_QUEUE, OpenDDS::DCPS::TransportSendStrategy::MODE_SUSPEND, OpenDDS::DCPS::TransportSendStrategy::synch(), and OpenDDS::DCPS::ThreadSynch::work_available().
00045 { 00046 DBG_ENTRY_LVL("TcpSendStrategy","schedule_output",6); 00047 00048 // Notify the reactor to adjust its processing policy according to mode_. 00049 synch()->work_available(); 00050 00051 if (DCPS_debug_level > 4) { 00052 const char* action = ""; 00053 if( mode() == MODE_DIRECT) { 00054 action = "canceling"; 00055 } else if( (mode() == MODE_QUEUE) 00056 || (mode() == MODE_SUSPEND)) { 00057 action = "starting"; 00058 } 00059 ACE_DEBUG((LM_DEBUG, 00060 ACE_TEXT("(%P|%t) TcpSendStrategy::schedule_output() [%d] - ") 00061 ACE_TEXT("%C data queueing for handle %d.\n"), 00062 id(),action,get_handle())); 00063 } 00064 }
ssize_t OpenDDS::DCPS::TcpSendStrategy::send_bytes | ( | const iovec | iov[], | |
int | n, | |||
int & | bp | |||
) | [protected, virtual] |
Reimplemented from OpenDDS::DCPS::TransportSendStrategy.
Definition at line 83 of file TcpSendStrategy.cpp.
References DBG_ENTRY_LVL, and OpenDDS::DCPS::TransportSendStrategy::non_blocking_send().
00084 { 00085 DBG_ENTRY_LVL("TcpSendStrategy","send_bytes",6); 00086 return this->non_blocking_send(iov, n, bp); 00087 }
ssize_t OpenDDS::DCPS::TcpSendStrategy::send_bytes_i | ( | const iovec | iov[], | |
int | n | |||
) | [protected, virtual] |
Implements OpenDDS::DCPS::TransportSendStrategy.
Definition at line 101 of file TcpSendStrategy.cpp.
References OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::TcpDataLink::get_connection(), link_, and LM_DEBUG.
00102 { 00103 TcpConnection_rch connection = link_.get_connection(); 00104 00105 if (!connection) 00106 return -1; 00107 ssize_t result = connection->peer().sendv(iov, n); 00108 if (DCPS_debug_level > 4) 00109 ACE_DEBUG((LM_DEBUG, "(%P|%t) TcpSendStrategy::send_bytes_i sent %d bytes \n", result)); 00110 00111 return result; 00112 }
void OpenDDS::DCPS::TcpSendStrategy::stop_i | ( | ) | [protected, virtual] |
Let the subclass stop.
Implements OpenDDS::DCPS::TransportSendStrategy.
Definition at line 126 of file TcpSendStrategy.cpp.
References DBG_ENTRY_LVL.
00127 { 00128 DBG_ENTRY_LVL("TcpSendStrategy","stop_i",6); 00129 }
TcpDataLink& OpenDDS::DCPS::TcpSendStrategy::link_ [private] |
Definition at line 57 of file TcpSendStrategy.h.
Referenced by get_handle(), relink(), and send_bytes_i().
Definition at line 58 of file TcpSendStrategy.h.