haxetink / tink_io

Asynchronous I/O everywhere
https://haxetink.github.io/tink_io
MIT License
18 stars 12 forks source link

Splitter issue #14

Open kevinresol opened 7 years ago

kevinresol commented 7 years ago

I wonder why it minus delim.length here

If the bytes comes in like | -- message -- | -- delim -- | then the said code will make it only read til the end of the message but it won't progress because it will not encounter the delimiter at all

kevinresol commented 7 years ago

Well, I think it makes sense to change to:

if (!atEnd) {
  if (length < delim.length) length = 0;
}