mirror of
https://github.com/logos-storage/nim-chronos.git
synced 2026-01-11 01:43:07 +00:00
Add ServerFlags for datagram transport on Windows.
This commit is contained in:
parent
4d144753ee
commit
c90eebf821
@ -47,7 +47,7 @@ type
|
||||
## ``nbytes`` - number of bytes received
|
||||
## ``remote`` - remote peer address
|
||||
## ``udata`` - user-defined pointer, specified at Transport creation.
|
||||
##
|
||||
##
|
||||
## ``pbytes`` will be `nil` and ``nbytes`` will be ``0``, if there an error
|
||||
## happens.
|
||||
|
||||
@ -220,6 +220,14 @@ when defined(windows):
|
||||
localSock = sock
|
||||
register(localSock)
|
||||
|
||||
## Apply ServerFlags here
|
||||
if ServerFlags.ReuseAddr in flags:
|
||||
if not setSockOpt(localSock, SOL_SOCKET, SO_REUSEADDR, 1):
|
||||
let err = osLastError()
|
||||
if sock == asyncInvalidSocket:
|
||||
closeAsyncSocket(localSock)
|
||||
raiseOsError(err)
|
||||
|
||||
if local.port != Port(0):
|
||||
var saddr: Sockaddr_storage
|
||||
var slen: SockLen
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user