nim-chronos
nim-chronos copied to clipboard
provide api readLineInto similar with asyncdispatch's recvInto
chronos provide readUntill raise two kinds of exception that I can handle, but when exception occurs I dont know how much bytes read , the parsing logic heavily relies on it.
https://github.com/bung87/looper/blob/b02e79c73b8cb6afd6e5231b632c1b2d9cdb60a0/src/looper/http/multipartparser.nim#L239-L246
https://nim-lang.org/docs/asyncdispatch.html#recvInto%2CAsyncFD%2Cpointer%2Cint
I found first time limit error occurs I read full buf len data then second limit error occurs my buffer remain old data and truncated
can a predicate solve your issue?
Maybe , I haven't try , current I use a loop https://github.com/bung87/Looper/blob/39a0a212e0549937a3067d64fccd088fbb5255c1/src/looper/http/multipartparser.nim#L240