1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* ISC license. */ #include <skalibs/nonposix.h> #include <sys/socket.h> #include <skalibs/socket.h> void socket_tryreservein (int s, unsigned int size) { while (size >= 1024) { if (!setsockopt(s, SOL_SOCKET, SO_RCVBUF, &size, sizeof size)) return ; size -= (size >> 5) ; } }