Author: miguel
Date: 2007-03-28 20:33:25 -0500 (Wed, 28 Mar 2007)
New Revision: 75120

Modified:
   trunk/xsp/ChangeLog
   trunk/xsp/src/ModMonoRequest.cs
Log:
2007-03-28  Miguel de Icaza  <[EMAIL PROTECTED]>

        * src/ModMonoRequest.cs: Only compute the data once.

        (GetClientBlock): if we get a -1, return the -1 to the client, do
        not try to call Read. 

Modified: trunk/xsp/ChangeLog
===================================================================
--- trunk/xsp/ChangeLog 2007-03-29 00:11:34 UTC (rev 75119)
+++ trunk/xsp/ChangeLog 2007-03-29 01:33:25 UTC (rev 75120)
@@ -1,3 +1,10 @@
+2007-03-28  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * src/ModMonoRequest.cs: Only compute the data once.
+
+       (GetClientBlock): if we get a -1, return the -1 to the client, do
+       not try to call Read. 
+
 2007-03-29  Marek Habersack  <[EMAIL PROTECTED]>
 
        * src/ModMonoApplicationHost.cs: make sure request id is reset to

Modified: trunk/xsp/src/ModMonoRequest.cs
===================================================================
--- trunk/xsp/src/ModMonoRequest.cs     2007-03-29 00:11:34 UTC (rev 75119)
+++ trunk/xsp/src/ModMonoRequest.cs     2007-03-29 01:33:25 UTC (rev 75120)
@@ -165,8 +165,10 @@
 
                void WriteString (string s)
                {
-                       writer.Write (Encoding.Default.GetByteCount (s));
-                       writer.Write (Encoding.Default.GetBytes (s));
+                       byte [] bytes = Encoding.Default.GetBytes (s);
+                       
+                       writer.Write (bytes.Length);
+                       writer.Write (bytes);
                }
                
                public void Decline ()
@@ -351,10 +353,17 @@
                {
                        if (!ShouldClientBlock ()) return 0;
                        if (SetupClientBlock () != 0) return 0;
-                       
+
+                       /*
+                        * turns out that that GET_CLIENT_BLOCK 
(ap_get_client_block) can
+                        * return -1 if a socket is closed
+                        */
                        SendSimpleCommand (Cmd.GET_CLIENT_BLOCK);
                        writer.Write (size);
                        int i = reader.ReadInt32 ();
+                       if (i == -1)
+                               return -1;
+                       
                        if (i > size)
                                throw new Exception ("Houston...");
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to