public void Stop() { lock (mutex) { CheckDisposed(); if (!started) { return; } WaitHandle[] handles = new WaitHandle[announcers.Count]; int i = 0; foreach (Announcer announcer in announcers.Values) { handles[i++] = announcer.StopAsync(); } request_listener.Stop(); respondSocket.Close(); respondSocket = null; WaitHandle.WaitAll(handles); announceSocket.Close(); announceSocket = null; started = false; } }
public void Stop() { lock (mutex) { CheckDisposed(); if (timout_id != 0) { client.Dispatcher.Remove(timout_id); timout_id = 0; } if (socket != null) { socket.Close(); socket = null; } } }