Move checkCloseError to nativesockets
This commit is contained in:
parent
fb8168d338
commit
7a839d7b02
3 changed files with 32 additions and 25 deletions
|
|
@ -1,9 +1,16 @@
|
|||
discard """
|
||||
exitcode: 0
|
||||
output: ""
|
||||
"""
|
||||
|
||||
import asyncdispatch, net, os, nativesockets
|
||||
|
||||
# bug: https://github.com/nim-lang/Nim/issues/5279
|
||||
|
||||
proc setupServerSocket(hostname: string, port: Port): AsyncFD =
|
||||
let fd = newNativeSocket()
|
||||
if fd == osInvalidSocket:
|
||||
raiseOSError(osLastError())
|
||||
setSockOptInt(fd, SOL_SOCKET, SO_REUSEADDR, 1)
|
||||
var aiList = getAddrInfo(hostname, port)
|
||||
if bindAddr(fd, aiList.ai_addr, aiList.ai_addrlen.Socklen) < 0'i32:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue