-
Notifications
You must be signed in to change notification settings - Fork 23
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.
Callback<PeerEvent::Result(PeerEvent&&)>;| Type | Description |
|---|---|
PeerEvent&& |
A QuantumGate::Extender::PeerEvent object containing details about the event. |
The extender should return a QuantumGate::Extender::PeerEvent::Result struct containing two bool values.
- The first
Handledvalue should indicate whether or not the message was recognized and handled (trueif so, otherwisefalse). - The second
Successvalue should indicate whether the message was successfully handled or not (trueif so, otherwisefalse).
Based on the return value, the QuantumGate instance can determine whether or not a peer is misbehaving and can take appropriate measures.
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.).