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

68 lines
2.3 KiB
C#

//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
// Enable this to dump contents of a connection a file.
//#define CONNECTIONDUMP
namespace System.ServiceModel.Channels
{
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using System.Runtime.Serialization;
using System.ServiceModel.Diagnostics;
class TcpChannelFactory<TChannel> : ConnectionOrientedTransportChannelFactory<TChannel>,
ITcpChannelFactorySettings
{
static TcpConnectionPoolRegistry connectionPoolRegistry = new TcpConnectionPoolRegistry();
TimeSpan leaseTimeout;
public TcpChannelFactory(TcpTransportBindingElement bindingElement, BindingContext context)
: base(bindingElement, context,
bindingElement.ConnectionPoolSettings.GroupName,
bindingElement.ConnectionPoolSettings.IdleTimeout,
bindingElement.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint,
true)
{
this.leaseTimeout = bindingElement.ConnectionPoolSettings.LeaseTimeout;
}
public TimeSpan LeaseTimeout
{
get
{
return leaseTimeout;
}
}
public override string Scheme
{
get { return Uri.UriSchemeNetTcp; }
}
internal override IConnectionInitiator GetConnectionInitiator()
{
IConnectionInitiator socketConnectionInitiator = new SocketConnectionInitiator(
ConnectionBufferSize);
#if CONNECTIONDUMP
socketConnectionInitiator = new ConnectionDumpInitiator(socketConnectionInitiator);
#endif
return new BufferedConnectionInitiator(socketConnectionInitiator,
MaxOutputDelay, ConnectionBufferSize);
}
internal override ConnectionPool GetConnectionPool()
{
return connectionPoolRegistry.Lookup(this);
}
internal override void ReleaseConnectionPool(ConnectionPool pool, TimeSpan timeout)
{
connectionPoolRegistry.Release(pool, timeout);
}
}
}