From 5ee3581d6087dbedf44d9bf2e6cd68b24e740143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Mon, 23 Jan 2017 11:09:59 +0100 Subject: [PATCH] P2p: fix in `P2p_maintenance` --- src/node/net/p2p_maintenance.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node/net/p2p_maintenance.ml b/src/node/net/p2p_maintenance.ml index 2cae195dc..1ff34c9f0 100644 --- a/src/node/net/p2p_maintenance.ml +++ b/src/node/net/p2p_maintenance.ml @@ -79,6 +79,7 @@ let rec try_to_contact let contactable = connectable st start_time max_to_contact in if contactable = [] then + Lwt_unix.yield () >>= fun () -> Lwt.return_false else List.fold_left @@ -111,11 +112,11 @@ let rec maintain st = and too_few_connections st n_connected = let Pool pool = st.pool in (* too few connections, try and contact many peers *) - lwt_debug "Too few connections (%d)" n_connected >>= fun () -> + lwt_log_notice "Too few connections (%d)" n_connected >>= fun () -> let min_to_contact = st.bounds.min_target - n_connected in let max_to_contact = st.bounds.max_target - n_connected in - try_to_contact st min_to_contact max_to_contact >>= fun continue -> - if not continue then begin + try_to_contact st min_to_contact max_to_contact >>= fun success -> + if success then begin maintain st end else begin (* not enough contacts, ask the pals of our pals,