OpenDDS
Snapshot(2023/04/07-19:43)
|
#include <TcpConnection.h>
Public Types | |
enum | ReconnectState { INIT_STATE, LOST_STATE, RECONNECTED_STATE, ACTIVE_RECONNECTING_STATE, ACTIVE_WAITING_STATE, PASSIVE_WAITING_STATE, PASSIVE_TIMEOUT_CALLED_STATE } |
States are used during reconnecting. More... | |
![]() | |
typedef ACE_SOCK_STREAM ::PEER_ADDR | addr_type |
typedef ACE_SOCK_STREAM | stream_type |
![]() | |
typedef long | Reference_Count |
Public Member Functions | |
TcpConnection () | |
Passive side constructor (acceptor) More... | |
TcpConnection (const ACE_INET_Addr &remote_address, Priority priority, const TcpInst_rch &config) | |
Active side constructor (connector) More... | |
virtual | ~TcpConnection () |
std::size_t & | id () |
int | active_open () |
int | active_reconnect_open () |
int | passive_open (void *) |
void | disconnect () |
virtual int | open (void *arg) |
TcpSendStrategy_rch | send_strategy () |
TcpReceiveStrategy_rch | receive_strategy () |
virtual int | handle_input (ACE_HANDLE) |
We pass this "event" along to the receive_strategy. More... | |
virtual int | handle_output (ACE_HANDLE) |
Handle back pressure when sending. More... | |
virtual int | close (u_long) |
virtual int | handle_close (ACE_HANDLE, ACE_Reactor_Mask) |
void | set_sock_options (const TcpInst_rch &tcp_config) |
bool | is_connector () const |
void | transfer (TcpConnection *connection) |
int | handle_timeout (const ACE_Time_Value &tv, const void *arg) |
void | set_datalink (const TcpDataLink_rch &link) |
void | notify_lost_on_backpressure_timeout () |
ACE_INET_Addr | get_remote_address () |
void | relink_from_send (bool do_suspend) |
Reconnect initiated by send strategy. More... | |
void | relink_from_recv (bool do_suspend) |
Reconnect initiated by receive strategy. More... | |
void | tear_link () |
void | shutdown () |
TcpTransport_rch | impl () |
Priority & | transport_priority () |
Access TRANSPORT_PRIORITY.value policy value if set. More... | |
Priority | transport_priority () const |
virtual ACE_Event_Handler::Reference_Count | add_reference () |
virtual ACE_Event_Handler::Reference_Count | remove_reference () |
![]() | |
virtual | ~RcObject () |
virtual void | _add_ref () |
virtual void | _remove_ref () |
long | ref_count () const |
WeakObject * | _get_weak_object () const |
![]() | |
ACE_Svc_Handler (ACE_Thread_Manager *thr_mgr=0, ACE_Message_Queue< ACE_NULL_SYNCH > *mq=0, ACE_Reactor *reactor=ACE_Reactor::instance()) | |
virtual | ~ACE_Svc_Handler (void) |
virtual int | idle (u_long flags=0) |
virtual ACE_Recyclable_State | recycle_state (void) const |
virtual int | recycle_state (ACE_Recyclable_State new_state) |
virtual void | cleanup_hint (void **act_holder=0) |
virtual int | init (int argc, ACE_TCHAR *argv[]) |
virtual int | fini (void) |
virtual int | info (ACE_TCHAR **info_string, size_t length) const |
virtual ACE_HANDLE | get_handle (void) const |
virtual void | set_handle (ACE_HANDLE) |
ACE_SOCK_STREAM & | peer (void) const |
void * | operator new (size_t n) |
void * | operator new (size_t n, void *p) |
virtual void | destroy (void) |
void | operator delete (void *) |
void | operator delete (void *, void *) |
void | shutdown (void) |
void | dump (void) const |
virtual void | recycler (ACE_Connection_Recycling_Strategy *recycler, const void *recycling_act) |
virtual ACE_Connection_Recycling_Strategy * | recycler (void) const |
virtual const void * | recycling_act (void) const |
virtual int | recycle (void *=0) |
![]() | |
ACE_Task (ACE_Thread_Manager *thr_mgr=0, ACE_Message_Queue< ACE_SYNCH_USE, ACE_System_Time_Policy > *mq=0) | |
virtual | ~ACE_Task (void) |
ACE_Message_Queue< ACE_SYNCH_USE, ACE_System_Time_Policy > * | msg_queue (void) |
void | msg_queue (ACE_Message_Queue< ACE_SYNCH_USE, ACE_System_Time_Policy > *) |
ACE_Time_Value_T< ACE_System_Time_Policy > | gettimeofday (void) const |
void | set_time_policy (ACE_System_Time_Policy const &time_policy) |
int | putq (ACE_Message_Block *, ACE_Time_Value *timeout=0) |
int | getq (ACE_Message_Block *&mb, ACE_Time_Value *timeout=0) |
int | ungetq (ACE_Message_Block *, ACE_Time_Value *timeout=0) |
int | reply (ACE_Message_Block *mb, ACE_Time_Value *tv=0) |
int | put_next (ACE_Message_Block *msg, ACE_Time_Value *timeout=0) |
const ACE_TCHAR * | name (void) const |
ACE_Task< ACE_SYNCH_USE, ACE_System_Time_Policy > * | next (void) |
void | next (ACE_Task< ACE_SYNCH_USE, ACE_System_Time_Policy > *) |
ACE_Task< ACE_SYNCH_USE, ACE_System_Time_Policy > * | sibling (void) |
ACE_Module< ACE_SYNCH_USE, ACE_System_Time_Policy > * | module (void) const |
int | flush (u_long flag=ACE_Task_Flags::ACE_FLUSHALL) |
void | water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds, size_t) |
void | dump (void) const |
![]() | |
ACE_Task_Base (ACE_Thread_Manager *=0) | |
virtual | ~ACE_Task_Base (void) |
virtual int | module_closed (void) |
virtual int | put (ACE_Message_Block *, ACE_Time_Value *=0) |
virtual int | svc (void) |
virtual int | activate (long flags=THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, int n_threads=1, int force_active=0, long priority=ACE_DEFAULT_THREAD_PRIORITY, int grp_id=-1, ACE_Task_Base *task=0, ACE_hthread_t thread_handles[]=0, void *stack[]=0, size_t stack_size[]=0, ACE_thread_t thread_ids[]=0, const char *thr_name[]=0) |
virtual int | wait (void) |
virtual int | suspend (void) |
virtual int | resume (void) |
int | grp_id (void) const |
void | grp_id (int) |
ACE_Thread_Manager * | thr_mgr (void) const |
void | thr_mgr (ACE_Thread_Manager *) |
int | is_reader (void) const |
int | is_writer (void) const |
size_t | thr_count (void) const |
ACE_thread_t | last_thread (void) const |
![]() | |
ACE_Service_Object (ACE_Reactor *=0) | |
virtual | ~ACE_Service_Object (void) |
![]() | |
virtual | ~ACE_Event_Handler (void) |
virtual int | priority (void) const |
virtual void | priority (int priority) |
virtual int | handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE) |
virtual int | handle_exit (ACE_Process *) |
virtual int | handle_signal (int signum, siginfo_t *=0, ucontext_t *=0) |
virtual int | resume_handler (void) |
virtual int | handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE) |
virtual int | handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE) |
virtual void | reactor (ACE_Reactor *reactor) |
virtual ACE_Reactor * | reactor (void) const |
virtual ACE_Reactor_Timer_Interface * | reactor_timer_interface (void) const |
Reference_Counting_Policy & | reference_counting_policy (void) |
![]() | |
ACE_Shared_Object (void) | |
virtual | ~ACE_Shared_Object (void) |
Private Types | |
typedef ACE_SYNCH_MUTEX | LockType |
typedef ACE_Guard< LockType > | GuardType |
Private Member Functions | |
int | on_active_connection_established () |
Handle the logic after an active connection has been established. More... | |
void | active_reconnect_i () |
void | passive_reconnect_i () |
void | notify_connection_lost () |
void | handle_stop_reconnecting () |
int | handle_setup_input (ACE_HANDLE h) |
const std::string & | config_name () const |
const char * | reconnect_state_string () const |
Get name of the current reconnect state as a string. More... | |
Private Attributes | |
LockType | reconnect_lock_ |
Lock to synchronize state between reactor and non-reactor threads. More... | |
bool | is_connector_ |
Flag indicate this connection object is the connector or acceptor. More... | |
ACE_INET_Addr | remote_address_ |
Remote address. More... | |
ACE_INET_Addr | local_address_ |
Local address. More... | |
WeakRcHandle< TcpInst > | tcp_config_ |
The configuration used by this connection. More... | |
TcpDataLink_rch | link_ |
Datalink object which is needed for connection lost callback. More... | |
TcpTransport_rch | impl_ |
Impl object which is needed for connection objects and reconnect task. More... | |
ReconnectState | reconnect_state_ |
The state indicates each step of the reconnecting. More... | |
Priority | transport_priority_ |
TRANSPORT_PRIORITY.value policy value. More... | |
bool | shutdown_ |
shutdown flag More... | |
bool | passive_setup_ |
ACE_Message_Block | passive_setup_buffer_ |
TcpTransport * | transport_during_setup_ |
std::size_t | id_ |
Small unique identifying value. More... | |
int | conn_retry_counter_ |
Definition at line 37 of file TcpConnection.h.
|
private |
Definition at line 156 of file TcpConnection.h.
|
private |
Definition at line 155 of file TcpConnection.h.
States are used during reconnecting.
Enumerator | |
---|---|
INIT_STATE | |
LOST_STATE | |
RECONNECTED_STATE | |
ACTIVE_RECONNECTING_STATE | |
ACTIVE_WAITING_STATE | |
PASSIVE_WAITING_STATE | |
PASSIVE_TIMEOUT_CALLED_STATE |
Definition at line 43 of file TcpConnection.h.
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TcpConnection::TcpConnection | ( | ) |
Passive side constructor (acceptor)
Definition at line 35 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, ACE_Event_Handler::Reference_Counting_Policy::ENABLED, ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler::Reference_Counting_Policy::value().
OpenDDS::DCPS::TcpConnection::TcpConnection | ( | const ACE_INET_Addr & | remote_address, |
Priority | priority, | ||
const TcpInst_rch & | config | ||
) |
Active side constructor (connector)
Definition at line 51 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, ACE_Event_Handler::Reference_Counting_Policy::ENABLED, ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler::Reference_Counting_Policy::value().
|
virtual |
int OpenDDS::DCPS::TcpConnection::active_open | ( | ) |
Protocol setup (handshake) on the active side. The local address is sent to the remote (passive) side to identify ourselves to the remote side.
Definition at line 131 of file TcpConnection.cpp.
References OpenDDS::DCPS::TcpTransport::async_connect_failed(), OpenDDS::DCPS::TcpTransport::connect_tcp_datalink(), OpenDDS::DCPS::dynamic_rchandle_cast(), OpenDDS::DCPS::DataLink::impl(), link_, LM_DEBUG, local_address_, on_active_connection_established(), OpenDDS::DCPS::rchandle_from(), remote_address_, transport_priority_, VDBG, and VDBG_LVL.
Referenced by open().
|
private |
Definition at line 597 of file TcpConnection.cpp.
References ACE_DEBUG, ACE_ERROR, ACTIVE_RECONNECTING_STATE, ACTIVE_WAITING_STATE, ACE_Synch_Options::asynch, conn_retry_counter_, ACE_Connector< class, class >::connect(), OpenDDS::DCPS::TcpTransport::connector_, DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::DataLink::DISCONNECTED, OpenDDS::DCPS::dynamic_rchandle_cast(), EALREADY, EWOULDBLOCK, handle_stop_reconnecting(), OpenDDS::DCPS::DataLink::impl(), OpenDDS::DCPS::TcpDataLink::is_release_pending(), link_, LM_DEBUG, LM_ERROR, local_address_, ACE_Time_Value::msec(), OpenDDS::DCPS::DataLink::notify(), ACE_Event_Handler::reactor(), reconnect_lock_, reconnect_state_, reconnect_state_string(), remote_address_, ACE_Reactor::schedule_timer(), ACE_Time_Value::sec(), shutdown_, and tcp_config_.
Referenced by handle_close(), handle_timeout(), and impl().
int OpenDDS::DCPS::TcpConnection::active_reconnect_open | ( | ) |
Definition at line 964 of file TcpConnection.cpp.
References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), config_name(), conn_retry_counter_, DBG_ENTRY_LVL, link_, LM_DEBUG, LM_ERROR, OpenDDS::DCPS::DataLink::notify(), on_active_connection_established(), OPENDDS_END_VERSIONED_NAMESPACE_DECL, ACE_Event_Handler::reactor(), ACE_Event_Handler::READ_MASK, reconnect_lock_, reconnect_state_, OpenDDS::DCPS::DataLink::RECONNECTED, RECONNECTED_STATE, ACE_Reactor::register_handler(), remote_address_, send_strategy(), and shutdown_.
Referenced by open().
|
virtual |
Reimplemented from ACE_Event_Handler.
Definition at line 924 of file TcpConnection.cpp.
References OpenDDS::DCPS::RcObject::_add_ref().
Referenced by impl().
|
virtual |
Reimplemented from ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >.
Definition at line 339 of file TcpConnection.cpp.
References ACE_DEBUG, ACTIVE_RECONNECTING_STATE, ACTIVE_WAITING_STATE, ACE_Connector< class, class >::close(), config_name(), conn_retry_counter_, OpenDDS::DCPS::TcpTransport::connector_, DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, disconnect(), OpenDDS::DCPS::dynamic_rchandle_cast(), handle_stop_reconnecting(), OpenDDS::DCPS::DataLink::impl(), link_, LM_DEBUG, reconnect_state_, reconnect_state_string(), remote_address_, send_strategy(), and tcp_config_.
|
private |
Definition at line 376 of file TcpConnection.cpp.
References tcp_config_.
Referenced by active_reconnect_open(), close(), handle_close(), handle_stop_reconnecting(), handle_timeout(), and impl().
void OpenDDS::DCPS::TcpConnection::disconnect | ( | void | ) |
This will be called by the DataLink (that "owns" us) when the TcpTransport has been told to shutdown(), or when the DataLink finds itself no longer needed, and is "self-releasing".
Definition at line 105 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, OpenDDS::DCPS::TcpDataLink::drop_pending_request_acks(), link_, and ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >::peer().
Referenced by close(), handle_close(), and notify_lost_on_backpressure_timeout().
ACE_INLINE ACE_INET_Addr OpenDDS::DCPS::TcpConnection::get_remote_address | ( | ) |
Definition at line 35 of file TcpConnection.inl.
References ACE_INLINE, and remote_address_.
|
virtual |
Reimplemented from ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >.
Definition at line 384 of file TcpConnection.cpp.
References ACE_DEBUG, active_reconnect_i(), config_name(), DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, disconnect(), OpenDDS::DCPS::DataLink::DISCONNECTED, is_connector_, link_, LM_DEBUG, OpenDDS::DCPS::DataLink::notify(), passive_reconnect_i(), OpenDDS::DCPS::TcpDataLink::receive_strategy(), receive_strategy(), reconnect_lock_, reconnect_state_string(), remote_address_, OpenDDS::DCPS::TcpDataLink::send_strategy(), send_strategy(), and TheServiceParticipant.
|
virtual |
We pass this "event" along to the receive_strategy.
Reimplemented from ACE_Event_Handler.
Definition at line 291 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, handle_setup_input(), passive_setup_, receive_strategy(), and TheServiceParticipant.
|
virtual |
Handle back pressure when sending.
Reimplemented from ACE_Event_Handler.
Definition at line 309 of file TcpConnection.cpp.
References ACE_DEBUG, ACE_TEXT(), DBG_ENTRY_LVL, OpenDDS::DCPS::DCPS_debug_level, id_, LM_DEBUG, send_strategy(), TheServiceParticipant, and OpenDDS::DCPS::ThreadSynchWorker::WORK_OUTCOME_MORE_TO_DO.
|
private |
During the connection setup phase, the passive side sets passive_setup_, redirecting handle_input() events here (there is no recv strategy yet).
Definition at line 221 of file TcpConnection.cpp.
References ACE_Message_Block::base(), OpenDDS::DCPS::DCPS_debug_level, ACE_Event_Handler::DONT_CALL, ETIME, ACE_Message_Block::length(), LM_DEBUG, local_address_, ACE_OS::memcpy(), OpenDDS::DCPS::TcpTransport::passive_connection(), passive_setup_, passive_setup_buffer_, ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >::peer(), OpenDDS::DCPS::rchandle_from(), ACE_Message_Block::rd_ptr(), ACE_Event_Handler::reactor(), ACE_Event_Handler::READ_MASK, reconnect_state_string(), remote_address_, ACE_Message_Block::reset(), ACE_Message_Block::size(), ACE_Message_Block::space(), transport_during_setup_, transport_priority_, VDBG, VDBG_LVL, ACE_Message_Block::wr_ptr(), and ACE_Time_Value::zero.
Referenced by handle_input(), and impl().
|
private |
Definition at line 685 of file TcpConnection.cpp.
References ACE_DEBUG, config_name(), LM_DEBUG, LOST_STATE, notify_connection_lost(), reconnect_state_, remote_address_, and tcp_config_.
Referenced by active_reconnect_i(), close(), and impl().
|
virtual |
A timer is scheduled on acceptor side to check if a new connection is accepted after the connection is lost.
Reimplemented from ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >.
Definition at line 702 of file TcpConnection.cpp.
References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), active_reconnect_i(), ACTIVE_RECONNECTING_STATE, ACTIVE_WAITING_STATE, OpenDDS::DCPS::TcpTransport::async_connect_failed(), ACE_Connector< class, class >::cancel(), config_name(), OpenDDS::DCPS::TcpTransport::connector_, DBG_ENTRY_LVL, OpenDDS::DCPS::dynamic_rchandle_cast(), OpenDDS::DCPS::DataLink::impl(), INIT_STATE, link_, LM_DEBUG, LM_ERROR, local_address_, LOST_STATE, notify_connection_lost(), PASSIVE_TIMEOUT_CALLED_STATE, PASSIVE_WAITING_STATE, reconnect_lock_, reconnect_state_, reconnect_state_string(), RECONNECTED_STATE, remote_address_, tear_link(), TheServiceParticipant, and transport_priority_.
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE std::size_t & OpenDDS::DCPS::TcpConnection::id | ( | void | ) |
Definition at line 22 of file TcpConnection.inl.
References ACE_INLINE, and id_.
|
inline |
Definition at line 127 of file TcpConnection.h.
References active_reconnect_i(), add_reference(), config_name(), handle_setup_input(), handle_stop_reconnecting(), impl_, notify_connection_lost(), on_active_connection_established(), OPENDDS_POOL_ALLOCATION_FWD, passive_reconnect_i(), remove_reference(), and transport_priority().
ACE_INLINE bool OpenDDS::DCPS::TcpConnection::is_connector | ( | ) | const |
Return true if the object represents the connector side, otherwise it's the acceptor side. The acceptor/connector role is not changed when re-establishing the connection.
Definition at line 29 of file TcpConnection.inl.
References ACE_INLINE, and is_connector_.
|
private |
Definition at line 672 of file TcpConnection.cpp.
References OpenDDS::DCPS::TcpDataLink::drop_pending_request_acks(), link_, OpenDDS::DCPS::DataLink::LOST, OpenDDS::DCPS::DataLink::notify(), OpenDDS::DCPS::TcpDataLink::send_strategy(), and send_strategy().
Referenced by handle_stop_reconnecting(), handle_timeout(), impl(), and notify_lost_on_backpressure_timeout().
void OpenDDS::DCPS::TcpConnection::notify_lost_on_backpressure_timeout | ( | ) |
This function is called when the backpressure occurs and timed out after "max_output_pause_period". The lost connection notification should be sent and the connection needs be closed since we declared it as a "lost" connection.
Definition at line 857 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, disconnect(), INIT_STATE, LOST_STATE, notify_connection_lost(), reconnect_lock_, and reconnect_state_.
|
private |
Handle the logic after an active connection has been established.
Definition at line 482 of file TcpConnection.cpp.
References ACE_DEBUG, ACE_ERROR, OpenDDS::DCPS::DirectPriorityMapper::codepoint(), OpenDDS::DCPS::DCPS_debug_level, link_, LM_DEBUG, LM_NOTICE, LM_WARNING, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >::peer(), send_n(), OpenDDS::DCPS::DataLink::set_dscp_codepoint(), set_sock_options(), tcp_config_, and transport_priority_.
Referenced by active_open(), active_reconnect_open(), and impl().
|
virtual |
Reimplemented from ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >.
Definition at line 117 of file TcpConnection.cpp.
References active_open(), active_reconnect_open(), ACTIVE_RECONNECTING_STATE, DBG_ENTRY_LVL, is_connector_, passive_open(), and reconnect_state_.
int OpenDDS::DCPS::TcpConnection::passive_open | ( | void * | arg | ) |
Definition at line 153 of file TcpConnection.cpp.
References ACE_ERROR, ACE_ERROR_RETURN, ACE_TEXT(), ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >::get_handle(), LM_DEBUG, LM_ERROR, LM_NOTICE, local_address_, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, passive_setup_, passive_setup_buffer_, ACE_Event_Handler::reactor(), ACE_Event_Handler::READ_MASK, set_sock_options(), ACE_Message_Block::size(), tcp_config_, OpenDDS::DCPS::TcpAcceptor::transport(), transport_during_setup_, and VDBG_LVL.
Referenced by open().
|
private |
Definition at line 558 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, OpenDDS::DCPS::DataLink::DISCONNECTED, OpenDDS::DCPS::TimeDuration::from_msec(), INIT_STATE, link_, OpenDDS::DCPS::DataLink::notify(), PASSIVE_WAITING_STATE, ACE_Event_Handler::reactor(), reconnect_state_, ACE_Reactor::schedule_timer(), shutdown_, tcp_config_, OpenDDS::DCPS::TimeDuration::value(), and OpenDDS::DCPS::TimeDuration::zero_value.
Referenced by handle_close(), and impl().
OpenDDS::DCPS::TcpReceiveStrategy_rch OpenDDS::DCPS::TcpConnection::receive_strategy | ( | ) |
Definition at line 99 of file TcpConnection.cpp.
References link_, and OpenDDS::DCPS::TcpDataLink::receive_strategy().
Referenced by handle_close(), and handle_input().
|
private |
Get name of the current reconnect state as a string.
Definition at line 937 of file TcpConnection.cpp.
References ACE_ERROR, ACE_TEXT(), ACTIVE_RECONNECTING_STATE, ACTIVE_WAITING_STATE, INIT_STATE, LM_ERROR, LOST_STATE, PASSIVE_TIMEOUT_CALLED_STATE, PASSIVE_WAITING_STATE, reconnect_state_, and RECONNECTED_STATE.
Referenced by active_reconnect_i(), close(), handle_close(), handle_setup_input(), and handle_timeout().
void OpenDDS::DCPS::TcpConnection::relink_from_recv | ( | bool | do_suspend | ) |
Reconnect initiated by receive strategy.
This is called by TcpReceiveStrategy when a disconnect is detected. It simply suspends any sends and lets the handle_close() handle the reconnect logic.
Definition at line 896 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, and send_strategy().
void OpenDDS::DCPS::TcpConnection::relink_from_send | ( | bool | do_suspend | ) |
Reconnect initiated by send strategy.
This is called by TcpSendStrategy when a send fails and a reconnect should be initiated. This method suspends any sends and kicks the reconnect thread into action.
Definition at line 883 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, and send_strategy().
|
virtual |
Reimplemented from ACE_Event_Handler.
Definition at line 931 of file TcpConnection.cpp.
References OpenDDS::DCPS::RcObject::_remove_ref().
Referenced by impl().
OpenDDS::DCPS::TcpSendStrategy_rch OpenDDS::DCPS::TcpConnection::send_strategy | ( | ) |
Definition at line 93 of file TcpConnection.cpp.
References link_, and OpenDDS::DCPS::TcpDataLink::send_strategy().
Referenced by active_reconnect_open(), close(), handle_close(), handle_output(), notify_connection_lost(), relink_from_recv(), and relink_from_send().
void OpenDDS::DCPS::TcpConnection::set_datalink | ( | const TcpDataLink_rch & | link | ) |
Cache the reference to the datalink object for lost connection callbacks.
Definition at line 77 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, OpenDDS::DCPS::dynamic_rchandle_cast(), OpenDDS::DCPS::DataLink::impl(), impl_, link_, reconnect_lock_, and OpenDDS::DCPS::RcHandle< T >::reset().
void OpenDDS::DCPS::TcpConnection::set_sock_options | ( | const TcpInst_rch & | tcp_config | ) |
Definition at line 432 of file TcpConnection.cpp.
References ACE_DEFAULT_MAX_SOCKET_BUFSIZ, ACE_ERROR, ENOTSUP, IPPROTO_TCP, LM_ERROR, ACE_Svc_Handler< ACE_SOCK_STREAM, ACE_NULL_SYNCH >::peer(), SO_RCVBUF, SO_SNDBUF, SOL_SOCKET, and TCP_NODELAY.
Referenced by on_active_connection_established(), and passive_open().
void OpenDDS::DCPS::TcpConnection::shutdown | ( | void | ) |
Definition at line 913 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, reconnect_lock_, ACE_Svc_Handler< PEER_STREAM, SYNCH_TRAITS >::shutdown(), and shutdown_.
Referenced by ~TcpConnection().
void OpenDDS::DCPS::TcpConnection::tear_link | ( | ) |
Called by the reconnect task to inform us that the link & any associated data can be torn down. This call is done with no DCPS/transport locks held.
Definition at line 905 of file TcpConnection.cpp.
References DBG_ENTRY_LVL, link_, and OpenDDS::DCPS::DataLink::release_resources().
Referenced by handle_timeout().
void OpenDDS::DCPS::TcpConnection::transfer | ( | TcpConnection * | connection | ) |
This object would be "old" connection object and the provided is the new connection object. The "old" connection object will copy its states to to the "new" connection object. This is called by the TcpDataLink when a new connection is accepted (with a new TcpConnection object). We need make the state in "new" connection object consistent with the "old" connection object.
Definition at line 782 of file TcpConnection.cpp.
References ACE_ERROR, ACE_TEXT(), DBG_ENTRY_LVL, impl_, INIT_STATE, is_connector_, link_, LM_DEBUG, LM_ERROR, local_address_, LOST_STATE, OpenDDS::DCPS::DataLink::notify(), PASSIVE_TIMEOUT_CALLED_STATE, PASSIVE_WAITING_STATE, reconnect_lock_, reconnect_state_, OpenDDS::DCPS::DataLink::RECONNECTED, RECONNECTED_STATE, remote_address_, shutdown_, tcp_config_, and VDBG.
ACE_INLINE OpenDDS::DCPS::Priority & OpenDDS::DCPS::TcpConnection::transport_priority | ( | ) |
Access TRANSPORT_PRIORITY.value policy value if set.
Definition at line 42 of file TcpConnection.inl.
References ACE_INLINE, and transport_priority_.
Referenced by impl().
ACE_INLINE OpenDDS::DCPS::Priority OpenDDS::DCPS::TcpConnection::transport_priority | ( | ) | const |
Definition at line 49 of file TcpConnection.inl.
References OPENDDS_END_VERSIONED_NAMESPACE_DECL, and transport_priority_.
|
private |
Definition at line 194 of file TcpConnection.h.
Referenced by active_reconnect_i(), active_reconnect_open(), and close().
|
private |
Small unique identifying value.
Definition at line 193 of file TcpConnection.h.
Referenced by handle_output(), and id().
|
private |
Impl object which is needed for connection objects and reconnect task.
Definition at line 177 of file TcpConnection.h.
Referenced by impl(), set_datalink(), and transfer().
|
private |
Flag indicate this connection object is the connector or acceptor.
Definition at line 162 of file TcpConnection.h.
Referenced by handle_close(), is_connector(), open(), and transfer().
|
private |
Datalink object which is needed for connection lost callback.
Definition at line 174 of file TcpConnection.h.
Referenced by active_open(), active_reconnect_i(), active_reconnect_open(), close(), disconnect(), handle_close(), handle_timeout(), notify_connection_lost(), on_active_connection_established(), passive_reconnect_i(), receive_strategy(), send_strategy(), set_datalink(), tear_link(), and transfer().
|
private |
Local address.
Definition at line 168 of file TcpConnection.h.
Referenced by active_open(), active_reconnect_i(), handle_setup_input(), handle_timeout(), passive_open(), and transfer().
|
private |
Definition at line 188 of file TcpConnection.h.
Referenced by handle_input(), handle_setup_input(), and passive_open().
|
private |
Definition at line 189 of file TcpConnection.h.
Referenced by handle_setup_input(), and passive_open().
|
private |
Lock to synchronize state between reactor and non-reactor threads.
Definition at line 159 of file TcpConnection.h.
Referenced by active_reconnect_i(), active_reconnect_open(), handle_close(), handle_timeout(), notify_lost_on_backpressure_timeout(), set_datalink(), shutdown(), and transfer().
|
private |
The state indicates each step of the reconnecting.
Definition at line 180 of file TcpConnection.h.
Referenced by active_reconnect_i(), active_reconnect_open(), close(), handle_stop_reconnecting(), handle_timeout(), notify_lost_on_backpressure_timeout(), open(), passive_reconnect_i(), reconnect_state_string(), and transfer().
|
private |
Remote address.
Definition at line 165 of file TcpConnection.h.
Referenced by active_open(), active_reconnect_i(), active_reconnect_open(), close(), get_remote_address(), handle_close(), handle_setup_input(), handle_stop_reconnecting(), handle_timeout(), and transfer().
|
private |
shutdown flag
Definition at line 186 of file TcpConnection.h.
Referenced by active_reconnect_i(), active_reconnect_open(), passive_reconnect_i(), shutdown(), and transfer().
|
private |
The configuration used by this connection.
Definition at line 171 of file TcpConnection.h.
Referenced by active_reconnect_i(), close(), config_name(), handle_stop_reconnecting(), on_active_connection_established(), passive_open(), passive_reconnect_i(), and transfer().
|
private |
Definition at line 190 of file TcpConnection.h.
Referenced by handle_setup_input(), and passive_open().
|
private |
TRANSPORT_PRIORITY.value policy value.
Definition at line 183 of file TcpConnection.h.
Referenced by active_open(), handle_setup_input(), handle_timeout(), on_active_connection_established(), and transport_priority().