Esempio n. 1
0
        private void writeHandshake(P2pMessage message)
        {
            CORE_SYNC_DATA coreSync = new CORE_SYNC_DATA();

            LevinProtocol.decode(message.data, coreSync);

            if (m_context.isIncoming())
            {
                // response
                COMMAND_HANDSHAKE.response res = new COMMAND_HANDSHAKE.response();
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: res.node_data = m_node.getNodeData();
                res.node_data.CopyFrom(m_node.getNodeData());
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: res.payload_data = coreSync;
                res.payload_data.CopyFrom(coreSync);
                res.local_peerlist = new LinkedList <PeerlistEntry>(m_node.getLocalPeerList());
                m_context.writeMessage(makeReply(COMMAND_HANDSHAKE.ID, LevinProtocol.encode(res), GlobalMembers.LEVIN_PROTOCOL_RETCODE_SUCCESS));
                m_node.tryPing(m_context);
            }
            else
            {
                // request
                COMMAND_HANDSHAKE.request req = new COMMAND_HANDSHAKE.request();
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: req.node_data = m_node.getNodeData();
                req.node_data.CopyFrom(m_node.getNodeData());
//C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
//ORIGINAL LINE: req.payload_data = coreSync;
                req.payload_data.CopyFrom(coreSync);
                m_context.writeMessage(makeRequest(COMMAND_HANDSHAKE.ID, LevinProtocol.encode(req)));
            }
        }
Esempio n. 2
0
        private void handleHandshakeRequest(LevinProtocol.Command cmd)
        {
            COMMAND_HANDSHAKE.request req = new COMMAND_HANDSHAKE.request();
            if (!LevinProtocol.decode <COMMAND_HANDSHAKE.request>(cmd.buf, req))
            {
                throw new System.Exception("Failed to decode COMMAND_HANDSHAKE request");
            }

            m_node.handleNodeData(req.node_data, m_context);
            m_readQueue.Enqueue(new P2pMessage({ cmd.command, LevinProtocol.encode(req.payload_data) })); // enqueue payload info