lib/ably/realtime/client/outgoing_message_dispatcher.rb in ably-0.8.4 vs lib/ably/realtime/client/outgoing_message_dispatcher.rb in ably-0.8.5
- old
+ new
@@ -42,9 +42,15 @@
def deliver_queued_protocol_messages
condition = -> { can_send_messages? && messages_in_outgoing_queue? }
non_blocking_loop_while(condition) do
protocol_message = outgoing_queue.shift
+
+ if (!connection.transport)
+ protocol_message.fail Ably::Exceptions::TransportClosed.new('Transport disconnected unexpectedly', nil, 80003)
+ next
+ end
+
current_transport_outgoing_message_bus.publish :protocol_message, protocol_message
if protocol_message.ack_required?
pending_ack_queue << protocol_message
else