Author: gonzalo
Date: 2005-04-14 18:40:16 -0400 (Thu, 14 Apr 2005)
New Revision: 43016

Modified:
   trunk/mcs/class/System/System.Net/ChangeLog
   trunk/mcs/class/System/System.Net/WebAsyncResult.cs
   trunk/mcs/class/System/System.Net/WebConnectionStream.cs
Log:
2005-04-14 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * WebConnectionStream.cs:
        * WebAsyncResult.cs: ensure we only call EndRead once per async. result.
        Update total before invoking the callback when present.



Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2005-04-14 22:08:46 UTC (rev 
43015)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2005-04-14 22:40:16 UTC (rev 
43016)
@@ -1,3 +1,9 @@
+2005-04-14 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * WebConnectionStream.cs:
+       * WebAsyncResult.cs: ensure we only call EndRead once per async. result.
+       Update total before invoking the callback when present.
+
 2005-04-11 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * WebConnection.cs:

Modified: trunk/mcs/class/System/System.Net/WebAsyncResult.cs
===================================================================
--- trunk/mcs/class/System/System.Net/WebAsyncResult.cs 2005-04-14 22:08:46 UTC 
(rev 43015)
+++ trunk/mcs/class/System/System.Net/WebAsyncResult.cs 2005-04-14 22:40:16 UTC 
(rev 43016)
@@ -51,6 +51,7 @@
                int offset;
                int size;
                object locker = new object ();
+               public bool EndReadCalled;
 
                public WebAsyncResult (AsyncCallback cb, object state)
                {

Modified: trunk/mcs/class/System/System.Net/WebConnectionStream.cs
===================================================================
--- trunk/mcs/class/System/System.Net/WebConnectionStream.cs    2005-04-14 
22:08:46 UTC (rev 43015)
+++ trunk/mcs/class/System/System.Net/WebConnectionStream.cs    2005-04-14 
22:40:16 UTC (rev 43016)
@@ -294,6 +294,10 @@
                public override int EndRead (IAsyncResult r)
                {
                        WebAsyncResult result = (WebAsyncResult) r;
+                       if (result.EndReadCalled) {
+                               int xx = result.NBytes;
+                               return (xx >= 0) ? xx : 0;
+                       }
 
                        if (!result.IsCompleted) {
                                int nbytes = cnc.EndRead (result);
@@ -301,9 +305,9 @@
                                if (finished && result.NBytes > 0)
                                        nbytes = 0;
 
+                               totalRead += nbytes;
                                result.SetCompleted (false, nbytes + 
result.NBytes);
                                result.DoCallback ();
-                               totalRead += nbytes;
                                if (finished || nbytes == 0)
                                        contentLength = totalRead;
                        }

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

Reply via email to