Method: Riemann::Client::UDP#with_connection
- Defined in:
- lib/riemann/client/udp.rb
#with_connection ⇒ Object
Yields a connection in the block.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/riemann/client/udp.rb', line 51 def with_connection tries = 0 @locket.synchronize do begin tries += 1 yield(@socket || connect) rescue IOError => e raise if tries > 3 connect and retry rescue Errno::EPIPE => e raise if tries > 3 connect and retry rescue Errno::ECONNREFUSED => e raise if tries > 3 connect and retry rescue Errno::ECONNRESET => e raise if tries > 3 connect and retry rescue InvalidResponse => e raise if tries > 3 connect and retry end end end |