Class: Qrack::Client
- Inherits:
-
Object
- Object
- Qrack::Client
- Defined in:
- lib/amqp_logging/ext/qrack/client.rb
Instance Method Summary collapse
Instance Method Details
#socket_with_reliable_timeout ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/amqp_logging/ext/qrack/client.rb', line 26 def socket_with_reliable_timeout socket_without_reliable_timeout secs = Integer(CONNECT_TIMEOUT) usecs = Integer((CONNECT_TIMEOUT - secs) * 1_000_000) optval = [secs, usecs].pack("l_2") begin @socket.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval @socket.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval rescue Errno::ENOPROTOOPT end @socket end |