2 // System.Net.ServicePoint
\r
5 // Lawrence Pit (loz@cable.a2000.nl)
\r
9 using System.Security.Cryptography.X509Certificates;
\r
10 using System.Threading;
\r
12 namespace System.Net
\r
14 public class ServicePoint
\r
17 private int connectionLimit;
\r
18 private int maxIdleTime;
\r
19 private int currentConnections;
\r
20 private DateTime idleSince;
\r
21 private Version protocolVersion;
\r
25 internal ServicePoint (Uri uri, int connectionLimit, int maxIdleTime)
\r
28 this.connectionLimit = connectionLimit;
\r
29 this.maxIdleTime = maxIdleTime;
\r
30 this.currentConnections = 0;
\r
31 this.idleSince = DateTime.Now;
\r
36 public Uri Address {
\r
37 get { return this.uri; }
\r
41 public X509Certificate Certificate {
\r
42 get { throw new NotImplementedException (); }
\r
46 public X509Certificate ClientCertificate {
\r
47 get { throw new NotImplementedException (); }
\r
50 public int ConnectionLimit {
\r
51 get { return connectionLimit; }
\r
54 throw new ArgumentOutOfRangeException ();
\r
55 connectionLimit = value;
\r
59 public string ConnectionName {
\r
60 get { return uri.Scheme; }
\r
63 public int CurrentConnections {
\r
64 get { return currentConnections; }
\r
67 public DateTime IdleSince {
\r
68 get { return idleSince; }
\r
71 public int MaxIdleTime {
\r
72 get { return maxIdleTime; }
\r
74 if (value < Timeout.Infinite || value > Int32.MaxValue)
\r
75 throw new ArgumentOutOfRangeException ();
\r
76 this.maxIdleTime = value;
\r
80 public virtual Version ProtocolVersion {
\r
81 get { return protocolVersion; }
\r
84 public bool SupportsPipelining {
\r
85 get { return HttpVersion.Version11.Equals (protocolVersion); }
\r
90 public override int GetHashCode()
\r
92 return base.GetHashCode ();
\r
97 internal bool AvailableForRecycling {
\r
99 return CurrentConnections == 0
\r
100 && maxIdleTime != Timeout.Infinite
\r
101 && DateTime.Now >= IdleSince.AddMilliseconds (maxIdleTime);
\r