Add checks for invalid socket when creating sockets.

This commit is contained in:
Dominik Picheta 2014-04-15 13:51:25 +01:00
commit 21d0cc8cdf
7 changed files with 9 additions and 0 deletions

View file

@ -84,6 +84,7 @@ proc serve*(action: proc (){.nimcall.}) =
of "tcp", "":
when useCaas:
var server = socket()
if server == invalidSocket: osError(osLastError())
let p = getConfigVar("server.port")
let port = if p.len > 0: parseInt(p).TPort else: 6000.TPort
server.bindAddr(port, getConfigVar("server.address"))