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::DCPS::TcpReconnectTask::TcpReconnectTask(
00015   OpenDDS::DCPS::TcpConnection* connection)
00016   : connection_(connection)
00017 {
00018   DBG_ENTRY_LVL("TcpReconnectTask","TcpReconnectTask",6);
00019 }
00020 
00021 OpenDDS::DCPS::TcpReconnectTask::~TcpReconnectTask()
00022 {
00023   DBG_ENTRY_LVL("TcpReconnectTask","~TcpReconnectTask",6);
00024 }
00025 
00026 void OpenDDS::DCPS::TcpReconnectTask::execute(ReconnectOpType& op)
00027 {
00028   DBG_ENTRY_LVL("TcpReconnectTask","execute",6);
00029 
00030   // Ignore all signals to avoid
00031   //     ERROR: <something descriptive> Interrupted system call
00032   // The main thread will handle signals.
00033   sigset_t set;
00034   ACE_OS::sigfillset(&set);
00035   ACE_OS::thr_sigsetmask(SIG_SETMASK, &set, NULL);
00036 
00037   if (op == DO_RECONNECT) {
00038     if (this->connection_->reconnect() == -1) {
00039       this->connection_->tear_link();
00040     }
00041 
00042   } else
00043     ACE_ERROR((LM_ERROR, "(%P|%t) ERROR: TcpReconnectTask::svc unknown operation %d\n", op));
00044 }

Generated on Fri Feb 12 20:05:27 2016 for OpenDDS by  doxygen 1.4.7