diff -ur ../mldonkey-2.6.4-orig/src/daemon/common/commonDownloads.mli ./src/daemon/common/commonDownloads.mli
--- ../mldonkey-2.6.4-orig/src/daemon/common/commonDownloads.mli	2005-09-07 11:52:11.000000000 +0300
+++ ./src/daemon/common/commonDownloads.mli	2005-09-09 09:02:58.000000000 +0300
@@ -57,6 +57,7 @@
     and uploader
     and block
     val create_swarmer : string -> int64 -> int64 -> swarmer
+    val remove_swarmer : t option -> unit
     val create : swarmer -> CommonTypes.file -> int64 -> t
     val set_verifier : t -> CommonSwarming.verification -> unit
     val set_verified : t -> (int -> int -> unit) -> unit
diff -ur ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming.ml ./src/daemon/common/commonSwarming.ml
--- ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/daemon/common/commonSwarming.ml	2005-09-09 09:02:58.000000000 +0300
@@ -100,6 +100,7 @@
   and block
   
   val create_swarmer : string -> int64 -> int64 -> swarmer
+  val remove_swarmer : t option -> unit
   val create : swarmer -> M.CommonTypes.file -> int64 -> t
     
   val set_verifier : t -> verification -> unit
diff -ur ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming1.ml ./src/daemon/common/commonSwarming1.ml
--- ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming1.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/daemon/common/commonSwarming1.ml	2005-09-09 09:02:58.000000000 +0300
@@ -210,6 +210,14 @@
   
 (*************************************************************************)
 (*                                                                       *)
+(*                         remove                                        *)
+(*                                                                       *)
+(*************************************************************************)
+
+let remove_swarmer swarmer = begin end
+
+(*************************************************************************)
+(*                                                                       *)
 (*                         create                                        *)
 (*                                                                       *)
 (*************************************************************************)
diff -ur ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming2.ml ./src/daemon/common/commonSwarming2.ml
--- ../mldonkey-2.6.4-orig/src/daemon/common/commonSwarming2.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/daemon/common/commonSwarming2.ml	2005-09-09 09:02:58.000000000 +0300
@@ -302,6 +302,16 @@
 
 (*************************************************************************)
 (*                                                                       *)
+(*                         Remove swarmer                                *)
+(*                                                                       *)
+(*************************************************************************)
+
+let remove_swarmer file_swarmer =
+  match file_swarmer with None -> () | Some sw -> HS.remove swarmers_by_name sw.t_s
+  
+
+(*************************************************************************)
+(*                                                                       *)
 (*                         compute_block_end (internal)                  *)
 (*                                                                       *)
 (*************************************************************************)
diff -ur ../mldonkey-2.6.4-orig/src/networks/bittorrent/bTClients.ml ./src/networks/bittorrent/bTClients.ml
--- ../mldonkey-2.6.4-orig/src/networks/bittorrent/bTClients.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/networks/bittorrent/bTClients.ml	2005-09-09 09:02:58.000000000 +0300
@@ -338,6 +338,7 @@
         (*CommonComplexOptions.file_completed*)
         file_completed (as_file file);
         (* Remove the swarmer for this file as it is not useful anymore... *)
+        Int64Swarmer.remove_swarmer file.file_swarmer;
         file.file_swarmer <- None;
         (* At this point, the file state is FileDownloaded. We should not remove
            the file, because we continue to upload. *)
diff -ur ../mldonkey-2.6.4-orig/src/networks/bittorrent/bTInteractive.ml ./src/networks/bittorrent/bTInteractive.ml
--- ../mldonkey-2.6.4-orig/src/networks/bittorrent/bTInteractive.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/networks/bittorrent/bTInteractive.ml	2005-09-09 09:05:31.000000000 +0300
@@ -332,11 +332,12 @@
       Int64Swarmer.verify_all_chunks swarmer true
 
 let op_file_cancel file =
+  Int64Swarmer.remove_swarmer file.file_swarmer;
   file.file_swarmer <- None;
   BTClients.file_stop file;
   remove_file file;
   BTClients.disconnect_clients file;
-  Sys.remove file.file_torrent_diskname
+  if Sys.file_exists file.file_torrent_diskname then Sys.remove file.file_torrent_diskname
 
 let op_ft_cancel ft =
   Hashtbl.remove ft_by_num ft.ft_id
diff -ur ../mldonkey-2.6.4-orig/src/networks/donkey/donkeyInteractive.ml ./src/networks/donkey/donkeyInteractive.ml
--- ../mldonkey-2.6.4-orig/src/networks/donkey/donkeyInteractive.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/networks/donkey/donkeyInteractive.ml	2005-09-09 09:02:58.000000000 +0300
@@ -1387,6 +1387,7 @@
 
   );
   file_ops.op_file_cancel <- (fun file ->
+      Int64Swarmer.remove_swarmer file.file_swarmer;
       file.file_swarmer <- None;
       Hashtbl.remove files_by_md4 file.file_md4;
       current_files := List2.removeq file !current_files;
diff -ur ../mldonkey-2.6.4-orig/src/networks/donkey/donkeyOneFile.ml ./src/networks/donkey/donkeyOneFile.ml
--- ../mldonkey-2.6.4-orig/src/networks/donkey/donkeyOneFile.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/networks/donkey/donkeyOneFile.ml	2005-09-09 09:02:58.000000000 +0300
@@ -135,6 +135,7 @@
 let declare_completed_file file = 
   DonkeyShare.remember_shared_info file (file_disk_name file);
   file_completed (as_file file);
+  Int64Swarmer.remove_swarmer file.file_swarmer;
   file.file_swarmer <- None;
   
   
diff -ur ../mldonkey-2.6.4-orig/src/networks/fileTP/fileTPInteractive.ml ./src/networks/fileTP/fileTPInteractive.ml
--- ../mldonkey-2.6.4-orig/src/networks/fileTP/fileTPInteractive.ml	2005-09-09 05:37:24.000000000 +0300
+++ ./src/networks/fileTP/fileTPInteractive.ml	2005-09-09 09:02:58.000000000 +0300
@@ -68,6 +68,7 @@
   
 let _ =
   file_ops.op_file_cancel <- (fun file ->
+      Int64Swarmer.remove_swarmer file.file_swarmer;
       file.file_swarmer <- None;
       remove_file file;
   );
