WIP: slightly friendlier dummy do_client_query
WIP: fix edge-cases in I/O loop where queries could be lost.