P2p: add a warning in case of an incoming connection from an untrusted peer

This commit is contained in:
OCamlPro-Iguernlala 2018-05-29 16:23:10 +02:00 committed by Grégoire Henry
parent 6bbdf13bc5
commit 65758d08ac

View File

@ -778,8 +778,14 @@ and authenticate pool ?point_info canceler fd point =
match P2p_point_state.get connection_point_info with match P2p_point_state.get connection_point_info with
| Requested _ -> not incoming | Requested _ -> not incoming
| Disconnected -> | Disconnected ->
not pool.config.private_mode let unexpected =
|| P2p_point_state.Info.trusted connection_point_info pool.config.private_mode
&& not (P2p_point_state.Info.trusted connection_point_info)
in
if unexpected then
warn "[private node] incoming connection from untrused \
peer rejected!";
not unexpected
| Accepted _ | Running _ -> false | Accepted _ | Running _ -> false
end end
in in