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

Function server_loop

examples/nomadnet/src/main.cpp:117–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void server_loop(RNS::Destination& destination) {
118 RNS::logf(RNS::LOG_NOTICE,
119 "NomadNet example node <%s> running, serving %s",
120 destination.hash().toHex().c_str(), DEFAULT_PAGE_PATH);
121 RNS::log("Hit enter to re-announce (Ctrl-C to quit)");
122
123 const RNS::Bytes node_name_app_data(NODE_NAME);
124
125 while (true) {
126 reticulum.loop();
127 // Non-blocking input
128 char ch;
129 while (read(STDIN_FILENO, &ch, 1) > 0) {
130 if (ch == '\n') {
131 destination.announce(node_name_app_data);
132 RNS::logf(RNS::LOG_NOTICE, "Sent announce from %s as \"%s\"",
133 destination.hash().toHex().c_str(), NODE_NAME);
134 }
135 }
136 }
137}
138
139void server() {
140

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