Exemplo 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)));
            }
        }
Exemplo n.º 2
0
//C++ TO C# CONVERTER TODO TASK: 'rvalue references' have no equivalent in C#:
            public Message(P2pMessage && msg, Type messageType, uint returnCode = 0)
            {
                this.messageType = new CryptoNote.P2pContext.Message.Type(messageType);
//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: this.returnCode = returnCode;
                this.returnCode.CopyFrom(returnCode);
                type = msg.type;
                data = std::move(msg.data);
            }
Exemplo n.º 3
0
 public override void write(P2pMessage message)
 {
     if (message.type == COMMAND_HANDSHAKE.ID)
     {
         writeHandshake(message);
     }
     else
     {
         m_context.writeMessage(new P2pContext.Message(new P2pMessage(message), P2pContext.Message.NOTIFY));
     }
 }
Exemplo n.º 4
0
        // IP2pConnection
        public override void read(ref P2pMessage message)
        {
            if (m_readQueue.Count > 0)
            {
                message = std::move(m_readQueue.Peek());
                m_readQueue.Dequeue();
                return;
            }

            for (;;)
            {
                LevinProtocol.Command cmd = new LevinProtocol.Command();
                if (!m_context.readCommand(cmd))
                {
                    throw InterruptedException();
                }

//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: message.type = cmd.command;
                message.type.CopyFrom(cmd.command);

                if (cmd.command == COMMAND_HANDSHAKE.ID)
                {
                    handleHandshakeResponse(cmd, message);
                    break;
                }
                else if (cmd.command == COMMAND_TIMED_SYNC.ID)
                {
                    handleTimedSync(cmd);
                }
                else
                {
                    message.data = std::move(cmd.buf);
                    break;
                }
            }
        }