pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/mldonkey Add (official) patch to fix following pro...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/448fd8605b44
branches:  trunk
changeset: 523802:448fd8605b44
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Sat Jan 13 18:41:32 2007 +0000

description:
Add (official) patch to fix following problem:

MLDonkey has a very serious bug which leeds to uploading
data blocks twice to eMule clients.

This is due to the fact that MLDonkey gets confused by
eMule rotating block request scheme.

http://hydranode.com/docs/ed2k/ed2kproto.php#upload
> Namely, eMule (and compatible) clients use "rotational chunkrequest"
scheme,
> where each REQCHUNKS packet contains one new chunk and two older chunks
> ...
> This can lead to duplicate data being sent by mldonkeys, if a rotational
> chunkrequest scheme is used when communicating with them.

More infos about it, including logs proving the problem, can be found here:
http://mldonkey.sourceforge.net/forums/viewtopic.php?t=4576

Bump PKGREVISION.

diffstat:

 net/mldonkey/Makefile         |   3 +-
 net/mldonkey/distinfo         |   5 ++-
 net/mldonkey/patches/patch-aa |  75 +++++++++++++++++++++++++++++++++++++++++++
 net/mldonkey/patches/patch-ab |  48 +++++++++++++++++++++++++++
 net/mldonkey/patches/patch-ac |  13 +++++++
 5 files changed, 142 insertions(+), 2 deletions(-)

diffs (174 lines):

diff -r 698a8f1d422d -r 448fd8605b44 net/mldonkey/Makefile
--- a/net/mldonkey/Makefile     Sat Jan 13 18:41:23 2007 +0000
+++ b/net/mldonkey/Makefile     Sat Jan 13 18:41:32 2007 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.42 2006/09/16 06:21:39 wiz Exp $
+# $NetBSD: Makefile,v 1.43 2007/01/13 18:41:32 wiz Exp $
 #
 
 .include "Makefile.common"
+PKGREVISION=           1
 
 RCD_SCRIPTS=           mldonkey
 
diff -r 698a8f1d422d -r 448fd8605b44 net/mldonkey/distinfo
--- a/net/mldonkey/distinfo     Sat Jan 13 18:41:23 2007 +0000
+++ b/net/mldonkey/distinfo     Sat Jan 13 18:41:32 2007 +0000
@@ -1,5 +1,8 @@
-$NetBSD: distinfo,v 1.33 2006/12/05 11:05:13 wiz Exp $
+$NetBSD: distinfo,v 1.34 2007/01/13 18:41:32 wiz Exp $
 
 SHA1 (mldonkey-2.8.2.tar.bz2) = 510fad86b4c83b54a7e8836cec3a3f30d67aed8a
 RMD160 (mldonkey-2.8.2.tar.bz2) = ce95184805ac8f4c690e37c75d418b5f7e265f92
 Size (mldonkey-2.8.2.tar.bz2) = 2652074 bytes
+SHA1 (patch-aa) = 80045d742084ed024ddff515fee79a520c666c67
+SHA1 (patch-ab) = 0d0b0bd6b4c699ff0dbe69f07106b3a235223e67
+SHA1 (patch-ac) = 82b523066574f94ae238eaa7ba95e4823c41a49f
diff -r 698a8f1d422d -r 448fd8605b44 net/mldonkey/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mldonkey/patches/patch-aa     Sat Jan 13 18:41:32 2007 +0000
@@ -0,0 +1,75 @@
+$NetBSD: patch-aa,v 1.13 2007/01/13 18:41:32 wiz Exp $
+
+--- src/networks/donkey/donkeyClient.ml.orig   2006-11-26 16:36:29.000000000 +0000
++++ src/networks/donkey/donkeyClient.ml
+@@ -442,15 +442,17 @@ let client_wants_file c md4 =
+   
+ let new_chunk up begin_pos end_pos =
+   if begin_pos <> end_pos then
+-    let pair = (begin_pos, end_pos) in
+-    (match up.up_chunks with
+-        [] ->
++    let chunk = (begin_pos, end_pos) in
++    (* the zone requested is already "in the pipe" *)
++    if not (List.mem chunk up.up_flying_chunks) then
++      match up.up_chunks with
++      | [] ->
+           up.up_pos <- begin_pos;
+           up.up_end_chunk <- end_pos;
+-          up.up_chunks <- [pair];
+-      | chunks ->
+-          if not (List.mem pair chunks) then
+-            up.up_chunks <- chunks @ [pair])
++          up.up_chunks <- [chunk];
++      | up_chunks ->
++          if not (List.mem chunk up_chunks) then
++            up.up_chunks <- up_chunks @ [chunk]
+   
+ let identify_client_brand c =
+   if c.client_brand = Brand_unknown then
+@@ -2039,13 +2041,21 @@ end else *)
+         set_rtimeout sock !!upload_timeout;
+         
+         let up, waiting = match c.client_upload with
+-            Some ({ up_file = f } as up) when f == file ->  up, up.up_waiting
++          | Some ({ up_file = f } as up) when f == file ->
++            (* zones are received in the order they're sent, so we
++               know that the oldest of the zones "in fly" must have
++               been received when this QueryBlockReq was sent *)
++            (match up.up_flying_chunks with
++             | [] -> () 
++             | _ :: q -> up.up_flying_chunks <- q);
++            up, up.up_waiting
+           | Some old_up ->
+               {
+                 up_file = file;
+                 up_pos = Int64.zero;
+                 up_end_chunk = Int64.zero;
+                 up_chunks = [];
++              up_flying_chunks = [];
+                 up_waiting = old_up.up_waiting;
+               }, old_up.up_waiting
+           | _ ->
+@@ -2054,6 +2064,7 @@ end else *)
+                 up_pos = Int64.zero;
+                 up_end_chunk = Int64.zero;
+                 up_chunks = [];
++              up_flying_chunks = [];
+                 up_waiting = false;
+               }, false
+         in
+@@ -2141,12 +2152,12 @@ make 1500 connections/10 minutes.  *)
+ let init_client sock c =
+   set_handler sock WRITE_DONE (fun s ->
+       match c.client_upload with
+-        None -> ()
+-      | Some up ->
++      | Some ({ up_chunks = _ :: _ } as up) ->
+           if not up.up_waiting && !CommonUploads.has_upload = 0 then begin
+               up.up_waiting <- true;
+               CommonUploads.ready_for_upload (as_client c)
+             end
++      | _ -> ()
+   );
+ (*
+   set_handler sock (BASIC_EVENT RTIMEOUT) (fun s ->
diff -r 698a8f1d422d -r 448fd8605b44 net/mldonkey/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mldonkey/patches/patch-ab     Sat Jan 13 18:41:32 2007 +0000
@@ -0,0 +1,48 @@
+$NetBSD: patch-ab,v 1.3 2007/01/13 18:41:32 wiz Exp $
+
+--- src/networks/donkey/donkeyFiles.ml.orig    2006-11-21 22:34:33.000000000 +0000
++++ src/networks/donkey/donkeyFiles.ml
+@@ -123,7 +123,7 @@ module NewUpload = struct
+ (*      lprintf "send_client_block\n"; *)
+       if per_client > 0 && CommonUploads.can_write_len sock max_msg_size then
+         match c.client_upload with
+-        | Some ({ up_chunks = _ :: chunks } as up)  ->
++        | Some ({ up_chunks = current_chunk :: chunks } as up)  ->
+             if up.up_file.file_shared = None then begin
+ (* Is there a message to warn that a file is not shared anymore ? *)
+                 c.client_upload <- None;
+@@ -134,16 +134,17 @@ module NewUpload = struct
+             if max_len <= msg_block_size_int then
+ (* last block from chunk *)
+               begin
++                send_small_block c sock up.up_file up.up_pos max_len;
+                 if !verbose_upload then
+                     lprintf_nl "End of chunk (%d) %Ld %s" max_len up.up_end_chunk (file_best_name up.up_file);
+-                send_small_block c sock up.up_file up.up_pos max_len;
++              up.up_flying_chunks <- up.up_flying_chunks @ [current_chunk];
+                 up.up_chunks <- chunks;
+                 let per_client = per_client - max_len in
+                 match chunks with
+-                  [] -> 
++              | [] -> 
+                     if !verbose_upload then
+-                        lprintf_nl "NO CHUNKS";
+-                    c.client_upload <- None;
++                        lprintf_nl "NO MORE CHUNKS";
++                  up.up_waiting <- false;
+                 | (begin_pos, end_pos) :: _ ->
+                     up.up_pos <- begin_pos;
+                     up.up_end_chunk <- end_pos;
+@@ -168,10 +169,10 @@ module NewUpload = struct
+           let size = min max_msg_size size in
+           send_client_block c sock size;
+            (match c.client_upload with
+-              None -> ()
+-            | Some up ->
++            | Some ({ up_chunks = _ :: _ }) ->
+                 if !CommonUploads.has_upload = 0 then
+                   CommonUploads.ready_for_upload (as_client c)
++          | _ -> ()
+           )
+       )
+     let _ =
diff -r 698a8f1d422d -r 448fd8605b44 net/mldonkey/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/mldonkey/patches/patch-ac     Sat Jan 13 18:41:32 2007 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.3 2007/01/13 18:41:32 wiz Exp $
+
+--- src/networks/donkey/donkeyTypes.ml.orig    2006-11-26 16:36:29.000000000 +0000
++++ src/networks/donkey/donkeyTypes.ml
+@@ -602,6 +602,8 @@ and upload_info = {
+     mutable up_pos : int64;
+     mutable up_end_chunk : int64;
+     mutable up_chunks : (int64 * int64) list;
++    (* zones sent but not yet received by other peer, oldest first *)
++    mutable up_flying_chunks : (int64 * int64) list; 
+     mutable up_waiting : bool;
+   }
+ 



Home | Main Index | Thread Index | Old Index