package octez-shell-libs
Octez shell libraries
Install
Dune Dependency
Authors
Maintainers
Sources
tezos-octez-v20.1.tag.bz2
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/src/octez-shell-libs.p2p/p2p_events.ml.html
Source file p2p_events.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020-2022 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************) let pp_first_element elem_enc ppf l = let open Format in pp_print_string ppf "[ " ; (match l with | [] -> () | [element] -> elem_enc ppf element | element :: _ -> elem_enc ppf element ; pp_print_string ppf "; ...") ; pp_print_string ppf " ]" module P2p_protocol = struct include Internal_event.Simple let section = ["p2p"; "protocol"] let private_node_new_peers = declare_1 ~section ~name:"private_node_new_peers" ~msg:"received new peers addresses from private peer {peer}" ~level:Warning ("peer", P2p_peer.Id.encoding) let private_node_peers_request = declare_1 ~section ~name:"private_node_peers_request" ~msg:"received requests for peers addresses from private peer {peer}" ~level:Warning ("peer", P2p_peer.Id.encoding) let private_node_swap_request = declare_1 ~section ~name:"private_node_swap_request" ~msg:"received swap requests from private peer {peer}" ~level:Warning ("peer", P2p_peer.Id.encoding) let private_node_swap_ack = declare_1 ~section ~name:"private_node_swap_ack" ~msg:"received swap ack from private peer {peer}" ~level:Warning ("peer", P2p_peer.Id.encoding) let private_node_request = declare_1 ~section ~name:"private_node_request" ~msg:"private peer ({peer}) asked other peer's addresses" ~level:Warning ("peer", P2p_peer.Id.encoding) let advertise_sending_failed = declare_2 ~section ~name:"advertise_sending_failed" ~msg:"sending advertise to {peer} failed: {trace}" ~level:Warning ("peer", P2p_peer.Id.encoding) ~pp2:pp_print_top_error_of_trace ("trace", Error_monad.trace_encoding) let swap_succeeded = declare_1 ~section ~name:"swap_succeeded" ~msg:"swap to {point} succeeded" ~level:Info ("point", P2p_point.Id.encoding) let swap_interrupted = declare_2 ~section ~name:"swap_interrupted" ~msg:"swap to {point} was interrupted: {trace}" ~level:Debug ("point", P2p_point.Id.encoding) ~pp2:pp_print_top_error_of_trace ("trace", Error_monad.trace_encoding) let swap_failed = declare_2 ~section ~name:"swap_failed" ~msg:"swap to {point} failed: {trace}" ~level:Info ("point", P2p_point.Id.encoding) ~pp2:pp_print_top_error_of_trace ("trace", Error_monad.trace_encoding) let swap_request_ignored = declare_1 ~section ~name:"swap_request_ignored" ~msg:"swap request ignored from {peer}" ~level:Info ("peer", P2p_peer.Id.encoding) let no_swap_candidate = declare_1 ~section ~name:"no_swap_candidate" ~msg:"no swap candidate for {peer}" ~level:Info ("peer", P2p_peer.Id.encoding) end module P2p_connect_handler = struct include Internal_event.Simple let section = ["p2p"; "connect_handler"] let disconnected = declare_2 ~section ~name:"disconnected" ~msg:"disconnected: {peer} ({point})" ~level:Debug ("peer", P2p_peer.Id.encoding) ~pp2:P2p_connection.Id.pp ("point", P2p_connection.Id.encoding) let peer_rejected = declare_0 ~section ~name:"peer_rejected" ~msg:"[private node] incoming connection from untrusted peer rejected" ~level:Notice () let authenticate_start = declare_2 ~section ~name:"authenticate_start" ~msg:"start authentication for point {point} ({direction})" ~level:Debug ("point", P2p_point.Id.encoding) ("direction", Data_encoding.string) let authenticate = declare_3 ~section ~name:"authenticate" ~msg:"authentication for point {point}. direction:{direction} -> {state}" ~level:Debug ("point", P2p_point.Id.encoding) ("direction", Data_encoding.string) ("state", Data_encoding.string) let authenticate_status = declare_3 ~section ~name:"authenticate_status" ~msg:"authentication status for point {point} {type} -> {peer}" ~level:Debug ("type", Data_encoding.string) ("point", P2p_point.Id.encoding) ("peer", P2p_peer.Id.encoding) let authenticate_status_peer_id_correct = declare_2 ~section ~name:"authenticate_status_peer_id_correct" ~msg:"expected peer id {peer} for this point {point}" ~level:Info ("point", P2p_point.Id.encoding) ("peer", P2p_peer.Id.encoding) let authenticate_status_peer_id_incorrect = declare_4 ~section ~name:"authenticate_status_peer_id_incorrect" ~msg: "authenticate failed: {point} {type}. Expected '{expected_peer_id}', \ got '{peer_id}'" ~level:Warning ("type", Data_encoding.string) ("point", P2p_point.Id.encoding) ("expected_peer_id", P2p_peer.Id.encoding) ("peer_id", P2p_peer.Id.encoding) let authenticate_error = declare_2 ~section ~name:"authentication_error" ~msg:"authentication error for {point}: {errors}" ~level:Debug ("point", P2p_point.Id.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.trace_encoding) let connection_rejected_by_peers = declare_4 ~section ~name:"connection_rejected_by_peers" ~msg: "connection to {point} rejected by peer {peer}. Reason {reason}. Peer \ list received: {points}" ~level:Debug ("point", P2p_point.Id.encoding) ~pp2:P2p_peer.Id.pp_short ("peer", P2p_peer.Id.encoding) ~pp3:P2p_rejection.pp_short ("reason", P2p_rejection.encoding) ~pp4:(pp_first_element P2p_point.Id.pp) ("points", Data_encoding.list P2p_point.Id.encoding) let connection_error = declare_2 ~section ~name:"connection_error" ~msg:"connection to {point} rejected by peer : {errors}" ~level:Debug ("point", P2p_point.Id.encoding) ~pp2:pp_print_top_error_of_trace ("errors", Error_monad.trace_encoding) let connect_status = declare_2 ~section ~name:"connect_status" ~msg:"connection status for {point}: {state}" ~level:Debug ("state", Data_encoding.string) ("point", P2p_point.Id.encoding) let connect_error = declare_2 ~section ~name:"connect_error" ~msg:"connection error for point {point}, disconnecting : {errors}" ~level:Debug ("point", P2p_point.Id.encoding) ("errors", Data_encoding.(conv Lazy.force Lazy.from_val string)) let connect_close_error = declare_2 ~section ~name:"connect_close_error" ~msg:"connection error while closing for point {point}: {errors}" ~level:Debug ("point", P2p_point.Id.encoding) ("errors", Data_encoding.(conv Lazy.force Lazy.from_val string)) let authenticate_reject_protocol_mismatch = declare_8 ~section ~name:"authenticate_reject_protocol_mismatch" ~msg:"no common protocol with {peer}" ~level:Debug ("point", P2p_point.Id.encoding) ("peer", P2p_peer.Id.encoding) ("local_chain", Distributed_db_version.Name.encoding) ("remote_chain", Distributed_db_version.Name.encoding) ~pp5:(pp_first_element Distributed_db_version.pp) ("local_db_versions", Data_encoding.list Distributed_db_version.encoding) ("remote_db_version", Distributed_db_version.encoding) ~pp7:(pp_first_element P2p_version.pp) ("local_p2p_version", Data_encoding.list P2p_version.encoding) ("remote_p2p_version", P2p_version.encoding) let new_connection = declare_3 ~section ~name:"new_connection" ~msg:"new connection to {addr}:{port}#{peer}" ~level:Info ("addr", P2p_addr.encoding) ("port", Data_encoding.option Data_encoding.uint16) ("peer", P2p_peer.Id.encoding) let trigger_maintenance_too_many_connections = declare_2 ~section ~name:"trigger_maintenance_too_many_connections" ~msg: "Too many connections : trigger maintenance \ (active_connections={active_connections} / \ max_connections={max_connections})" ~level:Debug ("active_connections", Data_encoding.int16) ("max_connections", Data_encoding.int16) let trigger_maintenance_too_few_connections = declare_2 ~section ~name:"trigger_maintenance_too_few_connections" ~msg: "Too few connections : trigger maintenance \ (active_connections={active_connections} / \ min_connections={min_connections})" ~level:Debug ("active_connections", Data_encoding.int16) ("min_connections", Data_encoding.int16) end module P2p_conn = struct include Internal_event.Simple let section = ["p2p"; "conn"] let peer_discovery_disabled = declare_0 ~section ~name:"peer_discovery_disabled" ~msg:"request for new peers interrupted because peer discovery disabled" ~level:Warning () let unexpected_error = declare_1 ~section ~name:"unexpected_error_answerer" ~msg:"answerer unexpected error: {errors}" ~level:Error ~pp1:pp_print_top_error_of_trace ("errors", Error_monad.trace_encoding) let swap_ack_received = declare_3 ~section ~name:"swap_ack_received" ~msg:"swap ack received from {emitter}" ~level:Info ("emitter", P2p_peer.Id.encoding) ("proposed_point", P2p_point.Id.encoding) ("proposed_peer", P2p_peer.Id.encoding) let swap_request_received = declare_3 ~section ~name:"swap_request_received" ~msg:"swap request received from {emitter}" ~level:Info ("emitter", P2p_peer.Id.encoding) ("proposed_point", P2p_point.Id.encoding) ("proposed_peer", P2p_peer.Id.encoding) let bytes_popped_from_queue = declare_2 ~section ~name:"bytes_popped_from_queue" ~msg:"{bytes} bytes message popped from queue {peer}" ~level:Debug ("bytes", Data_encoding.int31) ("peer", P2p_peer.Id.encoding) let disconnect = declare_1 ~section ~name:"disconnect" ~msg:"{peer} has been explicitly closed" ~level:Debug ("peer", P2p_peer.Id.encoding) let bootstrap_received = declare_1 ~section ~name:"bootstrap_received" ~msg:"bootstrap message received from {emitter}" ~level:Debug ("emitter", P2p_peer.Id.encoding) let advertise_received = declare_2 ~section ~name:"advertise_received" ~msg:"advertise message received from {emitter}" ~level:Debug ("emitter", P2p_peer.Id.encoding) ("points", Data_encoding.list P2p_point.Id.encoding) end module P2p_fd = struct include Internal_event.Simple let section = ["p2p"; "fd"] let create_fd = declare_1 ~section ~name:"create_fd" ~msg:"cnx:{connection_id}:create fd" ~level:Debug ("connection_id", Data_encoding.int31) let close_fd = declare_4 ~section ~name:"close_fd" ~msg: "cnx:{connection_id}:close fd (reasons: {reasons}, stats : \ {nread}/{nwrit})" ~level:Debug ("connection_id", Data_encoding.int31) ("reasons", Data_encoding.list P2p_disconnection_reason.encoding) ("nread", Data_encoding.int31) ("nwrit", Data_encoding.int31) let close_fd_reason = declare_3 ~section ~name:"close_fd_reason" ~msg:"disconnected from {point}#{peer}: {reason}" ~level:Info ~pp1: Format.( pp_print_option ~none:(fun fmt () -> pp_print_string fmt "<Undefined_point>") P2p_point.Id.pp) ~pp2: Format.( pp_print_option ~none:(fun fmt () -> pp_print_string fmt "<Undefined_peer_id>") P2p_peer.Id.pp_short) ~pp3: Format.( pp_print_list ~pp_sep:(fun ppf () -> Format.fprintf ppf ", ") P2p_disconnection_reason.pp) ("point", Data_encoding.option P2p_point.Id.encoding) ("peer", Data_encoding.option P2p_peer.Id.encoding) ("reason", Data_encoding.(list P2p_disconnection_reason.encoding)) let close_fd_unknown_reason = declare_2 ~section ~name:"close_fd_unknown_reason" ~msg:"disconnected from {point}#{peer}: unknown reason" ~level:Info ~pp1: Format.( pp_print_option ~none:(fun fmt () -> pp_print_string fmt "<Undefined_point>") P2p_point.Id.pp) ~pp2: Format.( pp_print_option ~none:(fun fmt () -> pp_print_string fmt "<Undefined_peer_id>") P2p_peer.Id.pp_short) ("point", Data_encoding.option P2p_point.Id.encoding) ("peer", Data_encoding.option P2p_peer.Id.encoding) let close_fd_error = declare_2 ~section ~name:"close_fd_error" ~msg: "socket related to connection {connection_id} failed to close:{error}" ~level:Warning ("connection_id", Data_encoding.int31) ("error", Data_encoding.string) let try_read = declare_2 ~section ~name:"try_read" ~msg:"cnx:{connection_id}:try read {length}" ~level:Debug ("connection_id", Data_encoding.int31) ("length", Data_encoding.int31) let try_write = declare_2 ~section ~name:"try_write" ~msg:"cnx:{connection_id}:try write {length}" ~level:Debug ("connection_id", Data_encoding.int31) ("length", Data_encoding.int31) let read_fd = declare_3 ~section ~name:"read_fd" ~msg:"cnx:{connection_id}:read {nread} ({nread_total})" ~level:Debug ("connection_id", Data_encoding.int31) ("nread", Data_encoding.int31) ("nread_total", Data_encoding.int64) let written_fd = declare_3 ~section ~name:"written_fd" ~msg:"cnx:{connection_id}:written {nwrit} ({nwrit_total})" ~level:Debug ("connection_id", Data_encoding.int31) ("nwrit", Data_encoding.int31) ("nwrit_total", Data_encoding.int64) let connect_fd = declare_2 ~section ~name:"connect" ~msg:"cnx:{connection_id}:connect {socket}" ~level:Debug ("connection_id", Data_encoding.int31) ("socket", Data_encoding.string) let accept_fd = declare_2 ~section ~name:"accept" ~msg:"cnx:{connection_id}:accept {socket}" ~level:Debug ("connection_id", Data_encoding.int31) ("socket", Data_encoding.string) end module P2p_maintainance = struct include Internal_event.Simple let section = ["p2p"; "maintenance"] type maintenance_trigger_motive = | Activation | Last_maintenance | External | Timer of Ptime.span | Too_few_connections | Too_many_connections let motive_encoding = let open Data_encoding in union [ case ~title:"activation" ~description: "This maintenance step was triggered by its initial activation" (Tag 0) (obj1 (req "kind" (constant "activation"))) (function Activation -> Some () | _ -> None) (fun () -> Activation); case ~title:"last_maintenance" ~description:"This maintenance step was triggered by the previous one" (Tag 1) (obj1 (req "kind" (constant "last_maintenance"))) (function Last_maintenance -> Some () | _ -> None) (fun () -> Last_maintenance); case ~title:"timer" ~description: "This maintenance step was triggered by periodically checks." (Tag 2) (obj2 (req "kind" (constant "timer")) (req "idle_time" Time.System.Span.encoding)) (function Timer span -> Some ((), span) | _ -> None) (fun ((), span) -> Timer span); case ~title:"external_event" ~description: "This maintenance step was triggered by an external event" (Tag 3) (obj1 (req "kind" (constant "external_event"))) (function External -> Some () | _ -> None) (fun () -> External); case ~title:"too_few_connections" ~description: "This maintenance step was urgently triggered by a lack of \ connections" (Tag 4) (obj1 (req "kind" (constant "too_few_connections"))) (function Too_few_connections -> Some () | _ -> None) (fun () -> Too_few_connections); case ~title:"too_many_connections" ~description: "This maintenance step was urgently triggered by an excess of \ connections" (Tag 5) (obj1 (req "kind" (constant "too_many_connections"))) (function Too_many_connections -> Some () | _ -> None) (fun () -> Too_many_connections); ] let motive_pp fmt = function | Activation -> Format.pp_print_string fmt "activation" | Last_maintenance -> Format.pp_print_string fmt "last maintenance" | External -> Format.pp_print_string fmt "external" | Timer span -> Format.fprintf fmt "periodically checks every %a." Time.System.Span.pp_hum span | Too_few_connections -> Format.pp_print_string fmt "too few connections" | Too_many_connections -> Format.pp_print_string fmt "too many connections" let maintenance_started = declare_1 ~section ~name:"maintenance_started" ~msg:"maintenance step started (triggered by:{motive})" ~level:Info ~pp1:motive_pp ("motive", motive_encoding) let maintenance_ended = declare_1 ~section ~name:"maintenance_ended" ~msg:"maintenance step ended after {duration}" ~level:Info ~pp1:Time.System.Span.pp_hum ("duration", Time.System.Span.encoding) let too_few_connections = declare_1 ~section ~name:"too_few_connections_maintenance" ~msg:"too few connections ({connections})" ~level:Notice ("connections", Data_encoding.int31) let too_many_connections = declare_1 ~section ~name:"too_many_connections_maintenance" ~msg:"too many connections (will kill {connections})" ~level:Debug ("connections", Data_encoding.int31) end module P2p_welcome = struct include Internal_event.Simple let section = ["p2p"; "welcome"] let incoming_error = declare_2 ~section ~name:"incoming_error" ~msg:"incoming connection failed with {error}. Ignoring" ~level:Debug ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) ("type", Data_encoding.string) let unexpected_error = declare_1 ~section ~name:"unexpected_error_welcome" ~msg:"unexpected error: {error}" ~level:Error ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let unexpected_error_closing_socket = declare_1 ~section ~name:"unexpected_error_closing_socket" ~msg:"unexpected error while closing socket: {error}" ~level:Error ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let incoming_connection_error = declare_1 ~section ~name:"incoming_connection_error" ~msg:"cannot accept incoming connections" ~level:Error ("exception", Error_monad.error_encoding) end module P2p_socket = struct include Internal_event.Simple let section = ["p2p"; "socket"] let nack_point_with_list = declare_2 ~section ~name:"nack_point_with_list" ~msg:"nack point {point} with point list {points}" ~level:Debug ("point", P2p_connection.Id.encoding) ~pp2:(pp_first_element P2p_point.Id.pp) ("points", Data_encoding.list P2p_point.Id.encoding) let nack_point_no_point = declare_1 ~section ~name:"nack_point_no_point" ~msg:"nack point {point} (no point list due to p2p version)" ~level:Debug ("point", P2p_connection.Id.encoding) let sending_authentication = declare_1 ~section ~name:"sending_authentication" ~msg:"sending authentication to {point}" ~level:Debug ("point", P2p_point.Id.encoding) let connection_closed = declare_1 ~section ~name:"connection_closed" ~msg:"connection closed to {peer}" ~level:Debug ("peer", P2p_peer.Id.encoding) let read_event = declare_2 ~section ~name:"socket_read" ~level:Debug ~msg:"reading {bytes} bytes from {peer}" ("bytes", Data_encoding.int31) ("peer", P2p_peer.Id.encoding) let read_error = declare_0 ~section ~name:"socket_read_error" ~level:Debug ~msg:"[read message] incremental decoding error" () let write_event = declare_2 ~section ~name:"socket_write" ~level:Debug ~msg:"writing {bytes} to {peer}" ("bytes", Data_encoding.int31) ("peer", P2p_peer.Id.encoding) let write_error = declare_2 ~section ~name:"socket_write_error" ~level:Error ~msg:"unexpected error when writing to {peer}: {error}" ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) ("peer", P2p_peer.Id.encoding) end module P2p_io_scheduler = struct include Internal_event.Simple let section = ["p2p"; "io-scheduler"] let connection_closed = declare_3 ~section ~name:"connection_closed_scheduler" ~msg:"connection closed {direction} ({connection_id},{name})" ~level:Debug ("direction", Data_encoding.string) ("connection_id", Data_encoding.int31) ("name", Data_encoding.string) let unexpected_error = declare_4 ~section ~name:"unexpected_error_scheduler" ~msg: "unexpected error in connection ({direction}: {connection_id},{name}): \ {error}" ~level:Error ("direction", Data_encoding.string) ("connection_id", Data_encoding.int31) ("name", Data_encoding.string) ~pp4:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let wait_quota = declare_1 ~section ~name:"scheduler_wait_quota" ~msg:"wait_quota ({name})" ~level:Debug ("name", Data_encoding.string) let wait = declare_1 ~section ~name:"scheduler_wait" ~msg:"wait ({name})" ~level:Debug ("name", Data_encoding.string) let handle_connection = declare_3 ~section ~name:"handle_connection" ~msg:"handle {len} ({connection_id},{name})" ~level:Debug ("len", Data_encoding.int31) ("connection_id", Data_encoding.int31) ("name", Data_encoding.string) let create_connection = declare_2 ~section ~name:"create_connection_scheduler" ~msg:"create connection ({connection_id},{name})" ~level:Debug ("connection_id", Data_encoding.int31) ("name", Data_encoding.string) let update_quota = declare_1 ~section ~name:"update_quota" ~msg:"update quota {name}" ~level:Debug ("name", Data_encoding.string) let reset_quota = declare_0 ~section ~name:"reset_quota" ~msg:"reset quota" ~level:Debug () let create = declare_0 ~section ~name:"create_connection" ~msg:"create" ~level:Debug () let register = declare_1 ~section ~name:"register_connection" ~msg:"register_connection {connection_id}" ~level:Debug ("connection_id", Data_encoding.int31) let close_error = declare_2 ~section ~name:"close_connection_error" ~msg:"close {connection_id} failed with {error}" ~level:Warning ("connection_id", Data_encoding.int31) ("error", Error_monad.error_encoding) let close = declare_1 ~section ~name:"close_connection" ~msg:"close {connection_id}" ~level:Debug ("connection_id", Data_encoding.int31) let shutdown = declare_1 ~section ~name:"shutdown_connection" ~msg:"shutdown {name}" ~level:Info ("name", Data_encoding.string) let shutdown_scheduler = declare_0 ~section ~name:"shutdown_io_scheduler" ~msg:"shutdown scheduler" ~level:Info () end module P2p_pool = struct include Internal_event.Simple let section = ["p2p"; "pool"] let get_points = declare_3 ~section ~name:"get_points" ~msg:"getting points from {medium} of {source}: {point_list}" ~level:Debug ("medium", Data_encoding.string) ("source", P2p_peer.Id.encoding) ~pp3:(pp_first_element P2p_point.Id.pp) ("point_list", Data_encoding.list P2p_point.Id.encoding) let create_pool = declare_1 ~section ~name:"create_pool" ~msg:"create pool: known points {point_list}" ~level:Debug ~pp1:(pp_first_element P2p_point.Id.pp) ("point_list", Data_encoding.list P2p_point.Id.encoding) let parse_error = declare_1 ~section ~name:"parse_error_peers" ~msg:"failed to parse peers file: {error}" ~level:Error ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let saving_metadata = declare_1 ~section ~name:"save_metadata" ~msg:"saving metadata in {file}" ~level:Info ("file", Data_encoding.string) let save_peers_error = declare_1 ~section ~name:"save_error_peers" ~msg:"failed to save peers file: {error}" ~level:Error ~pp1:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) end module Discovery = struct include Internal_event.Simple let section = ["p2p"; "discovery"] let create_socket_error = declare_0 ~section ~name:"create_socket_error" ~msg:"error creating a socket" ~level:Debug () let message_received = declare_0 ~section ~name:"message_received" ~msg:"received discovery message" ~level:Debug () let parse_error = declare_1 ~section ~name:"parse_error" ~msg:"failed to parse ({address})" ~level:Debug ("address", Data_encoding.string) let register_new = declare_1 ~section ~name:"register_new" ~msg:"registering new point {point}" ~level:Notice ("point", P2p_point.Id.encoding) let unexpected_error = declare_2 ~section ~name:"unexpected_error" ~msg:"unexpected error in {worker} worker: {error}" ~level:Error ("worker", Data_encoding.string) ~pp2:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let unexpected_exit = declare_0 ~section ~name:"unexpected_exit" ~msg:"Answer worker exited unexpectedly" ~level:Error () let broadcast_message = declare_0 ~section ~name:"broadcast_message" ~msg:"Broadcasting discovery message" ~level:Debug () let broadcast_error = declare_0 ~section ~name:"broadcast_error" ~msg:"Error broadcasting a discovery request" ~level:Debug () end module P2p = struct include Internal_event.Simple let section = ["p2p"] let activate_layer = declare_0 ~section ~name:"activate_layer" ~level:Info ~msg:"activate P2P layer" () let activate_network = declare_1 ~section ~name:"activate_network" ~level:Info ~msg:"activate id {peer}" ("peer", P2p_peer.Id.encoding) let message_read = declare_1 ~section ~name:"message_read" ~level:Debug ~msg:"message read from {peer}" ("peer", P2p_peer.Id.encoding) let message_read_error = declare_1 ~section ~name:"message_read_error" ~level:Debug ~msg:"error reading message from {peer}" ("peer", P2p_peer.Id.encoding) let shutdown_welcome_worker = declare_0 ~section ~name:"shutdown_welcome_worker" ~level:Notice ~msg:"shutting down the p2p's welcome worker..." () let shutdown_maintenance_worker = declare_0 ~section ~name:"shutdown_maintenance_worker" ~level:Notice ~msg:"shutting down the p2p's network maintenance worker..." () let shutdown_connection_pool = declare_0 ~section ~name:"shutdown_connection_pool" ~level:Notice ~msg:"shutting down the p2p connection pool..." () let shutdown_connection_handler = declare_0 ~section ~name:"shutdown_connection_handler" ~level:Notice ~msg:"shutting down the p2p connection handler..." () let shutdown_scheduler = declare_0 ~section ~name:"shutdown_scheduler" ~level:Notice ~msg:"shutting down the p2p scheduler..." () let message_sent = declare_1 ~section ~name:"message_to_send" ~level:Debug ~msg:"message sent to {peer}" ("peer", P2p_peer.Id.encoding) let sending_message_error = declare_2 ~section ~name:"sending_message_error" ~level:Debug ~msg:"error sending message to {peer}: {error}" ("peer", P2p_peer.Id.encoding) ~pp2:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let message_trysent = declare_2 ~section ~name:"message_trysent" ~level:Debug ~msg:"message trysent to {peer} resulting to {result}" ("peer", P2p_peer.Id.encoding) ("result", Data_encoding.bool) let trysending_message_error = declare_2 ~section ~name:"trysending_message_error" ~level:Debug ~msg:"error trysending message to {peer}: {error}" ("peer", P2p_peer.Id.encoding) ~pp2:pp_print_top_error_of_trace ("error", Error_monad.trace_encoding) let broadcast = declare_0 ~section ~name:"broadcast" ~level:Debug ~msg:"message broadcast" () end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>