network optimizations

Ignore-this: bcec7f1b20240a14a7212719a22932ba

1. added thread just for tcp connections and sending messages so that udp does not block
2. timing changes to ping
3. caching values in dh_secret

darcs-hash:20131115060013-c21fe-ee0c06b4c665868c18df0ec62cd7468310549c23