Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/node/client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ let request node request recipient =

let post node message =
!node.disseminator <- Disseminator.post !node.disseminator message

let broadcast node message =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already added it in #56 , using Networking.broadcast that was already there.

Message.{ message with recipients = peers !node } |> Networking.send_to node
4 changes: 4 additions & 0 deletions lib/node/client.mli
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ val request : node ref -> bytes -> Address.t -> Message.t Lwt.t
val create_post : node ref -> ?request_ack:bool -> bytes -> Message.t

val create_ack : node ref -> Message.t -> Message.t

(** [broadcast node message] immediately sends a [Message.t] of the {i Post category}
to all the peers of the given node. The message is sent only once. *)
val broadcast : node ref -> Message.t -> unit Lwt.t