Author: alanmc
Date: 2008-02-14 16:45:59 -0500 (Thu, 14 Feb 2008)
New Revision: 95705

Modified:
   trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/TorrentManager.cs
Log:
if already stopped, just return

Modified: 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/TorrentManager.cs
===================================================================
--- 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/TorrentManager.cs    
    2008-02-14 21:45:34 UTC (rev 95704)
+++ 
trunk/bitsharp/src/MonoTorrent/MonoTorrent.Client/Managers/TorrentManager.cs    
    2008-02-14 21:45:59 UTC (rev 95705)
@@ -465,15 +465,14 @@
         /// </summary>
         public WaitHandle Stop()
         {
+                       WaitHandle handle;
             lock (this.engine.asyncCompletionLock)
             {
-                if (this.state == TorrentState.Stopped)
-                    throw new TorrentException("Torrent already stopped");
+                               if (this.state == TorrentState.Stopped)
+                                       return new ManualResetEvent(true);
 
-                WaitHandle handle;
+                               UpdateState(TorrentState.Stopped);
 
-                UpdateState(TorrentState.Stopped);
-
                 handle = this.trackerManager.Announce(TorrentEvent.Stopped);
                 lock (this.listLock)
                 {

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

Reply via email to