P2p_maintenance.connectable: ignore non-trusted points if option --closed is set
This commit is contained in:
parent
f0612a96ea
commit
6b8c3f7d31
@ -27,10 +27,11 @@ type 'meta t = {
|
|||||||
mutable maintain_worker : unit Lwt.t ;
|
mutable maintain_worker : unit Lwt.t ;
|
||||||
}
|
}
|
||||||
|
|
||||||
(** Select [expected] points amongst the disconnected known points.
|
(** Select [expected] points among the disconnected known points.
|
||||||
It ignores points which are greylisted, or for which a connection
|
It ignores points which are greylisted, or for which a connection
|
||||||
failed after [start_time] and the pointes that are banned. It
|
failed after [start_time] and the pointes that are banned. It
|
||||||
first selects points with the oldest last tentative. *)
|
first selects points with the oldest last tentative.
|
||||||
|
Non-trusted points are also ignored if option --closed is set. *)
|
||||||
let connectable st start_time expected =
|
let connectable st start_time expected =
|
||||||
let Pool pool = st.pool in
|
let Pool pool = st.pool in
|
||||||
let now = Time.now () in
|
let now = Time.now () in
|
||||||
@ -45,8 +46,12 @@ let connectable st start_time expected =
|
|||||||
| Some t1, Some t2 -> Time.compare t2 t1
|
| Some t1, Some t2 -> Time.compare t2 t1
|
||||||
end) in
|
end) in
|
||||||
let acc = Bounded_point_info.create expected in
|
let acc = Bounded_point_info.create expected in
|
||||||
|
let closed = (P2p_pool.config pool).P2p_pool.closed_network in
|
||||||
P2p_pool.Points.fold_known pool ~init:()
|
P2p_pool.Points.fold_known pool ~init:()
|
||||||
~f:begin fun point pi () ->
|
~f:begin fun point pi () ->
|
||||||
|
(* consider the point only if --closed is not set, or if pi is
|
||||||
|
trusted *)
|
||||||
|
if not closed || P2p_point_state.Info.trusted pi then
|
||||||
match P2p_point_state.get pi with
|
match P2p_point_state.get pi with
|
||||||
| Disconnected -> begin
|
| Disconnected -> begin
|
||||||
match P2p_point_state.Info.last_miss pi with
|
match P2p_point_state.Info.last_miss pi with
|
||||||
|
Loading…
Reference in New Issue
Block a user