internal bool UnregisterSubscription(IPEndPoint RemoteEndpoint, ulong Token) { string Prefix = RemoteEndpoint.ToString() + " "; string Key = Prefix + Token.ToString(); lock (this.registrations) { this.registeredMessages = null; if (this.registrations.Remove(Key)) { return(true); } if (Token == 0) { LinkedList <string> ToRemove = null; foreach (string Key2 in this.registrations.Keys) { if (Key2.StartsWith(Prefix)) { if (ToRemove is null) { ToRemove = new LinkedList <string>(); } ToRemove.AddLast(Key2); } } if (ToRemove != null) { foreach (string Key2 in ToRemove) { this.registrations.Remove(Key2); } return(true); } } } return(false); }