public override void ChannelActive(IChannelHandlerContext context)
        {
            _channel = context.Channel;

            if (_role == HandshakeRole.Initiator)
            {
                Packet auth = _service.Auth(RemoteId, _handshake);

                if (_logger.IsTrace)
                {
                    _logger.Trace($"Sending AUTH to {RemoteId} @ {context.Channel.RemoteAddress}");
                }
                _buffer.WriteBytes(auth.Data);
                context.WriteAndFlushAsync(_buffer);
            }

            _session.RemoteHost = ((IPEndPoint)context.Channel.RemoteAddress).Address.ToString();
            _session.RemotePort = ((IPEndPoint)context.Channel.RemoteAddress).Port;

            CheckHandshakeInitTimeout().ContinueWith(x =>
            {
                if (x.IsFaulted && _logger.IsError)
                {
                    _logger.Error("Error during handshake timeout logic", x.Exception);
                }
            });
        }
Example #2
0
 private void Auth()
 {
     _auth = _initiatorService.Auth(new NodeId(NetTestVectors.StaticKeyB.PublicKey), _initiatorHandshake);
 }