本文整理汇总了C++中StellarMessage::hello方法的典型用法代码示例。如果您正苦于以下问题:C++ StellarMessage::hello方法的具体用法?C++ StellarMessage::hello怎么用?C++ StellarMessage::hello使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StellarMessage
的用法示例。
在下文中一共展示了StellarMessage::hello方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CLOG
void
Peer::sendHello()
{
CLOG(DEBUG,"Overlay") << "Peer::sendHello to " << toString();
StellarMessage msg;
msg.type(HELLO);
msg.hello().protocolVersion = mApp.getConfig().PROTOCOL_VERSION;
msg.hello().versionStr = mApp.getConfig().VERSION_STR;
msg.hello().listeningPort = mApp.getConfig().PEER_PORT;
msg.hello().peerID = mApp.getConfig().PEER_PUBLIC_KEY;
sendMessage(msg);
}
示例2: LOG
void
Peer::sendHello()
{
LOG(DEBUG) << "Peer::sendHello "
<< "@" << mApp.getConfig().PEER_PORT << " to "
<< mRemoteListeningPort;
StellarMessage msg;
msg.type(HELLO);
msg.hello().protocolVersion = mApp.getConfig().PROTOCOL_VERSION;
msg.hello().versionStr = mApp.getConfig().VERSION_STR;
msg.hello().listeningPort = mApp.getConfig().PEER_PORT;
msg.hello().peerID = mApp.getConfig().PEER_PUBLIC_KEY;
sendMessage(msg);
}
示例3: CLOG
void
Peer::sendHello()
{
CLOG(DEBUG, "Overlay") << "Peer::sendHello to " << toString();
StellarMessage msg;
msg.type(HELLO);
msg.hello().ledgerVersion = mApp.getConfig().LEDGER_PROTOCOL_VERSION;
msg.hello().overlayVersion = mApp.getConfig().OVERLAY_PROTOCOL_VERSION;
msg.hello().versionStr = mApp.getConfig().VERSION_STR;
msg.hello().networkID = mApp.getNetworkID();
msg.hello().listeningPort = mApp.getConfig().PEER_PORT;
msg.hello().peerID = mApp.getConfig().NODE_SEED.getPublicKey();
msg.hello().cert = this->getAuthCert();
msg.hello().nonce = mSendNonce;
sendMessage(msg);
mSendHelloMeter.Mark();
}
示例4: CLOG
bool
Peer::recvHello(StellarMessage const& msg)
{
if (msg.hello().peerID == mApp.getConfig().PEER_PUBLIC_KEY)
{
CLOG(DEBUG, "Overlay") << "connecting to self";
drop();
return false;
}
mRemoteProtocolVersion = msg.hello().protocolVersion;
mRemoteVersion = msg.hello().versionStr;
if (msg.hello().listeningPort <= 0 ||
msg.hello().listeningPort > UINT16_MAX)
{
CLOG(DEBUG, "Overlay") << "bad port in recvHello";
drop();
return false;
}
mRemoteListeningPort =
static_cast<unsigned short>(msg.hello().listeningPort);
CLOG(INFO, "Overlay") << "recvHello "
<< "@" << mApp.getConfig().PEER_PORT
<< " from: " << mRemoteProtocolVersion << " "
<< mRemoteVersion << " " << mRemoteListeningPort;
mState = GOT_HELLO;
mPeerID = msg.hello().peerID;
return true;
}
示例5: pr
bool
Peer::recvHello(StellarMessage const& msg)
{
if (msg.hello().peerID == mApp.getConfig().PEER_PUBLIC_KEY)
{
CLOG(DEBUG, "Overlay") << "connecting to self";
drop();
return false;
}
mRemoteOverlayVersion = msg.hello().overlayVersion;
mRemoteVersion = msg.hello().versionStr;
if (msg.hello().listeningPort <= 0 ||
msg.hello().listeningPort > UINT16_MAX)
{
CLOG(DEBUG, "Overlay") << "bad port in recvHello";
drop();
return false;
}
mRemoteListeningPort =
static_cast<unsigned short>(msg.hello().listeningPort);
CLOG(DEBUG, "Overlay") << "recvHello from " << toString();
mState = GOT_HELLO;
mPeerID = msg.hello().peerID;
if (mRole == INITIATOR)
{
PeerRecord pr(getIP(), mRemoteListeningPort, mApp.getClock().now(), 0,
1);
pr.insertIfNew(mApp.getDatabase());
}
return true;
}
示例6: CLOG
void
Peer::recvMessage(StellarMessage const& stellarMsg)
{
if (shouldAbort())
{
return;
}
CLOG(TRACE, "Overlay") << "("
<< mApp.getConfig().toShortString(
mApp.getConfig().NODE_SEED.getPublicKey())
<< ") recv: " << stellarMsg.type() << " from:"
<< mApp.getConfig().toShortString(mPeerID);
if (!isAuthenticated() && (stellarMsg.type() != HELLO) &&
(stellarMsg.type() != HELLO2) && (stellarMsg.type() != AUTH) &&
(stellarMsg.type() != ERROR_MSG))
{
CLOG(WARNING, "Overlay") << "recv: " << stellarMsg.type()
<< " before completed handshake";
mDropInRecvMessageUnauthMeter.Mark();
drop();
return;
}
assert(isAuthenticated() || stellarMsg.type() == HELLO ||
stellarMsg.type() == HELLO2 || stellarMsg.type() == AUTH ||
stellarMsg.type() == ERROR_MSG);
switch (stellarMsg.type())
{
case ERROR_MSG:
{
auto t = mRecvErrorTimer.TimeScope();
recvError(stellarMsg);
}
break;
case HELLO:
{
auto t = mRecvHelloTimer.TimeScope();
this->recvHello(stellarMsg.hello());
}
break;
case HELLO2:
{
auto t = mRecvHelloTimer.TimeScope();
this->recvHello2(stellarMsg.hello2());
}
break;
case AUTH:
{
auto t = mRecvAuthTimer.TimeScope();
this->recvAuth(stellarMsg);
}
break;
case DONT_HAVE:
{
auto t = mRecvDontHaveTimer.TimeScope();
recvDontHave(stellarMsg);
}
break;
case GET_PEERS:
{
auto t = mRecvGetPeersTimer.TimeScope();
recvGetPeers(stellarMsg);
}
break;
case PEERS:
{
auto t = mRecvPeersTimer.TimeScope();
recvPeers(stellarMsg);
}
break;
case GET_TX_SET:
{
auto t = mRecvGetTxSetTimer.TimeScope();
recvGetTxSet(stellarMsg);
}
break;
case TX_SET:
{
auto t = mRecvTxSetTimer.TimeScope();
recvTxSet(stellarMsg);
}
break;
case TRANSACTION:
{
auto t = mRecvTransactionTimer.TimeScope();
recvTransaction(stellarMsg);
}
break;
//.........这里部分代码省略.........