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

View File

@ -1,6 +1,6 @@
(**************************************************************************)
(* *)
(* Copyright (c) 2014 - 2016. *)
(* Copyright (c) 2014 - 2018. *)
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
(* *)
(* All rights reserved. No warranty, explicit or implicit, provided. *)
@ -112,7 +112,7 @@ module IpSet = struct
type result = Time.t
let default = Time.now()
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
in
let module MR = M.Map_Reduce(MI) in

View File

@ -9,10 +9,12 @@
(**
This module implements four Access Control Lists:
- ip greylist used to automatically ban a given ip address.
- peer_id greylist used to automatically ban a given peer_id.
- ip blacklist used to manually ban a given ip addr.
- peers blacklist used to manually trust a given peer_id.
- ip greylist is a set of banned ip addresses automatically added by
the p2p layer.
- peer_id greylist is a set of banned peers ids automatically added by
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
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,
bool) RPC_service.t
end
end
module Peers : sig
val list: