当前位置: 首页>>代码示例>>C++>>正文


C++ StellarMessage::hello方法代码示例

本文整理汇总了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);
}
开发者ID:madtomic,项目名称:stellar-core,代码行数:14,代码来源:Peer.cpp

示例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);
}
开发者ID:datachand,项目名称:stellar-core,代码行数:16,代码来源:Peer.cpp

示例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();
}
开发者ID:irisli,项目名称:stellar-core,代码行数:17,代码来源:Peer.cpp

示例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;
}
开发者ID:datachand,项目名称:stellar-core,代码行数:29,代码来源:Peer.cpp

示例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;
}
开发者ID:Haidashenko,项目名称:stellar-core,代码行数:33,代码来源:Peer.cpp

示例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;

//.........这里部分代码省略.........
开发者ID:StellarCN,项目名称:stellar-core,代码行数:101,代码来源:Peer.cpp


注:本文中的StellarMessage::hello方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。