/* net.h — socket setup (the kernel-facing seam, part 1). * * All socket option choices that matter for 10 GbE live here: SO_REUSEPORT so * each reactor owns a listen queue and the kernel shards inbound peers across * cores, TCP_NODELAY (BitTorrent is latency-sensitive on small control msgs), * and large socket buffers so the BDP fits. */ #ifndef NAUT_NET_H #define NAUT_NET_H #include "naut/common.h" #include /* Create a TCP listener bound to `port`. With reuseport=true, multiple reactors * may each create one on the same port and the kernel load-balances accepts. */ int naut_net_listen(uint16_t port, int backlog, bool reuseport); /* Tune an accepted/connected peer socket for throughput. */ void naut_net_tune_peer(int fd); /* Set send/recv socket buffer sizes (bytes); 0 leaves the kernel default. */ void naut_net_set_bufsizes(int fd, int sndbuf, int rcvbuf); int naut_net_set_nonblock(int fd, bool on); #endif /* NAUT_NET_H */