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; } }
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); } }
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; } }
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; } }