void ConnectionStateHandler(NWConnectionState state, NWError error)
        {
            switch (state)
            {
            case NWConnectionState.Ready:
                connectedEvent.Set();
                break;

            case NWConnectionState.Cancelled:
                connection?.Dispose();
                connection = null;
                stack?.Dispose();
                stack = null;
                foreach (var o in options)
                {
                    o.Dispose();
                }
                break;

            case NWConnectionState.Invalid:
            case NWConnectionState.Failed:
                Assert.Inconclusive("Network connection could not be performed.");
                break;
            }
        }
Beispiel #2
0
        static void Trampoline_StateChangeCallback(IntPtr block, NWConnectionState state, IntPtr error)
        {
            var del = BlockLiteral.GetTarget <Action <NWConnectionState, NWError> > (block);

            if (del != null)
            {
                NWError err = error != IntPtr.Zero ? new NWError(error, owns: false) : null;
                del(state, err);
            }
        }
Beispiel #3
0
        void ConnectionStateHandler(NWConnectionState state, NWError error)
        {
            switch (state)
            {
            case NWConnectionState.Ready:
                connectedEvent.Set();
                break;

            case NWConnectionState.Invalid:
            case NWConnectionState.Failed:
                Assert.Inconclusive("Network connection could not be performed.");
                break;
            }
        }
Beispiel #4
0
        void ConnectionStateHandler(NWConnectionState state, NWError error)
        {
            Console.WriteLine($"State is {state} and error {error}");
            switch (state)
            {
            case NWConnectionState.Ready:
                connectedEvent.Set();
                break;

            case NWConnectionState.Cancelled:
                connection?.Dispose();
                connection = null;
                foreach (var i in interfaces)
                {
                    i.Dispose();
                }
                break;

            case NWConnectionState.Invalid:
            case NWConnectionState.Failed:
                Assert.Inconclusive("Network connection could not be performed.");
                break;
            }
        }