public void SetCrypter(Func <P2PClient, ICrypter> newCrypter, bool needDisconnect = true) { crypter = newCrypter.Invoke(Server); if (needDisconnect) { foreach (var i in Server) { Server.Disconnect(i); } } }
private void p_OnConnection(P2PClient server, ulong userId) { try { crypter.AddUser(userId); OnUserConnect?.Invoke(this, userId); } catch (System.OperationCanceledException) { server.Disconnect(userId); } }