TcpReconnectTask.cpp

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #include "Tcp_pch.h"
00009 #include "TcpReconnectTask.h"
00010 #include "TcpConnection.h"
00011 #include "TcpSendStrategy.h"
00012 #include "dds/DCPS/transport/framework/EntryExit.h"
00013 
00014 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00015 
00016 OpenDDS::DCPS::TcpReconnectTask::TcpReconnectTask(
00017   OpenDDS::DCPS::TcpConnection* connection)
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 }
00027 
00028 OpenDDS::DCPS::TcpReconnectTask::~TcpReconnectTask()
00029 {
00030   DBG_ENTRY_LVL("TcpReconnectTask","~TcpReconnectTask",6);
00031 }
00032 
00033 void OpenDDS::DCPS::TcpReconnectTask::execute(ReconnectOpType& op)
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 }
00052 
00053 OPENDDS_END_VERSIONED_NAMESPACE_DECL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1