Files
dotnet-bot adf899c629 Adding System.Data..., System.ServiceModel..., and System.Web...
Adding reference source for
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Entity.Design
System.Data.Linq
System.Data.SqlXml
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Activities
System.ServiceModel.Channels
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.WasHosting
System.ServiceModel.Web
System.Web
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Entity
System.Web.Entity.Design
System.Web.Extensions
System.Web.Mobile
System.Web.Routing
System.Web.Services
System.Xml
System.Xml.Linq
2016-05-03 00:07:37 +02:00

85 lines
2.8 KiB
C#

//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
namespace System.ServiceModel.Channels
{
using System.Collections.Generic;
using System.ServiceModel;
using System.IO;
using System.Text;
using System.Threading;
using System.ServiceModel.Diagnostics;
using System.Diagnostics;
using System.Security.Principal;
sealed class ExclusiveNamedPipeTransportManager : NamedPipeTransportManager
{
ConnectionDemuxer connectionDemuxer;
IConnectionListener connectionListener;
public ExclusiveNamedPipeTransportManager(Uri listenUri, NamedPipeChannelListener channelListener)
: base(listenUri)
{
ApplyListenerSettings(channelListener);
SetHostNameComparisonMode(channelListener.HostNameComparisonMode);
SetAllowedUsers(channelListener.AllowedUsers);
}
internal override void OnOpen()
{
connectionListener = new BufferedConnectionListener(
new PipeConnectionListener(ListenUri, HostNameComparisonMode, ConnectionBufferSize,
AllowedUsers, true, int.MaxValue),
MaxOutputDelay, ConnectionBufferSize);
if (DiagnosticUtility.ShouldUseActivity)
{
connectionListener = new TracingConnectionListener(connectionListener, this.ListenUri.ToString(), false);
}
connectionDemuxer = new ConnectionDemuxer(connectionListener,
MaxPendingAccepts, MaxPendingConnections, ChannelInitializationTimeout,
IdleTimeout, MaxPooledConnections,
OnGetTransportFactorySettings,
OnGetSingletonMessageHandler,
OnHandleServerSessionPreamble,
OnDemuxerError);
bool startedDemuxing = false;
try
{
connectionDemuxer.StartDemuxing();
startedDemuxing = true;
}
finally
{
if (!startedDemuxing)
{
connectionDemuxer.Dispose();
}
}
}
internal override void OnClose(TimeSpan timeout)
{
connectionDemuxer.Dispose();
connectionListener.Dispose();
base.OnClose(timeout);
}
internal override void OnAbort()
{
if (connectionDemuxer != null)
{
connectionDemuxer.Dispose();
}
if (connectionListener != null)
{
connectionListener.Dispose();
}
base.OnAbort();
}
}
}