lib/ably/realtime/client/incoming_message_dispatcher.rb in ably-1.0.7 vs lib/ably/realtime/client/incoming_message_dispatcher.rb in ably-1.1.0
- old
+ new
@@ -100,11 +100,15 @@
when ACTION.Attached
get_channel(protocol_message.channel).tap do |channel|
if channel.attached?
channel.manager.duplicate_attached_received protocol_message
else
- channel.transition_state_machine :attached, reason: protocol_message.error, resumed: protocol_message.has_channel_resumed_flag?, protocol_message: protocol_message
+ if channel.failed?
+ logger.warn "Ably::Realtime::Client::IncomingMessageDispatcher - Received an ATTACHED protocol message for FAILED channel #{channel.name}. Ignoring ATTACHED message"
+ else
+ channel.transition_state_machine :attached, reason: protocol_message.error, resumed: protocol_message.has_channel_resumed_flag?, protocol_message: protocol_message
+ end
end
end
when ACTION.Detach
when ACTION.Detached
@@ -130,10 +134,10 @@
when ACTION.Auth
client.auth.authorize
else
- error = Ably::Exceptions::ProtocolError.new("Protocol Message Action #{protocol_message.action} is unsupported by this MessageDispatcher", 400, 80013)
+ error = Ably::Exceptions::ProtocolError.new("Protocol Message Action #{protocol_message.action} is unsupported by this MessageDispatcher", 400, Ably::Exceptions::Codes::PROTOCOL_ERROR)
logger.fatal error.message
end
end
def dispatch_channel_error(protocol_message)