44 const bool use_select =
67 std::
bind(&
GcTcpHub::on_new_connection, this, std::placeholders::_1),
void create_gc_port_for_can_hub(CanHubFlow *can_hub, int fd, Notifiable *on_exit, bool use_select)
Creates a new port on a CAN hub in gridconnect format for a select-compatible file descriptor.
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
Bind a name to a socket.
See OSMutexLock in os/OS.hxx.
This class runs a CAN-bus HUB listening on TCP socket using the gridconnect format.
unsigned numClients_
How many clients are connected right now.
GcTcpHub(CanHubFlow *can_hub, int port)
Constructor.
SocketListener tcpListener_
Helper object representing the listening on the socket.
void notify() override
Error callback from the gridconnect socket.
void on_new_connection(int fd)
Callback when a new connection arrives.
void shutdown()
Shuts down the socket listener.
#define CONSTANT_TRUE
We cannot compare constants to zero, so we use 1 and 2 as constant values for booleans.
static void optimize_socket_fd(int fd)
Optimizes the kernel settings like socket and TCP options for an fd that is an outgoing TCP socket.