protected override void HandleClientHelloRequest(ClientHelloRequest packet, MessageOrigin origin)
        {
            if (!clientRandoms.ContainsKey(origin.endPoint))
            {
                clientRandoms[origin.endPoint] = packet.random;
            }

            var random = PacketEncryptionLayer.GenerateRandom(32);

            SendUnreliableResponse(1u, origin.endPoint, packet, HelloVerifyRequest.pool.Obtain().Init(random));
            packet.Release();
        }
Example #2
0
 public Task <HelloVerifyRequest> ClientHello(ISession session, ClientHelloRequest request)
 {
     _logger.Verbose(
         $"Handling {nameof(ClientHelloRequest)} " +
         $"(Random='{BitConverter.ToString(request.Random)}')."
         );
     session.Epoch        = request.RequestId & _epochMask;
     session.State        = SessionState.New;
     session.Cookie       = _cookieProvider.GetCookie();
     session.ClientRandom = request.Random;
     return(Task.FromResult(new HelloVerifyRequest()
     {
         Cookie = session.Cookie
     }));
 }