Definition at line 16 of file relay.cpp.
◆ Relay()
Definition at line 18 of file relay.cpp.
18 {
19 std::cout << "relay: init.\n";
21 }
void mx_socket_ignore_pipe_signal()
Ignore SIGPIPE on platforms that require it.
◆ ~Relay()
Definition at line 22 of file relay.cpp.
22 {
23 std::cout << "relay: quit.\n";
24 }
◆ listen()
| bool Relay::listen |
( |
std::string_view | port | ) |
|
|
inline |
Definition at line 28 of file relay.cpp.
28 {
29 if (sockfd.listen(port, 5)) {
31 std::vector<mxnetwork::Socket> sockets;
32 Messages message(&sockets);
33 std::thread background(std::move(message));
35 std::optional<mxnetwork::Socket> new_s = sockfd.accept();
36 if (new_s == std::nullopt) {
37 if (errno == EINTR)
38 continue;
40 continue;
41 }
43 new_s->setblocking(false);
44 sockets.push_back(std::move(*new_s));
46 }
47 background.join();
48 } else {
49 perror("listen");
50 return false;
51 }
52 return true;
53 }
std::atomic< bool > active
◆ stop()
The documentation for this class was generated from the following file: