pass State to iterator
We want to be able to zip this iterator with other iterators that also
manipulate the vqstate. Hence we must pass the State explicitly rather
than keeping it opaque inside the iterator state.

Also, some refactoring on read_msg.