Remove buffer limit on binary protocol decoder

Buffer exhaustion is a problem for the server not the client.
This commit is contained in:
Emery Hemingway 2023-04-10 16:57:34 -05:00
parent 6364db7f69
commit cf05845f15
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: ☭ 2021 Emery Hemingway # SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense # SPDX-License-Identifier: Unlicense
import std/[asyncdispatch, options, streams, tables] import std/[asyncdispatch, options, streams, tables]
@ -315,7 +315,7 @@ when defined(posix):
initialOid: 0.Oid.some) initialOid: 0.Oid.some)
let relayFut = spawnRelay("unix", turn, ops) do (turn: var Turn; relay: Relay): let relayFut = spawnRelay("unix", turn, ops) do (turn: var Turn; relay: Relay):
let facet = turn.facet let facet = turn.facet
var wireBuf = newBufferedDecoder() var wireBuf = newBufferedDecoder(0)
proc recvCb(pktFut: Future[string]) {.gcsafe.} = proc recvCb(pktFut: Future[string]) {.gcsafe.} =
if pktFut.failed: if pktFut.failed:
run(facet) do (turn: var Turn): stopActor(turn) run(facet) do (turn: var Turn): stopActor(turn)
@ -369,7 +369,7 @@ when defined(posix):
asyncCheck spawnRelay("stdio", turn, opts) do (turn: var Turn; relay: Relay): asyncCheck spawnRelay("stdio", turn, opts) do (turn: var Turn; relay: Relay):
let let
facet = turn.facet facet = turn.facet
asyncStdin = openAsync("/dev/stdin") asyncStdin = newAsyncFile(AsyncFD 0)
facet.actor.atExit do (turn: var Turn): facet.actor.atExit do (turn: var Turn):
close(asyncStdin) close(asyncStdin)
var wireBuf = newBufferedDecoder() var wireBuf = newBufferedDecoder()