MCPcopy Create free account
hub / github.com/attermann/microReticulum / server_loop

Function server_loop

examples/link_native/src/main.cpp:79–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void server_loop(RNS::Destination& destination) {
80 // Let the user know that everything is ready
81 RNS::logf(RNS::LOG_NOTICE, "Link example <%s> running, waiting for a connection.", destination.hash().toHex().c_str());
82
83 RNS::log("Hit enter to manually send an announce (Ctrl-C to quit)");
84
85 // We enter a loop that runs until the users exits.
86 // If the user hits enter, we will announce our server
87 // destination on the network, which will let clients
88 // know how to create messages directed towards it.
89 while (true) {
90 reticulum.loop();
91 // Non-blocking input
92 char ch;
93 while (read(STDIN_FILENO, &ch, 1) > 0) {
94 if (ch == '\n') {
95 destination.announce();
96 RNS::logf(RNS::LOG_NOTICE, "Sent announce from %s", destination.hash().toHex().c_str());
97 }
98 }
99 }
100}
101
102// This initialisation is executed when the users chooses
103// to run as a server

Callers 1

serverFunction · 0.70

Calls 6

logfFunction · 0.85
logFunction · 0.85
toHexMethod · 0.80
hashMethod · 0.80
announceMethod · 0.80
loopMethod · 0.45

Tested by

no test coverage detected