예제 #1
0
            void HandleAccept()
            {
                int error = 0;

                while (error == 0)
                {
                    IntPtr     clientTlsContext;
                    SocketInfo socketInfo;

                    error = manos_tls_accept(tlsContext, out clientTlsContext, out socketInfo);
                    if (error == 0)
                    {
                        var socket = new SecureSocket(parent.Context, socketInfo, clientTlsContext);
                        parent.acceptCallback(socket);
                    }
                }
            }
예제 #2
0
            public override void Close()
            {
                if (parent == null)
                {
                    return;
                }

                RaiseEndOfStream();

                int res = manos_tls_close(tlsContext);

                if (res < 0)
                {
                    Console.Error.WriteLine("Error '{0}' closing socket: {1}", res, Handle.ToInt32());
                    Console.Error.WriteLine(Environment.StackTrace);
                }

                receiveBuffer = null;
                parent        = null;

                base.Close();
            }
예제 #3
0
 public SecureSocketStream(SecureSocket parent, IntPtr handle, IntPtr tlsContext)
     : base(parent.Context, handle)
 {
     this.parent     = parent;
     this.tlsContext = tlsContext;
 }
예제 #4
0
            void HandleAccept()
            {
                int error = 0;

                while (error == 0) {
                    IntPtr clientTlsContext;
                    SocketInfo socketInfo;

                    error = manos_tls_accept (tlsContext, out clientTlsContext, out socketInfo);
                    if (error == 0) {
                        var socket = new SecureSocket (parent.Loop, socketInfo, clientTlsContext);
                        parent.acceptCallback (socket);
                    }
                }
            }
예제 #5
0
            public override void Close()
            {
                if (parent == null) {
                    return;
                }

                RaiseEndOfStream ();

                int res = manos_tls_close (tlsContext);

                if (res < 0) {
                    Console.Error.WriteLine ("Error '{0}' closing socket: {1}", res, Handle.ToInt32 ());
                    Console.Error.WriteLine (Environment.StackTrace);
                }

                receiveBuffer = null;
                parent = null;

                base.Close ();
            }
예제 #6
0
 public SecureSocketStream(SecureSocket parent, IntPtr handle, IntPtr tlsContext)
     : base(parent.Loop, handle)
 {
     this.parent = parent;
     this.tlsContext = tlsContext;
 }