TransportManagerContainer(TransportManagerContainer source) { listener = source.listener; tableLock = source.tableLock; transportManagers = new List <TransportManager>(); for (int i = 0; i < source.transportManagers.Count; i++) { transportManagers.Add(source.transportManagers[i]); } }
public bool TransferTransportManagers(TransportManagerContainer transportManagerContainer) { lock (ThisLock) { if (State != CommunicationState.Opened) { return(false); } this.transportManagerContainer = transportManagerContainer; return(true); } }
// copy contents into a new container (used for listener/channel lifetime decoupling) public static TransportManagerContainer TransferTransportManagers(TransportManagerContainer source) { TransportManagerContainer result = null; using (source.tableLock.TakeLock()) { if (source.transportManagers.Count > 0) { result = new TransportManagerContainer(source); source.transportManagers.Clear(); } } return(result); }
protected override void OnOpening() { base.OnOpening(); transportManagerContainer = listener.GetTransportManagers(); listener = null; }
protected TransportChannelListener(TransportBindingElement bindingElement, BindingContext context, MessageEncoderFactory defaultMessageEncoderFactory, HostNameComparisonMode hostNameComparisonMode) : base(context.Binding) { HostNameComparisonModeHelper.Validate(hostNameComparisonMode); this.hostNameComparisonMode = hostNameComparisonMode; manualAddressing = bindingElement.ManualAddressing; maxBufferPoolSize = bindingElement.MaxBufferPoolSize; maxReceivedMessageSize = bindingElement.MaxReceivedMessageSize; Collection <MessageEncodingBindingElement> messageEncoderBindingElements = context.BindingParameters.FindAll <MessageEncodingBindingElement>(); if (messageEncoderBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.MultipleMebesInParameters)); } else if (messageEncoderBindingElements.Count == 1) { messageEncoderFactory = messageEncoderBindingElements[0].CreateMessageEncoderFactory(); context.BindingParameters.Remove <MessageEncodingBindingElement>(); } else { messageEncoderFactory = defaultMessageEncoderFactory; } if (null != messageEncoderFactory) { messageVersion = messageEncoderFactory.MessageVersion; } else { messageVersion = MessageVersion.None; } if ((context.ListenUriMode == ListenUriMode.Unique) && (context.ListenUriBaseAddress == null)) { UriBuilder uriBuilder = new UriBuilder(Scheme, DnsCache.MachineName); uriBuilder.Path = GeneratedAddressPrefix; context.ListenUriBaseAddress = uriBuilder.Uri; } UriHelper.ValidateBaseAddress(context.ListenUriBaseAddress, "baseAddress"); if (context.ListenUriBaseAddress.Scheme != Scheme) { // URI schemes are case-insensitive, so try a case insensitive compare now if (string.Compare(context.ListenUriBaseAddress.Scheme, Scheme, StringComparison.OrdinalIgnoreCase) != 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument( "context.ListenUriBaseAddress", SR.Format(SR.InvalidUriScheme, context.ListenUriBaseAddress.Scheme, Scheme)); } } Fx.Assert(context.ListenUriRelativeAddress != null, ""); // validated by BindingContext if (context.ListenUriMode == ListenUriMode.Explicit) { SetUri(context.ListenUriBaseAddress, context.ListenUriRelativeAddress); } else // ListenUriMode.Unique: { string relativeAddress = context.ListenUriRelativeAddress; if (relativeAddress.Length > 0 && !relativeAddress.EndsWith("/", StringComparison.Ordinal)) { relativeAddress += "/"; } SetUri(context.ListenUriBaseAddress, relativeAddress + Guid.NewGuid().ToString()); } transportManagerContainer = new TransportManagerContainer(this); }
internal TransportManagerContainer GetTransportManagers() { return(TransportManagerContainer.TransferTransportManagers(transportManagerContainer)); }