Fix hidden exceptions in transports.
This commit is contained in:
parent
d949710d8d
commit
7e8ecb1dd0
|
@ -3,7 +3,7 @@ version = "2.0.1"
|
|||
author = "Status Research & Development GmbH"
|
||||
description = "Asyncdispatch2"
|
||||
license = "Apache License 2.0 or MIT"
|
||||
skipDirs = @["tests", "Nim", "nim"]
|
||||
skipDirs = @["tests", "Nim", "nim", "benchmarks"]
|
||||
|
||||
### Dependencies
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ when defined(windows):
|
|||
transp.state.incl({ReadEof, ReadPaused})
|
||||
fromSockAddr(transp.raddr, transp.ralen, raddr.address, raddr.port)
|
||||
transp.buflen = bytesCount
|
||||
discard transp.function(transp, raddr)
|
||||
asyncCheck transp.function(transp, raddr)
|
||||
elif int(err) == ERROR_OPERATION_ABORTED:
|
||||
# CancelIO() interrupt
|
||||
transp.state.incl(ReadPaused)
|
||||
|
@ -150,7 +150,7 @@ when defined(windows):
|
|||
transp.setReadError(err)
|
||||
transp.state.incl(ReadPaused)
|
||||
transp.buflen = 0
|
||||
discard transp.function(transp, raddr)
|
||||
asyncCheck transp.function(transp, raddr)
|
||||
else:
|
||||
## Initiation
|
||||
if transp.state * {ReadEof, ReadClosed, ReadError} == {}:
|
||||
|
@ -180,7 +180,7 @@ when defined(windows):
|
|||
transp.state.incl(ReadPaused)
|
||||
transp.setReadError(err)
|
||||
transp.buflen = 0
|
||||
discard transp.function(transp, raddr)
|
||||
asyncCheck transp.function(transp, raddr)
|
||||
break
|
||||
|
||||
proc resumeRead(transp: DatagramTransport) {.inline.} =
|
||||
|
@ -330,7 +330,7 @@ else:
|
|||
if res >= 0:
|
||||
fromSockAddr(transp.raddr, transp.ralen, raddr.address, raddr.port)
|
||||
transp.buflen = res
|
||||
discard transp.function(transp, raddr)
|
||||
asyncCheck transp.function(transp, raddr)
|
||||
else:
|
||||
let err = osLastError()
|
||||
if int(err) == EINTR:
|
||||
|
@ -338,7 +338,7 @@ else:
|
|||
else:
|
||||
transp.buflen = 0
|
||||
transp.setReadError(err)
|
||||
discard transp.function(transp, raddr)
|
||||
asyncCheck transp.function(transp, raddr)
|
||||
break
|
||||
|
||||
proc writeDatagramLoop(udata: pointer) =
|
||||
|
|
|
@ -469,16 +469,14 @@ when defined(windows):
|
|||
else:
|
||||
if not isNil(server.init):
|
||||
var transp = server.init(server, server.asock)
|
||||
discard server.function(
|
||||
server,
|
||||
newStreamSocketTransport(server.asock, server.bufferSize,
|
||||
transp)
|
||||
)
|
||||
let ntransp = newStreamSocketTransport(server.asock,
|
||||
server.bufferSize,
|
||||
transp)
|
||||
asyncCheck server.function(server, ntransp)
|
||||
else:
|
||||
discard server.function(
|
||||
server,
|
||||
newStreamSocketTransport(server.asock, server.bufferSize, nil)
|
||||
)
|
||||
let ntransp = newStreamSocketTransport(server.asock,
|
||||
server.bufferSize, nil)
|
||||
asyncCheck server.function(server, ntransp)
|
||||
elif int32(ovl.data.errCode) == ERROR_OPERATION_ABORTED:
|
||||
# CancelIO() interrupt
|
||||
server.asock.closeAsyncSocket()
|
||||
|
@ -713,10 +711,10 @@ else:
|
|||
if sock != asyncInvalidSocket:
|
||||
if not isNil(server.init):
|
||||
var transp = server.init(server, sock)
|
||||
discard server.function(server,
|
||||
asyncCheck server.function(server,
|
||||
newStreamSocketTransport(sock, server.bufferSize, transp))
|
||||
else:
|
||||
discard server.function(server,
|
||||
asyncCheck server.function(server,
|
||||
newStreamSocketTransport(sock, server.bufferSize, nil))
|
||||
break
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue