make SO_REUSEPORT independent of Linux header
This commit is contained in:
parent
7bf7c4d49e
commit
d727581430
1 changed files with 22 additions and 14 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue