// internal message filtering internal void RegisterMessageFilter(object registrant, Uri via, PeerMessageFilter[] filters, ITransportFactorySettings settings, MessageAvailableCallback callback, SecurityProtocol securityProtocol) { MessageFilterRegistration registration = new MessageFilterRegistration(); registration.registrant = registrant; registration.via = via; registration.filters = filters; registration.settings = settings; registration.callback = callback; registration.securityProtocol = securityProtocol; lock (ThisLock) { messageFilters.Add(registrant, registration); RefCountedSecurityProtocol protocolWrapper = null; if (!this.uri2SecurityProtocol.TryGetValue(via, out protocolWrapper)) { protocolWrapper = new RefCountedSecurityProtocol(securityProtocol); this.uri2SecurityProtocol.Add(via, protocolWrapper); } else protocolWrapper.AddRef(); } }
internal void RegisterMessageFilter(object registrant, Uri via, PeerMessageFilter[] filters, ITransportFactorySettings settings, MessageAvailableCallback callback, SecurityProtocol securityProtocol) { MessageFilterRegistration registration = new MessageFilterRegistration { registrant = registrant, via = via, filters = filters, settings = settings, callback = callback, securityProtocol = securityProtocol }; lock (this.ThisLock) { this.messageFilters.Add(registrant, registration); RefCountedSecurityProtocol protocol = null; if (!this.uri2SecurityProtocol.TryGetValue(via, out protocol)) { protocol = new RefCountedSecurityProtocol(securityProtocol); this.uri2SecurityProtocol.Add(via, protocol); } else { protocol.AddRef(); } } }