Active Object managing a queue of reconnecting request. More...
#include <TcpReconnectTask.h>
Public Member Functions | |
TcpReconnectTask (TcpConnection *con) | |
virtual | ~TcpReconnectTask () |
virtual void | execute (ReconnectOpType &op) |
Handle reconnect requests. | |
Private Attributes | |
TcpConnection * | connection_ |
The connection that needs be re-established. |
Active Object managing a queue of reconnecting request.
This task handles request to reconnect to the remotes to avoid the the caller threads (thread to send or reactor thread) block on reconnecting. This reconnect task has lifetime as TcpConnection object. One reconnect task just dedicates to a single connection.
Definition at line 40 of file TcpReconnectTask.h.
OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL OpenDDS::DCPS::TcpReconnectTask::TcpReconnectTask | ( | TcpConnection * | con | ) |
Definition at line 16 of file TcpReconnectTask.cpp.
References ACE_TEXT(), DBG_ENTRY_LVL, LM_ERROR, and OpenDDS::DCPS::QueueTaskBase< ReconnectOpType >::open().
00018 : connection_(connection) 00019 { 00020 DBG_ENTRY_LVL("TcpReconnectTask","TcpReconnectTask",6); 00021 if (open()) { 00022 ACE_ERROR((LM_ERROR, 00023 ACE_TEXT("(%P|%t) ERROR: Reconnect task failed to open : %p\n"), 00024 ACE_TEXT("open"))); 00025 } 00026 }
OpenDDS::DCPS::TcpReconnectTask::~TcpReconnectTask | ( | ) | [virtual] |
Definition at line 28 of file TcpReconnectTask.cpp.
References DBG_ENTRY_LVL.
00029 { 00030 DBG_ENTRY_LVL("TcpReconnectTask","~TcpReconnectTask",6); 00031 }
void OpenDDS::DCPS::TcpReconnectTask::execute | ( | ReconnectOpType & | op | ) | [virtual] |
Handle reconnect requests.
Implements OpenDDS::DCPS::QueueTaskBase< ReconnectOpType >.
Definition at line 33 of file TcpReconnectTask.cpp.
References connection_, DBG_ENTRY_LVL, OpenDDS::DCPS::DO_RECONNECT, LM_ERROR, OpenDDS::DCPS::TcpConnection::reconnect(), SIG_SETMASK, ACE_OS::sigfillset(), sigset_t, OpenDDS::DCPS::TcpConnection::tear_link(), and ACE_OS::thr_sigsetmask().
00034 { 00035 DBG_ENTRY_LVL("TcpReconnectTask","execute",6); 00036 00037 // Ignore all signals to avoid 00038 // ERROR: <something descriptive> Interrupted system call 00039 // The main thread will handle signals. 00040 sigset_t set; 00041 ACE_OS::sigfillset(&set); 00042 ACE_OS::thr_sigsetmask(SIG_SETMASK, &set, NULL); 00043 00044 if (op == DO_RECONNECT) { 00045 if (this->connection_->reconnect() == -1) { 00046 this->connection_->tear_link(); 00047 } 00048 00049 } else 00050 ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: TcpReconnectTask::svc unknown operation %d\n", op)); 00051 }
The connection that needs be re-established.
Definition at line 52 of file TcpReconnectTask.h.
Referenced by execute().