156 |
with _ -> |
with _ -> |
157 |
lprintf "[NS]: Resolving [%s] ..." name; |
lprintf "[NS]: Resolving [%s] ..." name; |
158 |
let ip = gethostbyname name in |
let ip = gethostbyname name in |
159 |
lprintf "[NS]: done\n"; |
lprintf_nl "[NS]: done"; |
160 |
Hashtbl.add ip_cache name (ip, current_time +. 3600.); |
Hashtbl.add ip_cache name (ip, current_time +. 3600.); |
161 |
ip |
ip |
162 |
|
|
233 |
|
|
234 |
(* We check for names every 1/10 second. Too long ? *) |
(* We check for names every 1/10 second. Too long ? *) |
235 |
let _ = |
let _ = |
236 |
|
Heap.add_memstat "IP" (fun level buf -> |
237 |
|
Printf.bprintf buf " %d IPs in ip_cache\n" (Hashtbl.length ip_cache); |
238 |
|
Printf.bprintf buf " %d entries in hostname_table\n" (Hashtbl.length hostname_table); |
239 |
|
Printf.bprintf buf " %d entries in ip_fifo\n" (Fifo.length ip_fifo); |
240 |
|
); |
241 |
|
|
242 |
BasicSocket.add_infinite_timer 0.1 (fun _ -> |
BasicSocket.add_infinite_timer 0.1 (fun _ -> |
243 |
let current_time = Unix.gettimeofday () in |
let current_time = Unix.gettimeofday () in |
244 |
while true do |
while true do |