mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-02-08 09:24:00 +00:00
X
This commit is contained in:
parent
d95c875361
commit
706e2a2db8
@ -519,7 +519,7 @@ proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int,
|
||||
" <--> isNil(rstream.readerLoop) = " & $isNil(rstream.readerLoop)
|
||||
if isNil(rstream.rsource):
|
||||
try:
|
||||
return await readUntil(rstream.tsource, pbytes, nbytes, sep)
|
||||
return await readUntil(rstream.tsource, pbytes, nbytes, sep, withLogs = withLogs)
|
||||
except CancelledError as exc:
|
||||
raise exc
|
||||
except TransportIncompleteError:
|
||||
|
@ -2412,7 +2412,7 @@ proc readOnce*(transp: StreamTransport, pbytes: pointer,
|
||||
return count
|
||||
|
||||
proc readUntil*(transp: StreamTransport, pbytes: pointer, nbytes: int,
|
||||
sep: seq[byte]): Future[int] {.async.} =
|
||||
sep: seq[byte], withLogs = false): Future[int] {.async.} =
|
||||
## Read data from the transport ``transp`` until separator ``sep`` is found.
|
||||
##
|
||||
## On success, the data and separator will be removed from the internal
|
||||
@ -2459,6 +2459,9 @@ proc readUntil*(transp: StreamTransport, pbytes: pointer, nbytes: int,
|
||||
else:
|
||||
state = 0
|
||||
|
||||
if withLogs:
|
||||
echo "readUntil: " & $transp.offset & " bytes available (" &
|
||||
$index & ", " & $state & " == " & $len(sep) & ")"
|
||||
(index, state == len(sep))
|
||||
|
||||
return k
|
||||
|
Loading…
x
Reference in New Issue
Block a user