Skip to content

QuantumGate::Extender::PeerMessageCallback

Karel Donk edited this page Dec 10, 2019 · 2 revisions

This callback function gets called by the QuantumGate instance to notify an extender of a peer message event.

Declaration

Callback<PeerEvent::Result(PeerEvent&&)>;

Parameters

Type Description
PeerEvent&& A QuantumGate::Extender::PeerEvent object containing details about the event.

Return values

The extender should return a QuantumGate::Extender::PeerEvent::Result struct containing two bool values.

  • The first Handled value should indicate whether or not the message was recognized and handled (true if so, otherwise false).
  • The second Success value should indicate whether the message was successfully handled or not (true if so, otherwise false).

Based on the return value, the QuantumGate instance can determine whether or not a peer is misbehaving and can take appropriate measures.

Thread safety

Note that it's possible for a QuantumGate instance to invoke this callback function simultaneously from multiple threads. Therefore if you access shared resources (memory, variables, files, etc.) from within this callback function, make sure that you build in the necessary synchronization (using mutexes etc.).

Clone this wiki locally