FileFind.Meshwork.LocalNodeConnection.SendReady C# (CSharp) Méthode

SendReady() public méthode

public SendReady ( ) : void
Résultat void
        public void SendReady()
        {
            if (readySent == false) {
                this.SendMessage (transport.Network.MessageBuilder.CreateReadyMessage(NodeRemote));
                readySent = true;
            } else {
                throw new Exception ("`Ready' was already sent.");
            }
        }

Usage Example

Exemple #1
0
        /*	internal void ProcessPongMessage (Node messageFrom, ulong timestamp)
         *      {*/
        //TODO: Pinging/ponging is a total mess

        /*	if (timestamp == messageFrom.TimeOfLastPing) {
         *              messageFrom.PingTime = DateTime.Now.Subtract(messageFrom.TimeOfLastPing).Milliseconds;
         *              messageFrom.RaisePongReceived(messageFrom.PingTime);
         *              //messageFrom.TimeOfLastPing = null;
         *      } else {
         *              // TODO: Do something?
         *      }*/
        // }

        /*
         * internal void ProcessAuthMessage (LocalNodeConnection connection, Node messageFrom, AuthInfo info)
         * {
         *      ProcessAuthMessage (connection, messageFrom, info, false);
         * }
         */

        internal void ProcessAuthMessage(LocalNodeConnection connection, Node messageFrom, AuthInfo c, bool isReply)
        {
            // Some checks:

            // XXX: Isn't this checked elsewhere?
            if (c.NetworkName != network.NetworkName)
            {
                InvalidNetworkNameError error = new InvalidNetworkNameError(c.NetworkName, network.NetworkName);
                network.SendCriticalError(messageFrom, error);
                throw error.ToException();
            }

            if (c.ProtocolVersion != Core.ProtocolVersion)
            {
                VersionMismatchError e = new VersionMismatchError(c.ProtocolVersion.ToString());
                network.SendCriticalError(messageFrom, e);
                throw new VersionMismatchError().ToException();
            }

            // Update node details:
            Node node = network.Nodes[messageFrom.NodeID];

            node.NickName = c.NickName;

            if (isReply == false)
            {
                connection.ConnectionState = ConnectionState.Authenticating;
                network.SendAuthReply(connection, messageFrom);
            }
            else
            {
                connection.SendReady();
            }
        }
All Usage Examples Of FileFind.Meshwork.LocalNodeConnection::SendReady