Fix other minor comments

This commit is contained in:
Pietro 2018-03-21 16:21:12 +01:00 committed by Grégoire Henry
parent a436b81a35
commit 4d9292fcbb
4 changed files with 15 additions and 18 deletions

View File

@ -543,9 +543,6 @@ let build_rpc_directory net =
match net.pool with match net.pool with
| None -> failwith "The P2P layer is disabled." | None -> failwith "The P2P layer is disabled."
| Some pool -> | Some pool ->
fail_when
(P2p_pool.Points.banned pool point)
(P2p_errors.Point_banned point) >>=? fun () ->
P2p_pool.connect ~timeout pool point >>=? fun _conn -> P2p_pool.connect ~timeout pool point >>=? fun _conn ->
return () return ()
end in end in
@ -674,9 +671,10 @@ let build_rpc_directory net =
begin fun peer_id () () -> begin fun peer_id () () ->
match net.pool with match net.pool with
| None -> return false | None -> return false
| Some pool when (P2p_pool.Peers.get_trusted pool peer_id) ->
return false
| Some pool -> | Some pool ->
if P2p_pool.Peers.get_trusted pool peer_id then return false return (P2p_pool.Peers.banned pool peer_id)
else return (P2p_pool.Peers.banned pool peer_id)
end in end in
(* Network : Point *) (* Network : Point *)
@ -766,12 +764,11 @@ let build_rpc_directory net =
RPC_directory.gen_register1 dir P2p_services.Points.S.banned RPC_directory.gen_register1 dir P2p_services.Points.S.banned
begin fun point () () -> begin fun point () () ->
match net.pool with match net.pool with
| None -> RPC_answer.return false | None -> RPC_answer.not_found
| Some pool when (P2p_pool.Points.get_trusted pool point) ->
RPC_answer.return false
| Some pool -> | Some pool ->
if P2p_pool.Points.get_trusted pool point then RPC_answer.return (P2p_pool.Points.banned pool point)
RPC_answer.return false
else
RPC_answer.return (P2p_pool.Points.banned pool point)
end in end in
(* Network : Greylist *) (* Network : Greylist *)

View File

@ -1,6 +1,6 @@
(**************************************************************************) (**************************************************************************)
(* *) (* *)
(* Copyright (c) 2014 - 2016. *) (* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *) (* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *) (* All rights reserved. No warranty, explicit or implicit, provided. *)
@ -112,7 +112,7 @@ module IpSet = struct
type result = Time.t type result = Time.t
let default = Time.now() let default = Time.now()
let map _t _key value = value let map _t _key value = value
let reduce _t left right = Time.(max left right) let reduce _t left right = Time.(min left right)
end end
in in
let module MR = M.Map_Reduce(MI) in let module MR = M.Map_Reduce(MI) in

View File

@ -9,10 +9,12 @@
(** (**
This module implements four Access Control Lists: This module implements four Access Control Lists:
- ip greylist used to automatically ban a given ip address. - ip greylist is a set of banned ip addresses automatically added by
- peer_id greylist used to automatically ban a given peer_id. the p2p layer.
- ip blacklist used to manually ban a given ip addr. - peer_id greylist is a set of banned peers ids automatically added by
- peers blacklist used to manually trust a given peer_id. the p2p layer.
- ip blacklist is a set of ip addresses manually added by the node admin.
- peers blacklist is a set of peers ids manually added by the node admin.
IP greylists use a time based GC to periodically remove entries from IP greylists use a time based GC to periodically remove entries from
the table, while peer_id grey lists are built using a ring structure, the table, while peer_id grey lists are built using a ring structure,

View File

@ -132,12 +132,10 @@ module Points : sig
unit * P2p_point.Id.t, unit, unit, unit * P2p_point.Id.t, unit, unit,
bool) RPC_service.t bool) RPC_service.t
end end
end end
module Peers : sig module Peers : sig
val list: val list: