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-07 11:52:25.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-07 11:52:25.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-07 11:52:25.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-07 11:52:25.000000000 +0300
@@ -302,6 +302,16 @@
 
 (*************************************************************************)
 (*                                                                       *)
+(*                         Remove swarmer                                *)
+(*                                                                       *)
+(*************************************************************************)
+
+let remove_swarmer file_swarmer =
+  let swarmer = match file_swarmer with None -> assert false | Some sw -> sw.t_s in
+  HS.remove swarmers_by_name swarmer
+
+(*************************************************************************)
+(*                                                                       *)
 (*                         compute_block_end (internal)                  *)
 (*                                                                       *)
 (*************************************************************************)
diff -ur ../mldonkey-2.6.4-orig/src/daemon/common/commonTypes.ml ./src/daemon/common/commonTypes.ml
--- ../mldonkey-2.6.4-orig/src/daemon/common/commonTypes.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/daemon/common/commonTypes.ml	2005-09-07 11:52:25.000000000 +0300
@@ -847,3 +847,5 @@
     | Known_location (ip,port) -> Ip.to_string ip
     | _ -> "firewalled"
   with _ -> ""
+
+let found = ref 0
\ No newline at end of file
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-07 11:52:25.000000000 +0300
@@ -50,6 +50,12 @@
 let _s x = _s "BTInteractive" x
 let _b x = _b "BTInteractive" x
 
+let toremove_swarmer file file_swarmer =
+  found := 0;
+  let files = List2.removeq file !current_files in
+  List.iter (fun file -> if file_swarmer = file.file_swarmer then found := 1) files;
+  if !found = 0 then Int64Swarmer.remove_swarmer file_swarmer
+
 (* prints a new logline with date, module and starts newline *)
 let lprintf_nl () =
   lprintf "%s[BT] "
@@ -332,6 +338,7 @@
       Int64Swarmer.verify_all_chunks swarmer true
 
 let op_file_cancel file =
+  toremove_swarmer file file.file_swarmer;
   file.file_swarmer <- None;
   BTClients.file_stop file;
   remove_file file;
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-07 11:52:25.000000000 +0300
@@ -54,6 +54,12 @@
 open CommonOptions
 open DonkeyStats
 
+let toremove_swarmer file file_swarmer =
+  found := 0;
+  let files = List2.removeq file !current_files in
+  List.iter (fun file -> if file_swarmer = file.file_swarmer then found := 1) files;
+  if !found = 0 then Int64Swarmer.remove_swarmer file_swarmer
+
 (* prints a new logline with date, module and starts newline *)
 let lprintf_nl () =
   lprintf "%s[EDK] "
@@ -1387,6 +1393,7 @@
 
   );
   file_ops.op_file_cancel <- (fun file ->
+      toremove_swarmer file 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/fileTP/fileTPInteractive.ml ./src/networks/fileTP/fileTPInteractive.ml
--- ../mldonkey-2.6.4-orig/src/networks/fileTP/fileTPInteractive.ml	2005-09-07 11:52:11.000000000 +0300
+++ ./src/networks/fileTP/fileTPInteractive.ml	2005-09-07 11:53:07.000000000 +0300
@@ -55,6 +55,12 @@
 let file_num file =
   file.file_file.impl_file_num
 
+let toremove_swarmer file file_swarmer =
+  found := 0;
+  let files = List2.removeq file !current_files in
+  List.iter (fun file -> if file_swarmer = file.file_swarmer then found := 1) files;
+  if !found = 0 then Int64Swarmer.remove_swarmer file_swarmer
+  
 let _ =
   file_ops.op_file_all_sources <- (fun file ->
 (*      lprintf "file_sources\n";  *)
@@ -68,6 +74,7 @@
 
 let _ =
   file_ops.op_file_cancel <- (fun file ->
+      toremove_swarmer file file.file_swarmer;
       file.file_swarmer <- None;
       remove_file file;
   );
