System.Net.Security.Tests.UnixGssFakeNegotiateStream.ServerLoop C# (CSharp) Method

ServerLoop() private static method

private static ServerLoop ( object state ) : void
state object
return void
        private static void ServerLoop(object state)
        {
            UnixGssFakeNegotiateStream thisRef = (UnixGssFakeNegotiateStream)state;
            var header = new byte[5];
            bool handshakeDone = false;
            do
            {
                byte[] inBuf = thisRef._framer.ReadHandshakeFrame();
                byte[] outBuf = null;
                try
                {
                    SafeGssContextHandle context = thisRef._context; // workaround warning about a ref to a field on a MarshalByRefObject
                    handshakeDone = EstablishSecurityContext(ref context, inBuf, out outBuf);
                    thisRef._context = context;

                    thisRef._framer.WriteHandshakeFrame(outBuf, 0, outBuf.Length);
                }
                catch (Interop.NetSecurityNative.GssApiException e)
                {
                    thisRef._framer.WriteHandshakeFrame(e);
                    handshakeDone = true;
                }
            }
            while (!handshakeDone);
        }