MCPcopy Create free account
hub / github.com/ElementsProject/elements / CNode

Method CNode

src/net.cpp:3027–3057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3025unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; }
3026
3027CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, std::shared_ptr<Sock> sock, const CAddress& addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress& addrBindIn, const std::string& addrNameIn, ConnectionType conn_type_in, bool inbound_onion)
3028 : m_sock{sock},
3029 m_connected{GetTime<std::chrono::seconds>()},
3030 addr(addrIn),
3031 addrBind(addrBindIn),
3032 m_addr_name{addrNameIn.empty() ? addr.ToStringIPPort() : addrNameIn},
3033 m_inbound_onion(inbound_onion),
3034 nKeyedNetGroup(nKeyedNetGroupIn),
3035 id(idIn),
3036 nLocalHostNonce(nLocalHostNonceIn),
3037 m_conn_type(conn_type_in),
3038 nLocalServices(nLocalServicesIn)
3039{
3040 if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND);
3041 if (conn_type_in != ConnectionType::BLOCK_RELAY) {
3042 m_tx_relay = std::make_unique<TxRelay>();
3043 }
3044
3045 for (const std::string &msg : getAllNetMessageTypes())
3046 mapRecvBytesPerMsgCmd[msg] = 0;
3047 mapRecvBytesPerMsgCmd[NET_MESSAGE_COMMAND_OTHER] = 0;
3048
3049 if (fLogIPs) {
3050 LogPrint(BCLog::NET, "Added connection to %s peer=%d\n", m_addr_name, id);
3051 } else {
3052 LogPrint(BCLog::NET, "Added connection peer=%d\n", id);
3053 }
3054
3055 m_deserializer = std::make_unique<V1TransportDeserializer>(V1TransportDeserializer(Params(), id, SER_NETWORK, INIT_PROTO_VERSION));
3056 m_serializer = std::make_unique<V1TransportSerializer>(V1TransportSerializer());
3057}
3058
3059bool CConnman::NodeFullyConnected(const CNode* pnode)
3060{

Callers

nothing calls this directly

Calls 5

ToStringIPPortMethod · 0.80
ParamsClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected