Fixes crashes when asyncdispatch.adjustTimeout returns a negative value. (#11231)
This commit is contained in:
parent
2339542832
commit
d0b8724aa2
6 changed files with 22 additions and 7 deletions
|
|
@ -211,11 +211,10 @@ proc processPendingCallbacks(p: PDispatcherBase; didSomeWork: var bool) =
|
|||
didSomeWork = true
|
||||
|
||||
proc adjustTimeout(pollTimeout: int, nextTimer: Option[int]): int {.inline.} =
|
||||
if nextTimer.isNone():
|
||||
if nextTimer.isNone() or pollTimeout == -1:
|
||||
return pollTimeout
|
||||
|
||||
result = nextTimer.get()
|
||||
if pollTimeout == -1: return
|
||||
result = max(nextTimer.get(), 0)
|
||||
result = min(pollTimeout, result)
|
||||
|
||||
proc callSoon*(cbproc: proc () {.gcsafe.}) {.gcsafe.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue