B:BD[
2.110] → [
2.110:401]
B:BD[
3.587] → [
3.587:601]
B:BD[
3.601] → [
2.402:670]
if idx := idx_of(buf[bufidx..buflen_stop]) {
// println('irc middle checking $bufidx .. $buflen_stop => newline at $idx')
bufidx_nl := bufidx + idx
str := string(buf[bufidx..bufidx_nl].clone())
// println('irc middle sending $bufidx .. $bufidx_nl len ($str.len)$str ')
c <- str
bufidx_nlpost := bufidx_nl + idx_of_not_newline(buf[bufidx_nl..])
// println('post channel send, buflen_stop $buflen_stop bufidx_nlpost $bufidx_nlpost')
if buflen_stop == bufidx_nlpost {
println("buf peeled $buflen_stop bytes")
bufidx = 0
for {
if idx := idx_of(buf[bufidx..buflen_stop]) {
// println('irc middle checking $bufidx .. $buflen_stop => newline at $idx')
bufidx_nl := bufidx + idx
str := string(buf[bufidx..bufidx_nl].clone())
//println('irc middle sending $bufidx .. $bufidx_nl len ($str.len)$str ')
c <- str
bufidx_nlpost := bufidx_nl + idx_of_not_newline(buf[bufidx_nl..])
// println('post channel send, buflen_stop $buflen_stop bufidx_nlpost $bufidx_nlpost')
if buflen_stop == bufidx_nlpost {
//println('bufidx = 0. peeled $buflen_stop bytes')
break // read more
} else {
//println('bufidx moved to bufidx_nlpost $bufidx_nlpost buflen_stop $buflen_stop save (${buflen_stop -
// bufidx_nlpost})')
}
bufidx = bufidx_nlpost