tezedge / tezos-node

1 stars 0 forks source link

P2P/message #4

Open jurajselep opened 5 years ago

jurajselep commented 5 years ago
type 'msg t =
  | Bootstrap
  (** Welcome message sent by a peer upon connection *)
  | Advertise of P2p_point.Id.t list
  (** Response to a [Bootstrap] message, contains list of known points *)
  | Swap_request of P2p_point.Id.t * P2p_peer.Id.t
  (** Propose new peer/point and ask a peer/point to swap with *)
  | Swap_ack of P2p_point.Id.t * P2p_peer.Id.t
  (** Response to a swap request and propose peer/point to swap with. *)
  | Message of 'msg
  (** Generic upper-layer message *)
  | Disconnect
  (** Ending of connection *)
jurajselep commented 5 years ago

The P2p protocol is simple and can be deduced mostly from the message type.

To make the network topology more dynamic, it implements a simple peer swapping mechanism which works as follows.