Class: Bunny::Client
- Inherits:
-
Qrack::Client
- Object
- Qrack::Client
- Bunny::Client
- Defined in:
- lib/bunny-ext/bunny/client08.rb,
lib/bunny-ext/bunny/client09.rb
Constant Summary
Constants inherited from Qrack::Client
Instance Method Summary collapse
-
#next_frame(opts = {}) ⇒ Object
Overwritten with a version that uses Bunny::Timer::timeout instead of Object#timeout which is either timeout.rb (ruby 1.9.x) or SystemTimer (ruby 1.8.x) read: ph7spot.com/musings/system-timer.
Methods inherited from Qrack::Client
#initialize_with_timeout_opts, #send_command, #set_socket_timeouts, #socket
Instance Method Details
#next_frame(opts = {}) ⇒ Object
Overwritten with a version that uses Bunny::Timer::timeout instead of Object#timeout which is either timeout.rb (ruby 1.9.x) or SystemTimer (ruby 1.8.x) read: ph7spot.com/musings/system-timer
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bunny-ext/bunny/client08.rb', line 7 def next_frame(opts = {}) frame = nil case when channel.frame_buffer.size > 0 frame = channel.frame_buffer.shift when opts.has_key?(:timeout) Bunny::Timer::timeout(opts[:timeout], Qrack::ClientTimeout) do frame = Qrack::Transport::Frame.parse(buffer) end else frame = Qrack::Transport::Frame.parse(buffer) end @logger.info("received") { frame } if @logging raise Bunny::ConnectionError, 'No connection to server' if (frame.nil? and !connecting?) # Monitor server activity and discard heartbeats @message_in = true case when frame.is_a?(Qrack::Transport::Heartbeat) next_frame(opts) when frame.nil? frame when ((frame.channel != channel.number) and (frame.channel != 0)) channel.frame_buffer << frame next_frame(opts) else frame end end |