lib/bunny/session.rb in bunny-0.9.2 vs lib/bunny/session.rb in bunny-0.9.3
- old
+ new
@@ -628,29 +628,29 @@
# Exposed primarily for Bunny::Channel
#
# @raise [ConnectionClosedError]
# @private
def send_frame(frame, signal_activity = true)
- if closed?
- raise ConnectionClosedError.new(frame)
- else
+ if open?
@transport.write(frame.encode)
signal_activity! if signal_activity
+ else
+ raise ConnectionClosedError.new(frame)
end
end
# Sends frame to the peer, checking that connection is open.
# Uses transport implementation that does not perform
# timeout control. Exposed primarily for Bunny::Channel.
#
# @raise [ConnectionClosedError]
# @private
def send_frame_without_timeout(frame, signal_activity = true)
- if closed?
- raise ConnectionClosedError.new(frame)
- else
+ if open?
@transport.write_without_timeout(frame.encode)
signal_activity! if signal_activity
+ else
+ raise ConnectionClosedError.new(frame)
end
end
# Sends multiple frames, one by one. For thread safety this method takes a channel
# object and synchronizes on it.