@sit just an idea - what if you defer draining outstanding messages at line 61 and 65, and then remove this break with simple return. It is a fall-through anyway when all the channels are closed as the "iochan" will close channel on read error. What do you think? :)