diff --git a/libp2p/streams/chronosstream.nim b/libp2p/streams/chronosstream.nim index 7c1483f8a..e4da9c64b 100644 --- a/libp2p/streams/chronosstream.nim +++ b/libp2p/streams/chronosstream.nim @@ -7,19 +7,23 @@ ## This file may not be copied, modified, or distributed except according to ## those terms. +# {.push raises: [].} + import chronos, chronicles -import stream, ringbuffer +import stream logScope: topic = "ChronosStream" const DefaultChunkSize* = 1 shl 20 # 1MB +# const DefaultChunkSize* = 10 type ChronosStream* = ref object of Stream reader: AsyncStreamReader writer: AsyncStreamWriter server: StreamServer client: StreamTransport + eof: bool buffer: seq[byte] maxChunkSize: int @@ -36,14 +40,18 @@ proc init*(C: type[ChronosStream], buffer: newSeq[byte](maxChunkSize)) proc internalRead(c: ChronosStream): Future[seq[byte]] {.async.} = - var buff = newSeq[byte](1024) - var read = await c.reader.readOnce(unsafeAddr buff[0], buff.len) - result = buff[0..