[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] Changes to mldonkey/src/daemon/common/commonShared.ml
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] Changes to mldonkey/src/daemon/common/commonShared.ml |
Date: |
Fri, 22 Jul 2005 06:58:58 -0400 |
Index: mldonkey/src/daemon/common/commonShared.ml
diff -u mldonkey/src/daemon/common/commonShared.ml:1.21
mldonkey/src/daemon/common/commonShared.ml:1.22
--- mldonkey/src/daemon/common/commonShared.ml:1.21 Sun Jul 17 16:36:07 2005
+++ mldonkey/src/daemon/common/commonShared.ml Fri Jul 22 10:58:55 2005
@@ -73,12 +73,16 @@
let ni n m =
let s = Printf.sprintf "Shared.%s not implemented by %s"
m n.network_name in
- lprintf "%s\n" s;
+ lprintf_nl "%s" s;
s
let fni n m = failwith (ni n m)
let ni_ok n m = ignore (ni n m)
+let lprintf_nl () =
+ lprintf "%s[cShared]: "
+ (log_time ()); lprintf_nl2
+
let shared_calculate_total_bytes () =
nshared_bytes := Int64.zero;
H.iter (fun s ->
@@ -102,7 +106,7 @@
let update_shared_num impl =
if impl.impl_shared_num = 0 then begin
if !verbose_share then
- lprintf "NEW SHARED %s/%s\n" impl.impl_shared_codedname
+ lprintf_nl () "NEW SHARED %s/%s" impl.impl_shared_codedname
impl.impl_shared_fullname;
incr shared_counter;
impl.impl_shared_num <- !shared_counter;
@@ -140,13 +144,13 @@
name in
let codedname = Filename.concat dirname filename in
if !verbose_share then
- lprintf "commonShared: sharing %s\n" fullname;
+ lprintf_nl () "sharing %s" fullname;
let size = Unix32.getsize fullname false in
incr files_scanned;
files_scanned_size := !files_scanned_size ++ size;
if Unix2.is_directory fullname then begin
if !verbose_share then
- lprintf "new_shared: %s is directory! Skipped network.share\n" fullname;
+ lprintf_nl () "new_shared: %s is directory! Skipped network.share"
fullname;
end
else begin
CommonNetwork.networks_iter (fun n ->
@@ -248,7 +252,7 @@
if can_share dirname then
try
let files = Unix2.list_directory full_dir in
- if !verbose_share then lprintf_nl "commonShared: Sharing sub-directory
%s" full_dir;
+ if !verbose_share then lprintf_nl () "Sharing sub-directory %s"
full_dir;
List.iter (fun file ->
if file <> "" && file.[0] <> '.' then
let full_name = Filename.concat full_dir file in
@@ -260,13 +264,13 @@
begin
let inode = ((Unix.stat full_name).Unix.st_ino) in
if inode = incoming_files_inode then
- if !verbose_share then lprintf_nl "avoid sharing
incoming_files %s" full_dir else ()
+ if !verbose_share then lprintf_nl () "avoid sharing
incoming_files %s" full_dir else ()
else
if inode = incoming_directories_inode then
- if !verbose_share then lprintf_nl "avoid sharing
incoming_directories %s" full_dir else ()
+ if !verbose_share then lprintf_nl () "avoid sharing
incoming_directories %s" full_dir else ()
else
if inode = temp_directory_inode then
- if !verbose_share then lprintf_nl "avoid sharing
temp %s" full_dir else ()
+ if !verbose_share then lprintf_nl () "avoid sharing
temp %s" full_dir else ()
else
shared_add_directory shared_dir local_name
end
@@ -286,15 +290,15 @@
new_shared dirname shared_dir.shdir_priority
local_name full_name
with e ->
- lprintf "%s will not be shared (exception %s)\n"
+ lprintf_nl () "%s will not be shared (exception %s)"
full_name (Printexc2.to_string e);
with _ -> ()
) files
with e ->
- lprintf "Exception %s while sharing %s\n"
+ lprintf_nl () "Exception %s while sharing %s"
(Printexc2.to_string e) full_dir
else
- lprintf "Cannot share %s\n" full_dir
+ lprintf_nl () "Cannot share %s" full_dir
let _ =
BasicSocket.add_infinite_timer 1. (fun _ ->
@@ -311,7 +315,7 @@
let shared_add_directory shared_dir =
if shared_dir.shdir_dirname <> "" then begin
- if !verbose_share then lprintf "commonShared: Sharing %s prio %d\n"
shared_dir.shdir_dirname
+ if !verbose_share then lprintf_nl () "Sharing %s prio %d"
shared_dir.shdir_dirname
shared_dir.shdir_priority;
shared_add_directory shared_dir ""
end