| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Net.Security; |
| | | 6 | | using System.Security.Authentication; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Channels |
| | | 9 | | { |
| | | 10 | | internal static class TransportDefaults |
| | | 11 | | { |
| | | 12 | | internal const bool ExtractGroupsForWindowsAccounts = true; //SspiSecurityTokenProvider.DefaultExtractWindowsGro |
| | | 13 | | internal const long MaxReceivedMessageSize = 65536; |
| | | 14 | | internal const HostNameComparisonMode HostNameComparisonMode = CoreWCF.HostNameComparisonMode.Exact; |
| | | 15 | | internal const int MaxDrainSize = (int)MaxReceivedMessageSize; |
| | | 16 | | internal const long MaxBufferPoolSize = 512 * 1024; |
| | | 17 | | internal const int MaxBufferSize = (int)MaxReceivedMessageSize; |
| | | 18 | | |
| | | 19 | | internal const SslProtocols SslProtocols = System.Security.Authentication.SslProtocols.None; // Let the OS decid |
| | | 20 | | |
| | | 21 | | internal static MessageEncoderFactory GetDefaultMessageEncoderFactory() |
| | | 22 | | { |
| | | 23 | | return new BinaryMessageEncodingBindingElement().CreateMessageEncoderFactory(); |
| | | 24 | | } |
| | | 25 | | } |
| | | 26 | | |
| | | 27 | | internal static class ConnectionOrientedTransportDefaults |
| | | 28 | | { |
| | | 29 | | internal const int ConnectionBufferSize = 8192; |
| | | 30 | | internal const HostNameComparisonMode HostNameComparisonMode = CoreWCF.HostNameComparisonMode.StrongWildcard; |
| | 0 | 31 | | internal static TimeSpan IdleTimeout { get { return TimeSpan.FromMinutes(2); } } |
| | 0 | 32 | | internal static TimeSpan ChannelInitializationTimeout { get { return TimeSpan.FromSeconds(30); } } |
| | | 33 | | internal const int MaxContentTypeSize = 256; |
| | | 34 | | internal const int MaxOutboundConnectionsPerEndpoint = 10; |
| | 0 | 35 | | internal static TimeSpan MaxOutputDelay { get { return TimeSpan.FromMilliseconds(200); } } |
| | | 36 | | |
| | | 37 | | internal const int MaxViaSize = 2048; |
| | | 38 | | internal const ProtectionLevel ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign; |
| | | 39 | | internal const TransferMode TransferMode = CoreWCF.TransferMode.Buffered; |
| | | 40 | | |
| | | 41 | | internal static int GetMaxConnections() |
| | | 42 | | { |
| | 0 | 43 | | return GetMaxPendingConnections(); |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | internal static int GetMaxPendingConnections() |
| | | 47 | | { |
| | 0 | 48 | | return 12 * Environment.ProcessorCount; |
| | | 49 | | } |
| | | 50 | | |
| | | 51 | | internal static int GetMaxPendingAccepts() |
| | | 52 | | { |
| | 0 | 53 | | return 2 * Environment.ProcessorCount; |
| | | 54 | | } |
| | | 55 | | } |
| | | 56 | | |
| | | 57 | | internal static class TcpTransportDefaults |
| | | 58 | | { |
| | | 59 | | internal const int ListenBacklogConst = 0; |
| | | 60 | | internal static TimeSpan ConnectionLeaseTimeout { get { return TimeSpan.FromMinutes(5); } } |
| | | 61 | | internal const string ConnectionLeaseTimeoutString = "00:05:00"; |
| | | 62 | | //internal const bool PortSharingEnabled = false; |
| | | 63 | | //internal const bool TeredoEnabled = false; |
| | | 64 | | |
| | | 65 | | internal static int GetListenBacklog() |
| | | 66 | | { |
| | | 67 | | return 12 * Environment.ProcessorCount; |
| | | 68 | | } |
| | | 69 | | } |
| | | 70 | | } |