Beispiel #1
0
        private void NewStreamHandler(INetworkStream stream)
        {
            var sw = new Stopwatch();

            sw.Start();

            if (NegotiateTimeout != Timeout.InfiniteTimeSpan)
            {
                stream.SetDeadline(DateTime.Now.Add(NegotiateTimeout));
            }

            var result = Mux.Negotiate(((IReadWriter)stream).AsSystemStream());

            sw.Stop();

            if (NegotiateTimeout != Timeout.InfiniteTimeSpan)
            {
                stream.SetDeadline(default(DateTime));
            }

            stream.Protocol = result.Protocol;

            // reporter

            Task.Factory.StartNew(() => result.Handler.Handle(result.Protocol, ((IReadWriter)stream).AsSystemStream()));
        }
Beispiel #2
0
 public void SetDeadline(DateTime t) => _stream.SetDeadline(t);