Indent: reindent with ocp-indent and fix the script
This commit is contained in:
parent
bd8eaddc8c
commit
df746e606d
@ -203,11 +203,11 @@ let init_rpc (rpc_config: Node_config_file.rpc) node =
|
||||
(if rpc_config.tls = None then "" else " (TLS enabled)") >>= fun () ->
|
||||
Lwt.catch
|
||||
(fun () ->
|
||||
RPC_server.launch ~host mode dir
|
||||
~media_types:Media_type.all_media_types
|
||||
~cors:{ allowed_origins = rpc_config.cors_origins ;
|
||||
allowed_headers = rpc_config.cors_headers } >>= fun server ->
|
||||
return (Some server))
|
||||
RPC_server.launch ~host mode dir
|
||||
~media_types:Media_type.all_media_types
|
||||
~cors:{ allowed_origins = rpc_config.cors_origins ;
|
||||
allowed_headers = rpc_config.cors_headers } >>= fun server ->
|
||||
return (Some server))
|
||||
(function
|
||||
|Unix.Unix_error(Unix.EADDRINUSE, "bind","") ->
|
||||
fail (RPC_Port_already_in_use addr)
|
||||
|
@ -459,7 +459,7 @@ module Bson : sig
|
||||
|
||||
type t = Json_repr_bson.bson
|
||||
|
||||
(** Construct a BSON object from an encoding. *)
|
||||
(** Construct a BSON object from an encoding. *)
|
||||
val construct : 't encoding -> 't -> bson
|
||||
|
||||
(** Destruct a BSON object into a value.
|
||||
|
@ -386,11 +386,11 @@ module Point_state = struct
|
||||
(function Requested -> Some () | _ -> None)
|
||||
(fun () -> Requested) ;
|
||||
case (Tag 1) (branch_encoding "accepted"
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(function Accepted peer_id -> Some peer_id | _ -> None)
|
||||
(fun peer_id -> Accepted peer_id) ;
|
||||
case (Tag 2) (branch_encoding "running"
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(function Running peer_id -> Some peer_id | _ -> None)
|
||||
(fun peer_id -> Running peer_id) ;
|
||||
case (Tag 3) (branch_encoding "disconnected" empty)
|
||||
@ -607,61 +607,61 @@ module Connection_pool_log_event = struct
|
||||
(function Too_many_connections -> Some () | _ -> None)
|
||||
(fun () -> Too_many_connections) ;
|
||||
case (Tag 2) (branch_encoding "new_point"
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(function New_point p -> Some p | _ -> None)
|
||||
(fun p -> New_point p) ;
|
||||
case (Tag 3) (branch_encoding "new_peer"
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(function New_peer p -> Some p | _ -> None)
|
||||
(fun p -> New_peer p) ;
|
||||
case (Tag 4) (branch_encoding "incoming_connection"
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(function Incoming_connection p -> Some p | _ -> None)
|
||||
(fun p -> Incoming_connection p) ;
|
||||
case (Tag 5) (branch_encoding "outgoing_connection"
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(function Outgoing_connection p -> Some p | _ -> None)
|
||||
(fun p -> Outgoing_connection p) ;
|
||||
case (Tag 6) (branch_encoding "authentication_failed"
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(obj1 (req "point" Point.encoding)))
|
||||
(function Authentication_failed p -> Some p | _ -> None)
|
||||
(fun p -> Authentication_failed p) ;
|
||||
case (Tag 7) (branch_encoding "accepting_request"
|
||||
(obj3
|
||||
(req "point" Point.encoding)
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(obj3
|
||||
(req "point" Point.encoding)
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(function Accepting_request (p, id_p, g) ->
|
||||
Some (p, id_p, g) | _ -> None)
|
||||
(fun (p, id_p, g) -> Accepting_request (p, id_p, g)) ;
|
||||
case (Tag 8) (branch_encoding "rejecting_request"
|
||||
(obj3
|
||||
(req "point" Point.encoding)
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(obj3
|
||||
(req "point" Point.encoding)
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(function Rejecting_request (p, id_p, g) ->
|
||||
Some (p, id_p, g) | _ -> None)
|
||||
(fun (p, id_p, g) -> Rejecting_request (p, id_p, g)) ;
|
||||
case (Tag 9) (branch_encoding "request_rejected"
|
||||
(obj2
|
||||
(req "point" Point.encoding)
|
||||
(opt "identity"
|
||||
(tup2 Id_point.encoding Peer_id.encoding))))
|
||||
(obj2
|
||||
(req "point" Point.encoding)
|
||||
(opt "identity"
|
||||
(tup2 Id_point.encoding Peer_id.encoding))))
|
||||
(function Request_rejected (p, id) -> Some (p, id) | _ -> None)
|
||||
(fun (p, id) -> Request_rejected (p, id)) ;
|
||||
case (Tag 10) (branch_encoding "connection_established"
|
||||
(obj2
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(obj2
|
||||
(req "id_point" Id_point.encoding)
|
||||
(req "peer_id" Peer_id.encoding)))
|
||||
(function Connection_established (id_p, g) ->
|
||||
Some (id_p, g) | _ -> None)
|
||||
(fun (id_p, g) -> Connection_established (id_p, g)) ;
|
||||
case (Tag 11) (branch_encoding "disconnection"
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(function Disconnection g -> Some g | _ -> None)
|
||||
(fun g -> Disconnection g) ;
|
||||
case (Tag 12) (branch_encoding "external_disconnection"
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(obj1 (req "peer_id" Peer_id.encoding)))
|
||||
(function External_disconnection g -> Some g | _ -> None)
|
||||
(fun g -> External_disconnection g) ;
|
||||
case (Tag 13) (branch_encoding "gc_points" empty)
|
||||
@ -671,43 +671,43 @@ module Connection_pool_log_event = struct
|
||||
(function Gc_peer_ids -> Some () | _ -> None)
|
||||
(fun () -> Gc_peer_ids) ;
|
||||
case (Tag 15) (branch_encoding "swap_request_received"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_request_received { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_request_received { source }) ;
|
||||
case (Tag 16) (branch_encoding "swap_ack_received"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_ack_received { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_ack_received { source }) ;
|
||||
case (Tag 17) (branch_encoding "swap_request_sent"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_request_sent { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_request_sent { source }) ;
|
||||
case (Tag 18) (branch_encoding "swap_ack_sent"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_ack_sent { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_ack_sent { source }) ;
|
||||
case (Tag 19) (branch_encoding "swap_request_ignored"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_request_ignored { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_request_ignored { source }) ;
|
||||
case (Tag 20) (branch_encoding "swap_success"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_success { source } -> Some source
|
||||
| _ -> None)
|
||||
(fun source -> Swap_success { source }) ;
|
||||
case (Tag 21) (branch_encoding "swap_failure"
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(obj1 (req "source" Peer_id.encoding)))
|
||||
(function
|
||||
| Swap_failure { source } -> Some source
|
||||
| _ -> None)
|
||||
|
@ -192,8 +192,8 @@ let rec worker_loop pv =
|
||||
| Ok () ->
|
||||
worker_loop pv
|
||||
| Error ((( Unknown_ancestor
|
||||
| Bootstrap_pipeline.Invalid_locator _
|
||||
| Block_validator.Invalid_block _ ) :: _) as errors ) ->
|
||||
| Bootstrap_pipeline.Invalid_locator _
|
||||
| Block_validator.Invalid_block _ ) :: _) as errors ) ->
|
||||
(* TODO ban the peer_id... *)
|
||||
lwt_log_info "Terminating the validation worker for peer %a (kickban)."
|
||||
P2p.Peer_id.pp_short pv.peer_id >>= fun () ->
|
||||
|
@ -97,17 +97,17 @@ let directory_descr_encoding =
|
||||
let static_subdirectories_descr_encoding =
|
||||
union [
|
||||
case (Tag 0) (obj1 (req "suffixes"
|
||||
(list (obj2 (req "name" string)
|
||||
(req "tree" directory_descr_encoding)))))
|
||||
(list (obj2 (req "name" string)
|
||||
(req "tree" directory_descr_encoding)))))
|
||||
(function Suffixes map ->
|
||||
Some (StringMap.bindings map) | _ -> None)
|
||||
(fun m ->
|
||||
let add acc (n,t) = StringMap.add n t acc in
|
||||
Suffixes (List.fold_left add StringMap.empty m)) ;
|
||||
case (Tag 1) (obj1 (req "dynamic_dispatch"
|
||||
(obj2
|
||||
(req "arg" arg_encoding)
|
||||
(req "tree" directory_descr_encoding))))
|
||||
(obj2
|
||||
(req "arg" arg_encoding)
|
||||
(req "tree" directory_descr_encoding))))
|
||||
(function Arg (ty, tree) -> Some (ty, tree) | _ -> None)
|
||||
(fun (ty, tree) -> Arg (ty, tree))
|
||||
] in
|
||||
|
@ -345,7 +345,7 @@ let handle accept (meth, uri, ans) =
|
||||
| `Unexpected_status_code (code, (content, _, media_type)) ->
|
||||
let media_type = Option.map media_type ~f:Media_type.name in
|
||||
Cohttp_lwt.Body.to_string content >>= fun content ->
|
||||
request_failed meth uri (Unexpected_status_code { code ; content ; media_type })
|
||||
request_failed meth uri (Unexpected_status_code { code ; content ; media_type })
|
||||
| `Method_not_allowed allowed ->
|
||||
let allowed = List.filter_map RPC_service.meth_of_string allowed in
|
||||
request_failed meth uri (Method_not_allowed allowed)
|
||||
|
@ -21,7 +21,7 @@ for f in $files ; do
|
||||
ocp-indent $f > $tmp_dir/$ff
|
||||
diff -U 3 $f $tmp_dir/$ff
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ "$fix" = "fix" ]; then
|
||||
if [ "$fix" = "yes" ]; then
|
||||
echo "Fix indentation $f"
|
||||
cp $tmp_dir/$ff $f
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user