P2p: do not send bootstrap message to peers in private mode

This commit is contained in:
OCamlPro-Iguernlala 2018-05-21 15:44:43 +02:00 committed by Grégoire Henry
parent 6663109639
commit 6bbdf13bc5
2 changed files with 11 additions and 9 deletions

View File

@ -409,13 +409,14 @@ let write_all pool msg =
pool.connected_peer_ids
let broadcast_bootstrap_msg pool =
P2p_peer.Table.iter
(fun _peer_id peer_info ->
match P2p_peer_state.get peer_info with
| Running { data = { conn } } ->
ignore (P2p_socket.write_now conn Bootstrap : bool tzresult )
| _ -> ())
pool.connected_peer_ids
if not pool.config.private_mode then
P2p_peer.Table.iter
(fun _peer_id peer_info ->
match P2p_peer_state.get peer_info with
| Running { data = { conn } } ->
ignore (P2p_socket.write_now conn Bootstrap : bool tzresult )
| _ -> ())
pool.connected_peer_ids
(***************************************************************************)

View File

@ -292,8 +292,9 @@ val write_all: ('msg, 'peer_meta,'conn_meta) pool -> 'msg -> unit
connections to [pool] in [Running] state. *)
val broadcast_bootstrap_msg: ('msg, 'peer_meta,'conn_meta) pool -> unit
(** [write_all pool msg] is [P2P_connection.write_now conn Bootstrap]
for all member connections to [pool] in [Running] state. *)
(** [broadcast_bootstrap_msg pool] is [P2P_connection.write_now conn Bootstrap]
for all member connections to [pool] in [Running] state.
This behavior is deactivated if the node is in private mode *)
val greylist_addr : ('msg, 'peer_meta,'conn_meta) pool -> P2p_addr.t -> unit
(** [greylist_addr pool addr] adds [addr] to [pool]'s IP greylist. *)