Fray Engine
Loading...
Searching...
No Matches
message_router.hpp
Go to the documentation of this file.
1/* message_router.hpp */
2
3#ifndef _FRAY_MESSAGE_ROUTER_HPP_
4#define _FRAY_MESSAGE_ROUTER_HPP_
5
6#include <optional>
7
8#include "log_manager.hpp"
9#include "message.hpp"
10
11namespace fray
12{
13 namespace routing
14 {
27
36 const message::Prefix& prefix)
37 {
38 // The engine hears every broadcast. It never relays one: every process already received it from its sender.
39 if (prefix.destinationKind == PROCESS_KIND_ENGINE || prefix.destinationKind == PROCESS_KIND_BROADCAST)
41 if (prefix.destinationKind == PROCESS_KIND_ELECTRON_MAIN || prefix.destinationKind == PROCESS_KIND_ELECTRON_RENDERER)
42 return Destination::relay;
43 log::engineWarn("Cannot route message: unsupported destination kind=%u id=%u.",
44 static_cast<unsigned>(prefix.destinationKind), prefix.destinationId);
46 }
47 }
48}
49
50#endif
F_void engineWarn(const F_char *fmt,...)
Log warning for Engine.
Destination routeMessage(const message::Prefix &prefix)
Decides where an incoming message goes from its prefix destination. Pure apart from logging; may run ...
Destination
Where an incoming message should be handled.
Fixed-size routing prefix at the start of every frame; routers read only this. All integers are big-e...
Definition message.hpp:53
ProcessKind destinationKind
Definition message.hpp:57