[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co... |
Date: |
Thu, 14 Sep 2006 17:34:34 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/09/14 17:34:34
Modified files:
distrib : ChangeLog
src/daemon/common: commonSwarming.ml
Log message:
patch #5389
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1003&r2=1.1004
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonSwarming.ml?cvsroot=mldonkey&r1=1.53&r2=1.54
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1003
retrieving revision 1.1004
diff -u -b -r1.1003 -r1.1004
--- distrib/ChangeLog 14 Sep 2006 17:31:00 -0000 1.1003
+++ distrib/ChangeLog 14 Sep 2006 17:34:34 -0000 1.1004
@@ -15,6 +15,7 @@
=========
2006/09/14
+5389: Fix verify_chunks (pango)
5388: Small log update
2006/09/13
Index: src/daemon/common/commonSwarming.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonSwarming.ml,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- src/daemon/common/commonSwarming.ml 3 Sep 2006 11:47:33 -0000 1.53
+++ src/daemon/common/commonSwarming.ml 14 Sep 2006 17:34:34 -0000 1.54
@@ -1086,23 +1086,27 @@
(*************************************************************************)
(* For every swarmer, there is a "primary" verifier, and secondary
- verifiers. When a block is downloaded, it is tagged State_complete in the
- verified_bitmap, and this State_complete is propagated to the primary
bitmap if
- possible (if all sub-blocks are also State_complete). If the primary chunk
- becomes State_complete, then a verification is needed on the primary. If the
- verification works, the verified_bitmap becomes State_verified, and the
secondary
- verifiers are tagged with State_complete (if they use a different
verification
- scheme) or State_verified (if no verification scheme or a verification
scheme
- that has already been used). *)
+ verifiers. When a block is downloaded, it is tagged State_complete
+ in the verified_bitmap, and this State_complete is propagated to
+ the primary bitmap if possible (if all sub-blocks are also
+ State_complete).
+
+ If the primary chunk becomes State_complete, then a verification is
+ needed on the primary. If the verification works, the
+ verified_bitmap becomes State_verified, and the secondary verifiers
+ are tagged with State_complete (if they use a different
+ verification scheme) or State_verified (if no verification scheme
+ or a verification scheme that has already been used).
+*)
+
+(* corruption has been detected, and the block has been reset to
+ State_missing *)
-(* corruption has been detected, and the block has been reset to 0 *)
let set_swarmer_state_missing s i =
- (* shouldn't it be > VB.State_missing ? *)
let current_state = VB.get s.s_verified_bitmap i in
- if (match current_state with
- | VB.State_missing | VB.State_partial -> false
- | VB.State_complete | VB.State_verified -> true) then begin
- VB.set s.s_verified_bitmap i VB.State_missing;
+ match current_state with
+ | VB.State_complete | VB.State_verified ->
+ (VB.set s.s_verified_bitmap i VB.State_missing;
List.iter (fun t ->
let j = t.t_chunk_of_block.(i) in
match VB.get t.t_converted_verified_bitmap j with
@@ -1115,10 +1119,12 @@
lprintf_nl "set_swarmer_state_missing: invalidating a block
within a completed chunk?"
| VB.State_verified ->
lprintf_nl "set_swarmer_state_missing: invalidating a block
within a verified chunk?"
- ) s.s_networks
- end
+ ) s.s_networks)
+ | VB.State_missing -> ()
+ | VB.State_partial ->
+ lprintf_nl "set_swarmer_state_missing: invalidating a partial block ?"
-(* we have started downloading this block, so mark all containing blocks
+(* we have started downloading this block, so mark all containing chunks
also as started. *)
let set_swarmer_state_partial s i =
match VB.get s.s_verified_bitmap i with
@@ -1131,9 +1137,9 @@
VB.set t.t_converted_verified_bitmap j VB.State_partial
| VB.State_partial -> ()
| VB.State_complete ->
- lprintf_nl "set_bitmap1: partial block within a completed chunk?"
+ lprintf_nl "set_swarmer_state_partial: partial block within a
completed chunk?"
| VB.State_verified ->
- lprintf_nl "set_bitmap1: partial block within a verified chunk?"
+ lprintf_nl "set_swarmer_state_partial: partial block within a
verified chunk?"
) s.s_networks
| VB.State_partial -> ()
| VB.State_complete ->
@@ -1165,7 +1171,22 @@
())
| [] -> assert false)
| VB.State_complete -> ()
- | VB.State_verified -> lprintf_nl "set_swarmer_state_complete: trying to
demote a verified block? (2)"
+ | VB.State_verified ->
+(* lprintf_nl "set_swarmer_state_complete: trying to demote a verified block?
(2)" *)
+ VB.set s.s_verified_bitmap i VB.State_complete;
+ match s.s_networks with
+ | t :: _ ->
+ assert (t.t_primary);
+ let j = t.t_chunk_of_block.(i) in
+ (match VB.get t.t_converted_verified_bitmap j with
+ | VB.State_verified ->
+ VB.set t.t_converted_verified_bitmap j VB.State_complete;
+ t.t_nverified_chunks <- t.t_nverified_chunks - 1;
+ | VB.State_complete -> ()
+ | VB.State_missing | VB.State_partial ->
+ lprintf_nl "BUG: set_swarmer_state_complete: demoting a verified
block from an incomplete chunk")
+ | [] -> assert false
+
(* the primary verifier has worked, so let ask secondary ones for
verification too *)
@@ -1265,7 +1286,7 @@
(* We've seen how swarmer verification propagates to the frontend(s)
verifications, now let's see the reverse *)
-let set_frontend_bitmap_0 t j =
+let set_frontend_state_missing t j =
assert(VB.get t.t_converted_verified_bitmap j = VB.State_complete);
let s = t.t_s in
assert(List.for_all (fun i -> VB.get s.s_verified_bitmap i <>
VB.State_verified) t.t_blocks_of_chunk.(j));
@@ -1307,7 +1328,7 @@
end
(* aka set_completed_chunk (internal) *)
-let set_frontend_bitmap_2 t j =
+let set_frontend_state_complete t j =
match VB.get t.t_converted_verified_bitmap j with
| VB.State_missing | VB.State_partial ->
if !verbose_swarming || !verbose then
@@ -1319,7 +1340,7 @@
| VB.State_complete | VB.State_verified -> ()
(* aka set_verified_chunk (internal) *)
-let set_frontend_bitmap_3 t j =
+let set_frontend_state_verified t j =
let mark_verified () =
VB.set t.t_converted_verified_bitmap j VB.State_verified;
if !verbose_swarming || !verbose then
@@ -1350,9 +1371,9 @@
| VB.State_missing | VB.State_partial ->
()
| VB.State_complete ->
- set_frontend_bitmap_2 t j
+ set_frontend_state_complete t j
| VB.State_verified ->
- set_frontend_bitmap_3 t j;
+ set_frontend_state_verified t j;
if VB.get t.t_converted_verified_bitmap j <> VB.State_verified then
lprintf_nl "FIELD AS BEEN CLEARED"
) bitmap
@@ -1380,7 +1401,7 @@
| VerificationNotAvailable -> ()
| ForceVerification ->
- set_frontend_bitmap_3 t j
+ set_frontend_state_verified t j
| Verification uids when Array.length uids = nchunks ->
@@ -1390,9 +1411,9 @@
let chunk_end = chunk_begin ++ t.t_chunk_size in
let chunk_end = min chunk_end s.s_size in
if verify t uids.(j) chunk_begin chunk_end then
- set_frontend_bitmap_3 t j
+ set_frontend_state_verified t j
else
- set_frontend_bitmap_0 t j
+ set_frontend_state_missing t j
with VerifierNotReady -> ())
| Verification chunks ->
@@ -1407,11 +1428,11 @@
let s = t.t_s in
if verify t chunks.(0) zero s.s_size then
VB.iteri (fun j _ ->
- set_frontend_bitmap_3 t j
+ set_frontend_state_verified t j
) t.t_converted_verified_bitmap
else
VB.iteri (fun j c ->
- if c = VB.State_complete then set_frontend_bitmap_0 t j
+ if c = VB.State_complete then set_frontend_state_missing t j
) t.t_converted_verified_bitmap
with VerifierNotReady -> ()
@@ -1425,7 +1446,12 @@
let verify_all_chunks t =
let s = t.t_s in
- VB.iteri (fun i _ -> must_verify_block s i) s.s_verified_bitmap
+ VB.iteri (fun i state ->
+ match state with
+ | VB.State_missing | VB.State_verified ->
+ must_verify_block s i
+ | VB.State_partial | VB.State_complete -> ()
+ ) s.s_verified_bitmap
(** same, and synchronously calls the verification of all chunks *)
@@ -2921,7 +2947,7 @@
if copy_data then
Unix32.copy_chunk (file_fd t1.t_file) (file_fd t2.t_file)
pos1 pos2 (Int64.to_int size);
- set_frontend_bitmap_2 t2 j2
+ set_frontend_state_complete t2 j2
end
) destinations
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/01
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/01
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/03
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/03
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/04
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/16
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/16
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/19
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/22
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/23
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/23
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/25
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/25
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/09/25