All pastes #2681 Raw Edit

Anonymous

public text v1 · immutable
#2681 ·published 2004-12-05 07:01 UTC
rendered paste body
erandi$ svn diff
Index: WebConnection.cs
===================================================================
--- WebConnection.cs	(revision 37141)
+++ WebConnection.cs	(working copy)
@@ -805,14 +805,15 @@
 			if (nstream == null)
 				return;
 
-			try {
+			//			try {
 				nstream.Write (buffer, offset, size);
 				// here SSL handshake should have been done
 				if (ssl && !certsAvailable) {
 					GetCertificates ();
 				}
-			} catch (Exception) {
-			}
+				//			} catch (Exception e) {
+				//				Console.WriteLine ("being caught in Write: {0}", e);
+				//			}
 		}
 
 		internal bool TryReconnect ()
@@ -855,6 +856,7 @@
 						socket.Close ();
 					} catch {}
 					socket = null;
+					status = WebExceptionStatus.NameResolutionFailure;
 				}
 
 				if (sendNext) {
@@ -876,6 +878,10 @@
 		internal bool Connected {
 			get {
 				lock (this) {
+					bool s = socket != null && socket.Connected;
+					if (s == false)
+						Console.WriteLine ("socket: {0} {1} {2}", socket, socket != null && socket.Connected, status);
+						
 					return (socket != null && socket.Connected);
 				}
 			}
Index: WebConnectionStream.cs
===================================================================
--- WebConnectionStream.cs	(revision 37141)
+++ WebConnectionStream.cs	(working copy)
@@ -394,7 +394,9 @@
 				headersSent = true;
 				try {
 					cnc.Write (buffer, offset, size);
-				} catch (IOException) {
+				} catch (IOException e) {
+					Console.WriteLine ("EXCEPTION CAUGHT, RECONNECTING: " + e);
+					
 					if (cnc.Connected)
 						throw;
 
@@ -446,7 +448,12 @@
 				if (cnc.Data.StatusCode != 0 && cnc.Data.StatusCode != 100)
 					return;
 
+				bool old = cnc.Connected;
 				cnc.Write (bytes, 0, length);
+				if (cnc.Connected == false){
+					Console.WriteLine ("Connected=false, old={0}", old);
+				}
+				
 				if (!cnc.Connected && cnc.TryReconnect ())
 					continue;
 
erandi$