private async void ReceiveClientsAsync() { _acceptingNewClients = true; while (true) { try { Socket remote = await _listeningSocket.AcceptTaskAsync (); IPAddress address = ((IPEndPoint) remote.RemoteEndPoint).Address; var args = new CheckIPEventArgs(address, true); PluginManager.TriggerPlugin.AllowJoining(args); if (!args.AllowJoining) { remote.Close (); _logger.Warn("Denied access from " + address); continue; } //Connection accepted var proxyConnection = new ProxyConnection(remote, this); _openConnection.Add(proxyConnection); proxyConnection.HandleClient (); } catch (TaskCanceledException) { _acceptingNewClients = false; return; } catch (Exception) { } } }