make SO_REUSEPORT independent of Linux header

This commit is contained in:
Andreas Rumpf 2016-05-29 22:31:31 +02:00
commit d727581430

View file

@ -1575,8 +1575,6 @@ var
## Receive timeout. ## Receive timeout.
SO_REUSEADDR* {.importc, header: "<sys/socket.h>".}: cint SO_REUSEADDR* {.importc, header: "<sys/socket.h>".}: cint
## Reuse of local addresses is supported. ## Reuse of local addresses is supported.
SO_REUSEPORT* {.importc, header: "<sys/socket.h>".}: cint
## Multiple binding: load balancing on incoming TCP connections or UDP packets. (Requires Linux kernel > 3.9)
SO_SNDBUF* {.importc, header: "<sys/socket.h>".}: cint SO_SNDBUF* {.importc, header: "<sys/socket.h>".}: cint
## Send buffer size. ## Send buffer size.
SO_SNDLOWAT* {.importc, header: "<sys/socket.h>".}: cint SO_SNDLOWAT* {.importc, header: "<sys/socket.h>".}: cint
@ -1615,6 +1613,16 @@ else:
var var
MAP_POPULATE*: cint = 0 MAP_POPULATE*: cint = 0
when defined(linux) or defined(nimdoc):
when defined(alpha) or defined(mips) or defined(parisc) or
defined(sparc) or defined(nimdoc):
const SO_REUSEPORT* = cint(0x0200)
## Multiple binding: load balancing on incoming TCP connections
## or UDP packets. (Requires Linux kernel > 3.9)
else:
const SO_REUSEPORT* = cint(15)
else:
var SO_REUSEPORT* {.importc, header: "<sys/socket.h>".}: cint
when defined(macosx): when defined(macosx):
# We can't use the NOSIGNAL flag in the ``send`` function, it has no effect # We can't use the NOSIGNAL flag in the ``send`` function, it has no effect