Network I/O ============= Read/write-time no-sigpipe flag: Read/write-time non-blocking flag: .. c:macro:: YMO_SEND_FLAGS Default send flags: no sigpipe, non-blocking (if available): .. code-block:: c :caption: Definition #define YMO_SEND_FLAGS (YMO_MSG_NOSIGNAL | YMO_MSG_DONTWAIT) .. c:macro:: YMO_RECV_FLAGS Default recv flags: no sigpipe, non-blocking (if available): .. code-block:: c :caption: Definition #define YMO_RECV_FLAGS (YMO_MSG_NOSIGNAL | YMO_MSG_DONTWAIT) Convenience macro for checking blocking operation --------------------------------------------------------------- Socket I/O --------------------------------------------------------------- .. c:function:: ymo_status_t ymo_net_send_buckets(int fd, ymo_bucket_t** head) Send a bucket chain over the socket given by ``fd``. .. c:function:: ymo_status_t ymo_net_send_buckets_tls(SSL* ssl, int fd, ymo_bucket_t** head) Send a bucket chain over the socket given by ``fd``. --------------------------------------------------------------- Socket Trait Functions --------------------------------------------------------------- .. c:function:: static inline int ymo_sock_nonblocking(int fd) Put socket in non-blocking mode at the fd-level: - Use ``MSG_DONTWAIT`` (client fd's only) when available - ``O_NONBLOCK`` (more consistent behavior; requires 2 syscalls) - ``FIOBIO`` (less consistent across platforms; 1 syscall) .. c:function:: static inline int ymo_sock_nosigpipe(int fd) SIGPIPE strategies, in order: - Use ``MSG_NOSIGNAL`` (client fd's only) when available - ``SO_NOSIGPIPE`` (mostly only available on BSD and BSD-like systems) - ``F_GETNOSIGPIPE``/``F_SETNOSIGPIPE`` (Mac OS X; uses ``SO_NOSIGPIPE`` under covers) Otherwise, the user has to ignore sigpipe at the thread/process level prior to reads/writes. .. c:function:: static inline int ymo_sock_reuse(int fd, ymo_server_config_flags_t flags) Set reuse address/port options.