Merge pull request #2305 from ludovic-henry/fix-threadpool-36414
[mono.git] / mcs / class / System / System.Net / FtpAsyncResult.cs
index c8aac452e05573f3b03bb15464bb7afc0b61c0fb..33e67372c48333256cdb5b49c05c7212de4d9fff 100644 (file)
@@ -10,8 +10,7 @@
 using System;
 using System.IO;
 using System.Threading;
-
-#if NET_2_0
+using System.Net;
 
 namespace System.Net 
 {
@@ -89,6 +88,8 @@ namespace System.Net
                        get {
                                return stream;
                        }
+
+                       set { stream = value; }
                }
 
                internal void WaitUntilComplete ()
@@ -117,11 +118,7 @@ namespace System.Net
                                if (waitHandle != null)
                                        waitHandle.Set ();
                        }
-               }
-
-               internal void SetCompleted (bool synch)
-               {
-                       SetCompleted (synch, null, null);
+                       DoCallback ();
                }
 
                internal void SetCompleted (bool synch, FtpWebResponse response)
@@ -134,20 +131,14 @@ namespace System.Net
                        SetCompleted (synch, exc, null);
                }
 
-               internal void SetCompleted (bool synch, Stream stream)
-               {
-                       this.synch = synch;
-                       this.stream = stream;
-                       lock (locker) {
-                               completed = true;
-                               if (waitHandle != null)
-                                       waitHandle.Set ();
-                       }
-               }
-
                internal void DoCallback ()
                {
-                       callback (this);
+                       if (callback != null)
+                               try {
+                                       callback (this);
+                               }
+                               catch (Exception) {
+                               }
                }
 
                // Cleanup resources
@@ -168,5 +159,4 @@ namespace System.Net
        }
 }
 
-#endif