Inheritance: TransportInitiator
Beispiel #1
0
        static void OnConnectComplete(object sender, SocketAsyncEventArgs e)
        {
            TcpTransportInitiator thisPtr = (TcpTransportInitiator)e.UserToken;

            if (thisPtr.callbackArgs.Transport == null && thisPtr.callbackArgs.Exception == null)
            {
                // Mono invokes the callback twice from the callback event handler
                // Ignore the second one as a workaround.
                thisPtr.Complete(e, false);
            }
        }
Beispiel #2
0
        static void OnConnectComplete(object sender, SocketAsyncEventArgs e)
        {
            TcpTransportInitiator thisPtr = (TcpTransportInitiator)e.UserToken;

            if (Interlocked.CompareExchange(ref thisPtr.state, 1, 0) == 0)
            {
                thisPtr.Complete(e, false);
            }
            else
            {
                e.ConnectSocket?.Dispose();
            }
        }
        static void OnConnectComplete(object sender, SocketAsyncEventArgs e)
        {
            TcpTransportInitiator thisPtr = (TcpTransportInitiator)e.UserToken;

            thisPtr.Complete(e, false);
        }