本文整理汇总了C++中TcpConnection::getSocketpairPeerId方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpConnection::getSocketpairPeerId方法的具体用法?C++ TcpConnection::getSocketpairPeerId怎么用?C++ TcpConnection::getSocketpairPeerId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TcpConnection
的用法示例。
在下文中一共展示了TcpConnection::getSocketpairPeerId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void dmtcp::ConnectionState::doReconnect(jalib::JSocket& coordinator,
jalib::JSocket& restoreListen)
{
_rewirer.addDataSocket(new jalib::JChunkReader(coordinator,
sizeof(DmtcpMessage)));
_rewirer.addListenSocket(restoreListen);
_rewirer.setCoordinatorFd(coordinator.sockfd());
handleDuplicateFilesInSeparateConnections();
ConnectionList& connections = ConnectionList::instance();
// Here we modify the restore algorithm by splitting it in two parts. In the
// first part we restore all the connection except the PTY_SLAVE types and in
// the second part we restore only PTY_SLAVE connections. This is done to
// make sure that by the time we are trying to restore a PTY_SLAVE
// connection, its corresponding PTY_MASTER connection has already been
// restored.
// UPDATE: We also restore the files for which the we didn't have the lock in
// second iteration along with PTY_SLAVEs
// Part 1: Restore all but Pseudo-terminal slaves and file connection which
// were not checkpointed
ConnectionList::iterator i;
for (i= connections.begin(); i != connections.end(); ++i) {
ConnectionIdentifier id = i->first;
Connection *con = i->second;
JASSERT(_conToFds[id].size() > 0)
.Text("stale connections should be gone by now");
if (con->subType() == FileConnection::FILE_PROCFS) {
continue;
}
if (con->conType() == Connection::TCP) {
TcpConnection *tcpCon =(TcpConnection *) con;
if (tcpCon->peerType() == TcpConnection::PEER_SOCKETPAIR) {
ConnectionIdentifier peerId = tcpCon->getSocketpairPeerId();
TcpConnection *peerCon =
(TcpConnection*) connections.getConnection(peerId);
if (peerCon != NULL) {
tcpCon->restoreSocketPair(_conToFds[id], peerCon, _conToFds[peerId]);
continue;
}
}
}
if (con->restoreInSecondIteration() == false) {
con->restore(_conToFds[id], &_rewirer);
}
}
// Part 2: Restore all Pseudo-terminal slaves and file connections that were
// not checkpointed.
for (i = connections.begin(); i != connections.end(); ++i) {
Connection *con = i->second;
JASSERT(_conToFds[i->first].size() > 0)
.Text("stale connections should be gone by now");
if (con->subType() == FileConnection::FILE_PROCFS) {
continue;
}
if (con->restoreInSecondIteration() == true) {
con->restore(_conToFds[i->first], &_rewirer);
}
}
_rewirer.doReconnect();
}