Go back to using a threaded endpoint insted of a twisted protocol.

To work around the fact that the database blocks for so long that the UDP buffers fill and loads
of messages get lost.