#if NET_1_1
bool useNagle;
#endif
+#if NET_2_0
+ BindIPEndPoint endPointCallback = null;
+#endif
// Constructors
public Uri Address {
get { return uri; }
}
+
+#if NET_2_0
+ static Exception GetMustImplement ()
+ {
+ return new NotImplementedException ();
+ }
+
+ public BindIPEndPoint BindIPEndPointDelegate
+ {
+ get { return endPointCallback; }
+ set { endPointCallback = value; }
+ }
+#endif
public X509Certificate Certificate {
get { return certificate; }
public X509Certificate ClientCertificate {
get { return clientCertificate; }
}
+
+#if NET_2_0
+ [MonoTODO]
+ public int ConnectionLeaseTimeout
+ {
+ get {
+ throw GetMustImplement ();
+ }
+ set {
+ throw GetMustImplement ();
+ }
+ }
+#endif
public int ConnectionLimit {
get { return connectionLimit; }
public int CurrentConnections {
get {
- lock (locker) {
- return currentConnections;
- }
+ return currentConnections;
}
}
public DateTime IdleSince {
get {
- lock (locker) {
- return idleSince;
- }
+ return idleSince;
+ }
+ internal set {
+ lock (locker)
+ idleSince = value;
}
}
public virtual Version ProtocolVersion {
get { return protocolVersion; }
}
+
+#if NET_2_0
+ [MonoTODO]
+ public int ReceiveBufferSize
+ {
+ get {
+ throw GetMustImplement ();
+ }
+ set {
+ throw GetMustImplement ();
+ }
+ }
+#endif
public bool SupportsPipelining {
get { return HttpVersion.Version11.Equals (protocolVersion); }
set { SendContinue = value; }
}
- [MonoTODO ("Use me")]
public bool UseNagleAlgorithm {
get { return useNagle; }
set { useNagle = value; }
}
// Methods
+#if !NET_2_0
public override int GetHashCode()
{
return base.GetHashCode ();
}
+#endif
// Internal Methods
{
protocolVersion = version;
}
+
#if !TARGET_JVM
WebConnectionGroup GetConnectionGroup (string name)
{
lock (locker) {
WebConnectionGroup cncGroup = GetConnectionGroup (groupName);
- cnc = cncGroup.GetConnection ();
+ cnc = cncGroup.GetConnection (request);
}
return cnc.SendRequest (request);
}
#endif
+#if NET_2_0
+ public bool CloseConnectionGroup (string connectionGroupName)
+ {
+ lock (locker) {
+ WebConnectionGroup cncGroup = GetConnectionGroup (connectionGroupName);
+ if (cncGroup != null) {
+ cncGroup.Close ();
+ return true;
+ }
+ }
+
+ return false;
+ }
+#endif
+
internal void IncrementConnection ()
{
lock (locker) {
certificate = server;
clientCertificate = client;
}
+
+#if NET_2_0
+ internal bool CallEndPointDelegate (Socket sock, IPEndPoint remote)
+ {
+ if (endPointCallback == null)
+ return true;
+
+ int count = 0;
+ for (;;) {
+ IPEndPoint local = null;
+ try {
+ local = endPointCallback (this,
+ remote, count);
+ } catch {
+ // This is to differentiate from an
+ // OverflowException, which should propagate.
+ return false;
+ }
+
+ if (local == null)
+ return true;
+
+ try {
+ sock.Bind (local);
+ } catch (SocketException) {
+ // This is intentional; the docs say
+ // that if the Bind fails, we keep
+ // going until there is an
+ // OverflowException on the retry
+ // count.
+ checked { ++count; }
+ continue;
+ }
+
+ return true;
+ }
+ }
+#endif
}
}
+