1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-24 09:25:01 +00:00

- Update to 2.7.7

- WIP4 has been accepted upstream
- Update pkg-descr

Approved by:	maintainer (inactive for a month)
This commit is contained in:
Andrew Pantyukhin 2006-06-21 11:45:31 +00:00
parent 048927bf0e
commit 2c54540379
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=165909
26 changed files with 14 additions and 5459 deletions

View File

@ -6,8 +6,7 @@
#
PORTNAME= mldonkey
PORTVERSION= 2.7.5
PORTREVISION= 3
PORTVERSION= 2.7.7
CATEGORIES+= net-p2p
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE_EXTENDED} \
${MASTER_SITE_SAVANNAH}
@ -182,8 +181,8 @@ do-install:
.endif
.ifndef(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for file in ${DOCFILES}
@${INSTALL_DATA} ${WRKSRC}/distrib/${file} ${DOCSDIR}
.for _file in ${DOCFILES}
@${INSTALL_DATA} ${WRKSRC}/distrib/${_file} ${DOCSDIR}
.endfor
.endif

View File

@ -1,3 +1,3 @@
MD5 (mldonkey-2.7.5.tar.bz2) = 3e6bcac8c49dd00a563199130aeaf185
SHA256 (mldonkey-2.7.5.tar.bz2) = dd3c521664cfbf67cb8c22aa6635c463333103e51c8152e0b191b92d7ebb38de
SIZE (mldonkey-2.7.5.tar.bz2) = 2815190
MD5 (mldonkey-2.7.7.tar.bz2) = d7b92ae3e8782a3c4adeb0e7870c07dc
SHA256 (mldonkey-2.7.7.tar.bz2) = 8759345bf699b3b349d6db944b36c4f60a5cedf7e314eabf6b3817b8f1052958
SIZE (mldonkey-2.7.7.tar.bz2) = 2847137

View File

@ -1,13 +0,0 @@
--- ./src/daemon/driver/driverMain.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/daemon/driver/driverMain.ml Mon May 15 13:03:12 2006
@@ -74,8 +74,8 @@
CommonInteractive.force_download_quotas ();
CommonResult.dummy_result.result_time <- last_time ();
(try
- CommonSwarming.verify_some_chunks ()
- with _ -> ());
+ CommonSwarming.verify_some_chunks ()
+ with _ -> ());
CommonClient.clear_upload_slots ()
let hourly_timer timer =

View File

@ -1,65 +0,0 @@
--- ./src/networks/bittorrent/bTClients.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/bittorrent/bTClients.ml Mon May 15 13:03:12 2006
@@ -401,7 +401,7 @@
(* This must be a seeded file... *)
String.make (Array.length c.client_file.file_chunks) '3'
| Some swarmer ->
- CommonSwarming.verified_bitmap swarmer
+ CommonSwarming.chunks_verified_bitmap swarmer
in
if !verbose_download then lprintf_nl () "Sending verified bitmap: [%s]" bitmap;
@@ -561,7 +561,7 @@
match c.client_uploader with
None ->
let up = CommonSwarming.register_uploader swarmer (as_client c)
- (AvailableRanges []) in
+ (AvailableIntervals []) in
c.client_uploader <- Some up;
up
| Some up ->
@@ -581,7 +581,7 @@
let chunks = c.client_new_chunks in
c.client_new_chunks <- [];
List.iter (fun n -> Bitv.set bitmap n true) chunks;
- CommonSwarming.update_uploader up (AvailableBitv bitmap);
+ CommonSwarming.update_uploader_intervals up (AvailableBitv bitmap);
end
@@ -691,7 +691,7 @@
c.client_range_waiting <- None;
(x,y,r)
| None ->
- CommonSwarming.find_range up
+ CommonSwarming.find_range up (min max_range_len file.file_piece_size)
in
let (x,y,r) =
@@ -706,7 +706,7 @@
c.client_ranges_sent <- c.client_ranges_sent @ [x,y, r];
(* CommonSwarming.alloc_range r; *)
- let num = CommonSwarming.block_num swarmer b in
+ let num = CommonSwarming.block_chunk_num swarmer b in
if !verbose_swarming then
lprintf_nl () "Asking %d For Range %Ld-%Ld" num x y;
@@ -917,7 +917,7 @@
disconnect_client c (Closed_for_error "Wrong bitfield length")
end else begin
- let verified = CommonSwarming.verified_bitmap swarmer in
+ let verified = CommonSwarming.chunks_verified_bitmap swarmer in
for i = 0 to npieces - 1 do
if is_bit_set p i then begin
@@ -952,7 +952,7 @@
None -> ()
| Some swarmer ->
let n = Int64.to_int n in
- let verified = CommonSwarming.verified_bitmap swarmer in
+ let verified = CommonSwarming.chunks_verified_bitmap swarmer in
(* lprintf_nl "verified: %c;" verified.[n]; *)
(* if the peer has a chunk we don't, tell him we're interested and update his bitmap *)
if verified.[n] < '2' then begin

View File

@ -1,20 +0,0 @@
--- ./src/networks/bittorrent/bTComplexOptions.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/bittorrent/bTComplexOptions.ml Mon May 15 13:03:12 2006
@@ -210,7 +210,7 @@
(match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.value_to_swarmer swarmer assocs;
+ CommonSwarming.value_to_frontend swarmer assocs;
);
(*
@@ -262,7 +262,7 @@
match file.file_swarmer with
None -> assocs
| Some swarmer ->
- CommonSwarming.swarmer_to_value swarmer assocs
+ CommonSwarming.frontend_to_value swarmer assocs
with
e ->
lprintf_nl () "exception %s in file_to_value"

View File

@ -1,25 +0,0 @@
--- ./src/networks/bittorrent/bTGlobals.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/bittorrent/bTGlobals.ml Mon May 15 13:03:12 2006
@@ -150,9 +150,9 @@
(match c.client_block with
None -> true
| Some b ->
- let block_num = CommonSwarming.block_num swarmer b in
- let bitmap = CommonSwarming.verified_bitmap swarmer in
- bitmap.[block_num] <> '3')
+ let chunk_num = CommonSwarming.block_chunk_num swarmer b in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
+ bitmap.[chunk_num] <> '3')
in
if must_send then
begin
@@ -252,8 +252,7 @@
else
set_trackers file [t.torrent_announce];
if file_state <> FileShared then begin
- let kernel = CommonSwarming.create_swarmer file_temp (file_size file)
- (min max_range_len file.file_piece_size) in
+ let kernel = CommonSwarming.create_swarmer file_temp (file_size file) in
let swarmer = CommonSwarming.create kernel (as_file file)
file.file_piece_size in
file.file_swarmer <- Some swarmer;

View File

@ -1,34 +0,0 @@
--- ./src/networks/bittorrent/bTInteractive.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/bittorrent/bTInteractive.ml Mon May 15 13:03:12 2006
@@ -279,7 +279,7 @@
let chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.verified_bitmap swarmer) in
+ CommonSwarming.chunks_verified_bitmap swarmer) in
let header_list = [
( "1", "srh br ac", "Client number", "Num" ) ;
@@ -372,7 +372,7 @@
None ->
lprintf_nl () "verify_chunks: no swarmer to verify chunks"
| Some swarmer ->
- CommonSwarming.verify_all_chunks swarmer true
+ CommonSwarming.verify_all_chunks_immediately swarmer
let remove_all_clients file =
Hashtbl.clear file.file_clients;
@@ -408,11 +408,11 @@
P.file_names = [file.file_name, P.noips()];
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.verified_bitmap swarmer);
+ CommonSwarming.chunks_verified_bitmap swarmer);
P.file_availability =
[network.network_num,(match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.availability swarmer)];
+ CommonSwarming.chunks_availability swarmer)];
P.file_chunks_age = last_seen;
P.file_uids = [Uid.create (BTUrl file.file_id)];

View File

@ -1,38 +0,0 @@
--- ./src/networks/donkey/donkeyClient.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyClient.ml Mon May 15 13:03:12 2006
@@ -862,7 +862,7 @@
match file.file_swarmer with
None -> false
| Some swarmer ->
- let bitmap = CommonSwarming.verified_bitmap swarmer in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
let rec iter bitmap chunks i len =
if i = len then false else
if Bitv.get chunks i && bitmap.[i] < '2' then true else
@@ -879,7 +879,7 @@
match file.file_swarmer with
None -> ()
| Some swarmer ->
- lprintf_nl () " %s" (CommonSwarming.verified_bitmap swarmer);
+ lprintf_nl () " %s" (CommonSwarming.chunks_verified_bitmap swarmer);
end;
let chunks =
@@ -1946,7 +1946,7 @@
asume that we have all chunks! *)
Bitv.create file.file_nchunks true
| Some swarmer ->
- let bitmap = CommonSwarming.verified_bitmap swarmer in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
Bitv.init (String.length bitmap)
(fun i -> bitmap.[i] = '3')
(* This is not very smart, as we might get banned for this request.
@@ -2538,7 +2538,7 @@
match file.file_swarmer with
None -> None
| Some swarmer ->
- let bitmap = CommonSwarming.verified_bitmap swarmer in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
let chunks =
Bitv.init (String.length bitmap)
(fun i -> bitmap.[i] = '3')

View File

@ -1,20 +0,0 @@
--- ./src/networks/donkey/donkeyComplexOptions.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyComplexOptions.ml Mon May 15 13:03:12 2006
@@ -297,7 +297,7 @@
(match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.value_to_swarmer swarmer assocs;
+ CommonSwarming.value_to_frontend swarmer assocs;
CommonSwarming.set_verifier swarmer (if md4s = [||] then
VerificationNotAvailable
else
@@ -321,7 +321,7 @@
match file.file_swarmer with
None -> fields
| Some swarmer ->
- CommonSwarming.swarmer_to_value swarmer fields
+ CommonSwarming.frontend_to_value swarmer fields
in
fields

View File

@ -1,11 +0,0 @@
--- ./src/networks/donkey/donkeyGlobals.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyGlobals.ml Mon May 15 13:03:12 2006
@@ -397,7 +397,7 @@
(match file_state with
FileShared -> ()
| _ ->
- let kernel = CommonSwarming.create_swarmer file_diskname file_size zone_size in
+ let kernel = CommonSwarming.create_swarmer file_diskname file_size in
let swarmer = CommonSwarming.create kernel (as_file file) block_size
in
file.file_swarmer <- Some swarmer;

View File

@ -1,45 +0,0 @@
--- ./src/networks/donkey/donkeyInteractive.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyInteractive.ml Mon May 15 13:03:12 2006
@@ -507,7 +507,7 @@
match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.verify_all_chunks swarmer false
+ CommonSwarming.verify_all_chunks swarmer
(*
if file.file_chunks <> [||] then
@@ -613,7 +613,7 @@
match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.verify_all_chunks swarmer true
+ CommonSwarming.verify_all_chunks_immediately swarmer
let register_commands list =
register_commands
@@ -1044,13 +1044,13 @@
P.file_chunks =
(match file.file_swarmer with
| None -> ""
- | Some swarmer -> CommonSwarming.verified_bitmap swarmer);
+ | Some swarmer -> CommonSwarming.chunks_verified_bitmap swarmer);
P.file_availability =
[
network.network_num,
(match file.file_swarmer with
| None -> ""
- | Some swarmer -> CommonSwarming.availability swarmer)
+ | Some swarmer -> CommonSwarming.chunks_availability swarmer)
];
P.file_format = file.file_format;
P.file_chunks_age = last_seen;
@@ -1305,7 +1305,7 @@
let chunks =
(match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.verified_bitmap swarmer)
+ CommonSwarming.chunks_verified_bitmap swarmer)
in
html_mods_table_header buf "sourcesTable" "sources al" ([

View File

@ -1,48 +0,0 @@
--- ./src/networks/donkey/donkeyOneFile.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyOneFile.ml Mon May 15 13:03:12 2006
@@ -166,7 +166,7 @@
match file.file_swarmer with
None -> ()
| Some swarmer ->
- let bitmap = CommonSwarming.verified_bitmap swarmer in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
(* lprintf "Verified bitmap: [%s]\n" bitmap; *)
let rec iter i =
if i = String.length bitmap then true
@@ -197,7 +197,7 @@
match file.file_swarmer with
None -> ()
| Some swarmer ->
- let bitmap = CommonSwarming.verified_bitmap swarmer in
+ let bitmap = CommonSwarming.chunks_verified_bitmap swarmer in
let rec iter i len =
if i < len then
if bitmap.[i] = '3' then
@@ -217,7 +217,7 @@
(f, chunks, up) :: tail ->
if f != file then iter tail
else begin
- CommonSwarming.update_uploader up
+ CommonSwarming.update_uploader_intervals up
(AvailableBitv client_chunks);
Bitv.blit client_chunks 0 chunks 0 (Bitv.length chunks)
end
@@ -239,8 +239,7 @@
match c.client_download with
None -> ()
| Some (file, up) ->
- CommonSwarming.clear_uploader_block up;
- CommonSwarming.clear_uploader_ranges up;
+ CommonSwarming.unregister_uploader up;
c.client_download <- None
let send_get_range_request c file ranges =
@@ -333,7 +332,7 @@
let rec iter n =
if n < 3 then
try
- ignore (CommonSwarming.find_range up);
+ ignore (CommonSwarming.find_range up zone_size);
iter (n+1)
with
Not_found -> n

View File

@ -1,29 +0,0 @@
--- ./src/networks/donkey/donkeyShare.ml.orig Sat Apr 8 21:26:40 2006
+++ ./src/networks/donkey/donkeyShare.ml Mon May 15 13:03:12 2006
@@ -107,7 +107,7 @@
(* file.file_all_chunks <- String.make file.file_nchunks '1'; *)
(* Should we trust mtimes, or reverify each file. If we trust
* mtimes, I guess we have to call
- * CommonSwarming.set_verified_bitmap "333..."
+ * CommonSwarming.set_chunks_verified_bitmap "333..."
* this seems unspeakably ugly, but the alternative is to reverify
* every shared file every hour.
*
@@ -122,7 +122,7 @@
match file.file_swarmer with
Some s -> (let len = Array.length md4s in
let ver_str = String.make len '3' in
- CommonSwarming.set_verified_bitmap s ver_str;
+ CommonSwarming.set_chunks_verified_bitmap s ver_str;
(*
CommonSwarming.set_present s [(Int64.zero, file_size file)];
(* If we don't verify now, it will never happen! *)
@@ -130,7 +130,7 @@
*)
if !verbose_share then
lprintf_nl () "verified map of %s = %s"
- (codedname) (CommonSwarming.verified_bitmap s))
+ (codedname) (CommonSwarming.chunks_verified_bitmap s))
| None -> if !verbose_share then lprintf_nl () "no swarmer for %s" codedname;
(try
file.file_format <- CommonMultimedia.get_info

View File

@ -1,11 +0,0 @@
--- ./src/networks/fasttrack/fasttrackGlobals.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/fasttrack/fasttrackGlobals.ml Mon May 15 13:03:12 2006
@@ -298,7 +298,7 @@
}
in
incr search_num;
- let kernel = CommonSwarming.create_swarmer file_temp file_size min_range_size in
+ let kernel = CommonSwarming.create_swarmer file_temp file_size in
let swarmer = CommonSwarming.create kernel (as_file file)
file_chunk_size in
file.file_swarmer <- Some swarmer;

View File

@ -1,22 +0,0 @@
--- ./src/networks/fileTP/fileTPClients.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/fileTP/fileTPClients.ml Mon May 15 13:03:12 2006
@@ -188,8 +188,8 @@
lprintf "Current Block: "; CommonSwarming.print_block b;
end;
try
- let (x,y,r) = CommonSwarming.find_range up in
-
+ let (x,y,r) =
+ CommonSwarming.find_range up min_range_size in
(* lprintf "GOT RANGE:\n"; *)
if !verbose_swarming then CommonSwarming.print_uploaders swarmer;
@@ -269,7 +269,7 @@
let chunks = [ Int64.zero, file_size file ] in
let up = CommonSwarming.register_uploader swarmer
(as_client c)
- (AvailableRanges chunks) in
+ (AvailableIntervals chunks) in
d.download_uploader <- Some up
) c.client_downloads;

View File

@ -1,20 +0,0 @@
--- ./src/networks/fileTP/fileTPComplexOptions.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/fileTP/fileTPComplexOptions.ml Mon May 15 13:03:12 2006
@@ -84,7 +84,7 @@
(match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.value_to_swarmer swarmer assocs;
+ CommonSwarming.value_to_frontend swarmer assocs;
);
(try
@@ -118,7 +118,7 @@
match file.file_swarmer with
None -> assocs
| Some swarmer ->
- CommonSwarming.swarmer_to_value swarmer assocs
+ CommonSwarming.frontend_to_value swarmer assocs
let old_files =
define_option fileTP_section ["old_urls"]

View File

@ -1,11 +0,0 @@
--- ./src/networks/fileTP/fileTPGlobals.ml.orig Mon Apr 10 16:16:13 2006
+++ ./src/networks/fileTP/fileTPGlobals.ml Mon May 15 13:03:12 2006
@@ -120,7 +120,7 @@
in
file.file_file.impl_file_size <- size;
let file_temp = Unix32.filename (file_fd file) in
- let kernel = CommonSwarming.create_swarmer file_temp size min_range_size in
+ let kernel = CommonSwarming.create_swarmer file_temp size in
let swarmer = CommonSwarming.create kernel (as_file file)
file_chunk_size in
file.file_swarmer <- Some swarmer;

View File

@ -1,16 +0,0 @@
--- ./src/networks/fileTP/fileTPInteractive.ml.orig Mon Apr 10 16:16:13 2006
+++ ./src/networks/fileTP/fileTPInteractive.ml Mon May 15 13:03:12 2006
@@ -90,11 +90,11 @@
P.file_download_rate = file_download_rate file.file_file;
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.verified_bitmap swarmer);
+ CommonSwarming.chunks_verified_bitmap swarmer);
P.file_availability =
[network.network_num,(match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.availability swarmer)];
+ CommonSwarming.chunks_availability swarmer)];
P.file_format = FormatNotComputed 0;
P.file_chunks_age = [|0|];
P.file_age = file_age file;

View File

@ -1,21 +0,0 @@
--- ./src/networks/gnutella/gnutellaClients.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/gnutella/gnutellaClients.ml Mon May 15 13:03:12 2006
@@ -479,7 +479,7 @@
let chunks = [ Int64.zero, file_size file ] in
let up = CommonSwarming.register_uploader swarmer
(as_client c)
- (AvailableRanges chunks) in
+ (AvailableIntervals chunks) in
d.download_uploader <- Some up;
up
@@ -536,7 +536,8 @@
end;
*)
try
- let (x,y,r) = CommonSwarming.find_range up in
+ let (x,y,r) =
+ CommonSwarming.find_range up (Int64.of_int (256 * 1024)) in
if !verbose_swarming then begin
lprintf "GOT RANGE:\n";

View File

@ -1,29 +0,0 @@
--- ./src/networks/gnutella/gnutellaComplexOptions.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/gnutella/gnutellaComplexOptions.ml Mon May 15 13:03:12 2006
@@ -140,7 +140,7 @@
(match file.file_swarmer with
None -> ()
| Some swarmer ->
- CommonSwarming.value_to_swarmer swarmer assocs;
+ CommonSwarming.value_to_frontend swarmer assocs;
CommonSwarming.set_verifier swarmer (
match file.file_ttr with
None -> ForceVerification
@@ -183,7 +183,7 @@
(* "file_present_chunks", List
(List.map (fun (i1,i2) ->
SmallList [int64_to_value i1; int64_to_value i2])
- (CommonSwarming.present_chunks file.file_swarmer));
+ (CommonSwarming.present_intervals file.file_swarmer));
*)
]
in
@@ -196,7 +196,7 @@
match file.file_swarmer with
None -> assocs
| Some swarmer ->
- CommonSwarming.swarmer_to_value swarmer assocs
+ CommonSwarming.frontend_to_value swarmer assocs
(*

View File

@ -1,12 +0,0 @@
--- ./src/networks/gnutella/gnutellaGlobals.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/gnutella/gnutellaGlobals.ml Mon May 15 13:03:12 2006
@@ -325,8 +325,7 @@
in
if !verbose then
lprintf "SET SIZE : %Ld\n" file_size;
- let kernel = CommonSwarming.create_swarmer file_temp file_size
- (Int64.of_int (256 * 1024)) in
+ let kernel = CommonSwarming.create_swarmer file_temp file_size in
let swarmer = CommonSwarming.create kernel (as_file file) megabyte in
CommonSwarming.set_verifier swarmer ForceVerification;

View File

@ -1,25 +0,0 @@
--- ./src/networks/gnutella/gnutellaInteractive.ml.orig Sat Apr 8 21:26:41 2006
+++ ./src/networks/gnutella/gnutellaInteractive.ml Mon May 15 13:03:12 2006
@@ -252,7 +252,7 @@
match file.file_ttr with
None -> failwith "No TTR for verification"
| Some ttt ->
- CommonSwarming.verify_all_chunks swarmer true
+ CommonSwarming.verify_all_chunks_immediately swarmer
);
file_ops.op_file_recover <- (fun file ->
@@ -289,11 +289,11 @@
P.file_chunks = (match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.verified_bitmap swarmer);
+ CommonSwarming.chunks_verified_bitmap swarmer);
P.file_availability = [network.network_num,
(match file.file_swarmer with
None -> "" | Some swarmer ->
- CommonSwarming.availability swarmer)];
+ CommonSwarming.chunks_availability swarmer)];
P.file_chunks_age = [|0|];
P.file_last_seen = BasicSocket.last_time ();

View File

@ -1,23 +0,0 @@
--- src/utils/lib/stubs_c.c.orig Wed Jan 4 12:23:37 2006
+++ src/utils/lib/stubs_c.c Mon Jan 16 14:14:38 2006
@@ -28,6 +28,11 @@
#include <inttypes.h>
#endif
+/* For proper FreeBSD version identification */
+#if defined(HAVE_SYS_PARAM_H)
+#include <sys/param.h>
+#endif
+
#define lseek XXXXXXXXX
#define read XXXXXXXXX
#define ftruncate XXXXXXXXX
@@ -683,7 +688,7 @@
#define NETDB_BUFFER_SIZE 10000
-#ifdef _WIN32
+#if defined(_WIN32) || ( defined(__FreeBSD_version) && ( ((__FreeBSD_version >= 504102) && (__FreeBSD_version < 600000)) || (__FreeBSD_version >= 600029) ) )
#define GETHOSTBYADDR_IS_REENTRANT 1
#define GETHOSTBYNAME_IS_REENTRANT 1
#endif

View File

@ -1,203 +0,0 @@
--- src/utils/net/ip.ml.orig Wed Mar 29 12:41:10 2006
+++ src/utils/net/ip.ml Sun May 14 17:24:09 2006
@@ -17,52 +17,56 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
+(* This module uses 2 ints to save IPv4 numbers. *)
+
open Int64ops
open Printf2
-type t = int * int * int * int
+type t = { hi: int; lo: int }
-external of_string : string -> t = "ml_ints_of_string"
+let of_ints (a,b,c,d) =
+ { hi = (a lsl 8) lor b;
+ lo = (c lsl 8) lor d; }
-let allow_local_network = ref false
+let to_ints t =
+ t.hi lsr 8, t.hi land 255,
+ t.lo lsr 8, t.lo land 255
-let of_inet_addr t =
- of_string (Unix.string_of_inet_addr t)
+external ints_of_string : string -> (int*int*int*int) = "ml_ints_of_string"
-let any = of_inet_addr Unix.inet_addr_any
+let of_string s =
+ of_ints (ints_of_string s)
-let null = (0,0,0,0)
+let to_string t =
+ let (a4, a3, a2, a1) = to_ints t in
+ Printf.sprintf "%d.%d.%d.%d" a4 a3 a2 a1
-let of_ints t = t
+let allow_local_network = ref false
-let to_ints t = t
-let to_string (a4, a3, a2, a1) =
- Printf.sprintf "%d.%d.%d.%d" a4 a3 a2 a1
+let of_inet_addr ia =
+ of_string (Unix.string_of_inet_addr ia)
+
+let any = of_inet_addr Unix.inet_addr_any
+
+let null = { hi = 0; lo = 0; }
let to_inet_addr t =
Unix.inet_addr_of_string (to_string t)
let hostname_table = Hashtbl.create 997
-let to_fixed_string ((a4, a3, a2, a1) as t)=
+let to_fixed_string t =
+ let (a4, a3, a2, a1) = to_ints t in
try
Hashtbl.find hostname_table t
with _ ->
Printf.sprintf "%03d.%03d.%03d.%03d" a4 a3 a2 a1
-let to_int64 (a4, a3, a2, a1) =
- let small = a1 lor (a2 lsl 8) lor (a3 lsl 16) in
- (Int64.of_int small) ++ (Int64.shift_left (Int64.of_int a4) 24)
+let to_int64 t =
+ Int64.logor (Int64.shift_left (Int64.of_int t.hi) 16) (Int64.of_int t.lo)
let of_int64 i =
- let a4 = Int64.to_int (Int64.logand (Int64.shift_right i 24) 0xffL)
- in
- let a3 = Int64.to_int (Int64.logand (Int64.shift_right i 16) 0xffL)
- in
- let a2 = Int64.to_int (Int64.logand (Int64.shift_right i 8) 0xffL)
- in
- let a1 = Int64.to_int (Int64.logand i 0xffL)
- in
- (a4, a3, a2, a1)
+ { hi = Int64.to_int (Int64.shift_right i 16);
+ lo = Int64.to_int (Int64.logand i 65535L); }
let resolve_one t =
try
@@ -79,13 +83,15 @@
end;
to_fixed_string t
-let valid (j,k,l,i) =
+let valid t =
+ let (j,k,l,i) = to_ints t in
j > 0 && j < 224 &&
k >= 0 && k <= 255 &&
l >= 0 && l <= 255 &&
i >= 0 && i <= 255
-let local_ip ip =
+let local_ip t =
+ let ip = to_ints t in
match ip with
192, 168,_,_ -> true
| 10, _, _, _ | 127, _,_,_ -> true
@@ -98,48 +104,38 @@
let usable ip =
reachable ip && valid ip
-let rec matches ((a4,a3,a2,a1) as a) ips =
- match ips with
- [] -> false
- | (b4,b3,b2,b1) :: tail ->
- ( (a4 = b4 || b4 = 255) &&
- (a3 = b3 || b3 = 255) &&
- (a2 = b2 || b2 = 255) &&
- (a1 = b1 || b1 = 255))
- || (matches a tail)
+let matches t ips =
+ let (a4,a3,a2,a1) = to_ints t in
+ let rec matches_aux ips =
+ match ips with
+ [] -> false
+ | b :: tail ->
+ let (b4,b3,b2,b1) = to_ints b in
+ ( (a4 = b4 || b4 = 255) &&
+ (a3 = b3 || b3 = 255) &&
+ (a2 = b2 || b2 = 255) &&
+ (a1 = b1 || b1 = 255))
+ || (matches_aux tail) in
+ matches_aux ips
-let compare (a4,a3,a2,a1) (b4,b3,b2,b1) =
- let c4 = compare a4 b4 in
- if c4 <> 0 then c4 else
- let c3 = compare a3 b3 in
- if c3 <> 0 then c3 else
- let c2 = compare a2 b2 in
- if c2 <> 0 then c2 else
- compare a1 b1
+let compare a b =
+ let hicompare = compare a.hi b.hi in
+ if hicompare <> 0 then
+ hicompare
+ else
+ compare a.lo b.lo
-let succ (a4,a3,a2,a1) =
- if a1 < 255 then
- (a4,a3,a2,a1+1)
- else if a2 < 255 then
- (a4,a3,a2+1,0)
- else if a3 < 255 then
- (a4,a3+1,0,0)
- else if a4 < 255 then
- (a4+1,0,0,0)
+let succ t =
+ if t.lo < 65535 then
+ { t with lo = t.lo+1 }
else
- (0,0,0,0) (* or exception ? *)
+ { hi = t.hi+1; lo = 0; }
-let pred (a4,a3,a2,a1) =
- if a1 > 0 then
- (a4,a3,a2,a1-1)
- else if a2 > 0 then
- (a4,a3,a2-1,255)
- else if a3 > 0 then
- (a4,a3-1,255,255)
- else if a4 > 0 then
- (a4-1,255,255,255)
+let pred t =
+ if t.lo > 0 then
+ { t with lo = t.lo-1 }
else
- (255,255,255,255) (* or exception ? *)
+ { hi = t.hi-1; lo = 65535; }
let banned = ref (fun (ip:t) -> None)
@@ -154,7 +150,7 @@
[] -> raise Not_found
| ip :: tail ->
let ip = of_inet_addr ip in
- if ip = (127,0,0,1) then
+ if ip = localhost then
iter tail
else ip
in
@@ -225,12 +221,12 @@
let option = define_option_class "Ip" value_to_ip ip_to_value
-let rev (a1,a2,a3,a4) = (a4,a3,a2,a1)
+let rev t =
+ let (a4,a3,a2,a1) = to_ints t in
+ of_ints (a1,a2,a3,a4)
let equal a b =
- let (a1,a2,a3,a4) = a in
- let (b1,b2,b3,b4) = b in
- ( a1=b1 && a2=b2 && a3=b3 && a4=b4)
+ a = b
type job = {
name : string;

View File

@ -1,19 +1,17 @@
mldonkey is a OCAML/GTK client for a number of
MLDonkey is an OCAML/GTK client for a number of
peer-to-peer networks.
It is separated into a core with telnet and web interfaces, and
a GTK GUI.
It is separated into a core with telnet and web
interfaces, and a GTK GUI.
The following protocols are supported:
- eDonkey (http://www.edonkey2000.com/)
- Overnet (http://www.overnet.com/)
- Bittorrent (http://bitconjurer.org/BitTorrent/)
- Bittorrent (http://www.bittorrent.com/)
- Gnutella (http://www.gnutella.org/)
- Gnutella2 (http://www.shareaza.com/)
- Fasttrack
- Soulseek (http://www.slsk.org/)
- Direct-Connect (http://www.neo-modus.com/)
- Opennap (http://opennap.sourceforge.net/)
- Kademlia
- Fasttrack (http://en.wikipedia.org/wiki/Fasttrack)
- FileTP [http/ftp/ssh] (http://mldonkey.sourceforge.net/FileTP)
- Kademlia (http://en.wikipedia.org/wiki/Kad_Network)
WWW: http://www.nongnu.org/mldonkey/
WWW: http://mldonkey.sourceforge.net/