Esempio n. 1
0
File: Peer.cs Progetto: wyk125/AElf
        /// <summary>
        /// Handles authentification information.
        /// </summary>
        /// <param name="aMessage"></param>
        private void HandleAuthResponse(Message aMessage)
        {
            try
            {
                _authTimer.Stop();

                Handshake handshk = Handshake.Parser.ParseFrom(aMessage.Payload);

                AuthentifyWith(handshk);

                // Update with the real IP address
                IPEndPoint remoteEndPoint = (IPEndPoint)_client.Client.RemoteEndPoint;
                handshk.NodeInfo.IpAddress = remoteEndPoint.Address.ToString();

                KnownHeight = handshk.Height;

                _pingPongTimer.Start();
            }
            catch (Exception e)
            {
                _logger?.Error(e, "Error processing authentification information.");
                Dispose();
            }

            AuthFinished?.Invoke(this, new AuthFinishedArgs());
        }
Esempio n. 2
0
File: Peer.cs Progetto: wyk125/AElf
        private void AuthTimerElapsed(object sender, ElapsedEventArgs e)
        {
            _authTimer.Stop(); // dispose

            if (IsAuthentified)
            {
                return;
            }

            _logger?.Warn("Authentification timed out.");

            Dispose();

            AuthFinished?.Invoke(this, new AuthFinishedArgs(RejectReason.AuthTimeout));
        }
Esempio n. 3
0
File: Peer.cs Progetto: wyk125/AElf
 private void FireInvalidAuth(RejectReason reason)
 {
     AuthFinished?.Invoke(this, new AuthFinishedArgs(reason));
 }