本文整理汇总了C++中TcpConnection::tcpType方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpConnection::tcpType方法的具体用法?C++ TcpConnection::tcpType怎么用?C++ TcpConnection::tcpType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TcpConnection
的用法示例。
在下文中一共展示了TcpConnection::tcpType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: waitForCoordinatorMsg
bool dmtcp::DmtcpWorker::waitForStage2bCheckpoint()
{
waitForCoordinatorMsg ( "PEER_LOOKUP", DMT_DO_PEER_LOOKUP );
JTRACE ( "Looking up Socket Peers..." );
theTcpConnections.clear();
theCheckpointState->preCheckpointPeerLookup(theTcpConnections);
sendPeerLookupRequest(theTcpConnections);
JTRACE ( "Done Socket Peer Lookup" );
WorkerState::setCurrentState ( WorkerState::PEER_LOOKUP_COMPLETE );
{
dmtcp::DmtcpMessage msg;
msg.type = DMT_OK;
msg.state = WorkerState::currentState();
_coordinatorSocket << msg;
JTRACE ( "waiting for DRAIN/RESUME message" );
do {
msg.poison();
_coordinatorSocket >> msg;
msg.assertValid();
if ( msg.type == DMT_KILL_PEER ) {
JTRACE ( "Received KILL message from coordinator, exiting" );
_exit ( 0 );
}
JTRACE ( "received message" ) (msg.type );
if ( msg.type != DMT_UNKNOWN_PEER )
break;
JTRACE ("received DMT_UNKNOWN_PEER message") (msg.conId);
TcpConnection* con =
(TcpConnection*) &( ConnectionList::instance() [msg.conId] );
con->markExternal();
externalTcpConnections.push_back(msg.conId);
_waitingForExternalSocketsToClose = true;
} while ( msg.type == DMT_UNKNOWN_PEER );
JASSERT ( msg.type == DMT_DO_DRAIN || msg.type == DMT_DO_RESUME )
( msg.type );
ConnectionList& connections = ConnectionList::instance();
// Tcp Accept and Connect connection with PeerType UNKNOWN should be marked as INTERNAL
for ( ConnectionList::iterator i = connections.begin()
; i!= connections.end()
; ++i )
{
Connection* con = i->second;
if ( con->conType() == Connection::TCP ) {
TcpConnection* tcpCon = (TcpConnection *) con;
if ( (tcpCon->tcpType() == TcpConnection::TCP_ACCEPT ||
tcpCon->tcpType() == TcpConnection::TCP_CONNECT) &&
tcpCon->peerType() == TcpConnection::PEER_UNKNOWN )
tcpCon->markInternal();
}
}
if ( msg.type == DMT_DO_RESUME ) {
JTRACE ( "Peer Lookup not complete, skipping checkpointing \n\n\n\n\n");
return false;
}
JASSERT (msg.type == DMT_DO_DRAIN);
}
}