v0.1.9 candidate.

Split heartbeat into its own thread (so python requests that take a long time
do not hang it up).  Major rewrite of the networking code on the c++ side to
avoid timing issues that could leave the plugin hanging waiting for more data
from python, who has already closed its socket.