aphyr/riemann-ruby-client — pull request #10 by gsandie (2013-05-25 13:34:53+00:00)
Title: Add tcp socket timeouts

This is an attempt at adding the tcp timeouts as suggested by @aphyr in [this comment](https://github.com/aphyr/riemann-tools/pull/42#issuecomment-18289667).

I'm not sure if I'm taking the right approach.

I've added the timeout into the connect, as when we're sending the message, we're first checking to see if there is a connection, so it seemed like a good place to add it.

I've tested this locally using iptables to simulate network timeouts to the client, however I've been struggling to add a test case in the specs.

I also wasn't sure if timeout was the best thing to be using, as I read that it can impact performance due to the way it spawns and joins threads. However while running tests I've not noticed any major slowdowns. The information I found about timeout is [here](http://stackoverflow.com/questions/9853516/set-socket-timeout-in-ruby-via-so-rcvtimeo-socket-option/12111120#12111120).