connection_or_flush_from_first_active_circuit() does wrong thing when ewma_enabled
Here are our cryptic hints:
connection_or_flush_from_first_active_circuit(): "if (circ != conn->active_circuits)" is wrong, especialy with ewma. read comments, that means it show how stuff is broken.
that means random crashes for "connection_write_to_buf(NULL->body" if ewma enabled.
just remove that condition block, no need any goto before every stream started reads and all circs with empty queue marked as inactive.
"&& queue->head" saves from crashes, but that condition is wrong anyway. you can't unblock streams when you need it.
why need "re-add the cell_ewma_t" inside for{} ? what purpose for{} if you never can flush more than 1 cell for ewma anyway? Why there are no consistent logic for just one small func?