internal override void Register(TransportChannelListener channelListener)
        {
            string method = ((HttpChannelListener)channelListener).Method;

            UriPrefixTable <HttpChannelListener> addressTable;

            if (!addressTables.TryGetValue(method, out addressTable))
            {
                lock (ThisLock)
                {
                    if (!addressTables.TryGetValue(method, out addressTable))
                    {
                        Dictionary <string, UriPrefixTable <HttpChannelListener> > newAddressTables =
                            new Dictionary <string, UriPrefixTable <HttpChannelListener> >(addressTables);

                        addressTable             = new UriPrefixTable <HttpChannelListener>();
                        newAddressTables[method] = addressTable;

                        addressTables = newAddressTables;
                    }
                }
            }

            addressTable.RegisterUri(channelListener.Uri,
                                     channelListener.InheritBaseAddressSettings ? hostNameComparisonMode : channelListener.HostNameComparisonModeInternal,
                                     (HttpChannelListener)channelListener);
        }
 internal HttpAnonymousUriPrefixMatcher(HttpAnonymousUriPrefixMatcher objectToClone) : this()
 {
     if (objectToClone.anonymousUriPrefixes != null)
     {
         this.anonymousUriPrefixes = new UriPrefixTable <Uri>(objectToClone.anonymousUriPrefixes);
     }
 }
 protected void Fault <TChannelListener>(UriPrefixTable <TChannelListener> addressTable, Exception exception) where TChannelListener : ChannelListenerBase
 {
     foreach (KeyValuePair <BaseUriWithWildcard, TChannelListener> pair in addressTable.GetAll())
     {
         TChannelListener local = pair.Value;
         local.Fault(exception);
         local.Abort();
     }
 }
        internal static void EnsureRegistered <TChannelListener>(UriPrefixTable <TChannelListener> addressTable, TChannelListener channelListener, HostNameComparisonMode registeredComparisonMode) where TChannelListener : TransportChannelListener
        {
            TChannelListener local;

            if (!addressTable.TryLookupUri(channelListener.Uri, registeredComparisonMode, out local) || (local != channelListener))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ListenerFactoryNotRegistered", new object[] { channelListener.Uri })));
            }
        }
 internal UriPrefixTable(UriPrefixTable <TItem> objectToClone) : this(objectToClone.includePortInComparison, objectToClone.useWeakReferences)
 {
     if (objectToClone.Count > 0)
     {
         foreach (KeyValuePair <BaseUriWithWildcard, TItem> pair in objectToClone.GetAll())
         {
             this.RegisterUri(pair.Key.BaseAddress, pair.Key.HostNameComparisonMode, pair.Value);
         }
     }
 }
        internal static void EnsureRegistered <TChannelListener>(UriPrefixTable <TChannelListener> addressTable,
                                                                 TChannelListener channelListener, HostNameComparisonMode registeredComparisonMode)
            where TChannelListener : TransportChannelListener
        {
            TChannelListener existingFactory;

            if (!addressTable.TryLookupUri(channelListener.Uri, registeredComparisonMode, out existingFactory) ||
                (existingFactory != channelListener))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(
                                                                                                            SR.ListenerFactoryNotRegistered, channelListener.Uri)));
            }
        }
 public void Register(Uri anonymousUriPrefix)
 {
     if (anonymousUriPrefix == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("anonymousUriPrefix");
     }
     if (!anonymousUriPrefix.IsAbsoluteUri)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("anonymousUriPrefix", System.ServiceModel.SR.GetString("UriMustBeAbsolute"));
     }
     if (this.anonymousUriPrefixes == null)
     {
         this.anonymousUriPrefixes = new UriPrefixTable <Uri>(true);
     }
     if (!this.anonymousUriPrefixes.IsRegistered(new BaseUriWithWildcard(anonymousUriPrefix, HostNameComparisonMode.Exact)))
     {
         this.anonymousUriPrefixes.RegisterUri(anonymousUriPrefix, HostNameComparisonMode.Exact, anonymousUriPrefix);
     }
 }
Exemple #8
0
        internal override void Register(TransportChannelListener channelListener)
        {
            UriPrefixTable <HttpChannelListener> table;
            string method = ((HttpChannelListener)channelListener).Method;

            if (!this.addressTables.TryGetValue(method, out table))
            {
                lock (base.ThisLock)
                {
                    if (!this.addressTables.TryGetValue(method, out table))
                    {
                        Dictionary <string, UriPrefixTable <HttpChannelListener> > dictionary = new Dictionary <string, UriPrefixTable <HttpChannelListener> >(this.addressTables);
                        table = new UriPrefixTable <HttpChannelListener>();
                        dictionary[method] = table;
                        this.addressTables = dictionary;
                    }
                }
            }
            table.RegisterUri(channelListener.Uri, channelListener.InheritBaseAddressSettings ? this.hostNameComparisonMode : channelListener.HostNameComparisonModeInternal, (HttpChannelListener)channelListener);
        }
Exemple #9
0
 protected ConnectionOrientedTransportManager()
 {
     this.addressTable = new UriPrefixTable <TChannelListener>();
 }