Browse Source

2005-08-27 Gonzalo Paniagua Javier <[email protected]>

	* GlobalProxySelection.cs: remove double lock.
	* HttpWebRequest.cs: remove double lock in GetServicePoint() and use
	a private object when locking.


svn path=/trunk/mcs/; revision=48980
Gonzalo Paniagua Javier 20 years ago
parent
commit
6cfab4a2db

+ 6 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,9 @@
+2005-08-27 Gonzalo Paniagua Javier <[email protected]>
+
+	* GlobalProxySelection.cs: remove double lock.
+	* HttpWebRequest.cs: remove double lock in GetServicePoint() and use
+	a private object when locking.
+
 2005-07-15  Miguel de Icaza  <[email protected]>
 
 	* DigestClient.cs: Fix bug #75556, the qop argument must be

+ 0 - 3
mcs/class/System/System.Net/GlobalProxySelection.cs

@@ -46,9 +46,6 @@ namespace System.Net
 		
 		static IWebProxy GetProxy ()
 		{
-			if (proxy != null)
-				return proxy;
-
 			lock (lockobj) {
 				if (proxy != null)
 					return proxy;

+ 4 - 6
mcs/class/System/System.Net/HttpWebRequest.cs

@@ -91,6 +91,7 @@ namespace System.Net
 		int bodyBufferLength;
 		bool getResponseCalled;
 		Exception saved_exc;
+		object locker = new object ();
 #if NET_1_1
 		int maxResponseHeadersLength;
 		static int defaultMaxResponseHeadersLength;
@@ -502,10 +503,7 @@ namespace System.Net
 		
 		internal ServicePoint GetServicePoint ()
 		{
-			if (!hostChanged && servicePoint != null)
-				return servicePoint;
-
-			lock (this) {
+			lock (locker) {
 				if (hostChanged || servicePoint == null) {
 					servicePoint = ServicePointManager.FindServicePoint (actualUri, proxy);
 					hostChanged = false;
@@ -584,7 +582,7 @@ namespace System.Net
 
 			CommonChecks (send);
 			
-			lock (this)
+			lock (locker)
 			{
 				if (asyncWrite != null) {
 					throw new InvalidOperationException ("Cannot re-call start of asynchronous " +
@@ -1047,7 +1045,7 @@ namespace System.Net
 			}
 
 			if (wexc == null && (method == "POST" || method == "PUT")) {
-				lock (this) {
+				lock (locker) {
 					CheckSendError (data);
 					if (saved_exc != null)
 						wexc = (WebException) saved_exc;