lib/asir/transport/buffer.rb in asir-1.1.12 vs lib/asir/transport/buffer.rb in asir-1.2.0

- old
+ new

@@ -23,19 +23,19 @@ @paused_mutex = Mutex.new end # If paused, queue messages, # Otherwise delegate immediately to #transport. - def _send_message message, message_payload + def _send_message state return nil if @ignore if paused? @messages_mutex.synchronize do - @messages << message + @messages << state.message end nil else - @transport.send_message(message) + @transport.send_message(state.message) end end # Returns true if currently paused. # Messages are queued until #resume!. @@ -95,10 +95,10 @@ # Processes queue. # Usually used in worker Thread. def process! non_block=false @running = true - while @running && message = shift(non_block) + while @running && (message = shift(non_block)) @transport.send_message(message) end message end