The problem was in the deferred hook. Also changed it's return value,
hooks like this should always return HOOK_IDLE and not slower HOOK_RETRY.
rec_io_process_read_buf(struct main_rec_io *rio)
{
uint got;
+ ASSERT(rio->read_prev_avail < rio->read_avail);
while (rio->read_running && (got = rio->read_handler(rio)))
{
DBG("RIO READ: Ate %u bytes", got);
if (got == ~0U)
return HOOK_IDLE;
+ ASSERT(got <= rio->read_avail);
rio->read_rec_start += got;
rio->read_avail -= got;
rio->read_prev_avail = 0;
rio->read_running = 1;
rio->read_prev_avail = 0;
- return rec_io_process_read_buf(rio);
+ if (rio->read_avail)
+ rec_io_process_read_buf(rio);
+
+ return HOOK_IDLE;
}
static void