Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@ -55,20 +55,28 @@ namespace System.Net
bool tcp_keepalive;
int tcp_keepalive_time;
int tcp_keepalive_interval;
bool disposed;
// Constructors
internal ServicePoint (Uri uri, int connectionLimit, int maxIdleTime)
internal ServicePoint (ServicePointManager.SPKey key, Uri uri, int connectionLimit, int maxIdleTime)
{
Key = key;
this.uri = uri;
this.connectionLimit = connectionLimit;
this.maxIdleTime = maxIdleTime;
Scheduler = new ServicePointScheduler (this, connectionLimit, maxIdleTime);
}
internal ServicePointScheduler Scheduler {
internal ServicePointManager.SPKey Key {
get;
}
ServicePointScheduler Scheduler {
get; set;
}
// Properties
public Uri Address {
@ -95,9 +103,16 @@ namespace System.Net
}
}
int connectionLimit;
int maxIdleTime;
public int ConnectionLimit {
get { return Scheduler.ConnectionLimit; }
set { Scheduler.ConnectionLimit = value; }
get { return connectionLimit; }
set {
connectionLimit = value;
if (!disposed)
Scheduler.ConnectionLimit = value;
}
}
public string ConnectionName {
@ -106,19 +121,25 @@ namespace System.Net
public int CurrentConnections {
get {
return Scheduler.CurrentConnections;
return disposed ? 0 : Scheduler.CurrentConnections;
}
}
public DateTime IdleSince {
get {
if (disposed)
return DateTime.MinValue;
return Scheduler.IdleSince.ToLocalTime ();
}
}
public int MaxIdleTime {
get { return Scheduler.MaxIdleTime; }
set { Scheduler.MaxIdleTime = value; }
get { return maxIdleTime; }
set {
maxIdleTime = value;
if (!disposed)
Scheduler.MaxIdleTime = value;
}
}
public virtual Version ProtocolVersion {
@ -265,6 +286,8 @@ namespace System.Net
internal void SendRequest (WebOperation operation, string groupName)
{
lock (this) {
if (disposed)
throw new ObjectDisposedException (typeof (ServicePoint).FullName);
Scheduler.SendRequest (operation, groupName);
}
}
@ -272,10 +295,18 @@ namespace System.Net
public bool CloseConnectionGroup (string connectionGroupName)
{
lock (this) {
if (disposed)
return true;
return Scheduler.CloseConnectionGroup (connectionGroupName);
}
}
internal void FreeServicePoint ()
{
disposed = true;
Scheduler = null;
}
//
// Copied from the referencesource
//