diff options
7 files changed, 13 insertions, 6 deletions
diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index ca903a810d..f3085840ca 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -137,6 +137,9 @@ module ActionCable # transmission until redis pubsub subscription is confirmed. @defer_subscription_confirmation = false + @reject_subscription = nil + @subscription_confirmation_sent = nil + delegate_connection_identifiers subscribe_to_channel end diff --git a/actioncable/lib/action_cable/connection/base.rb b/actioncable/lib/action_cable/connection/base.rb index 7e9eec7508..f7b18a85ae 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -62,6 +62,7 @@ module ActionCable @subscriptions = ActionCable::Connection::Subscriptions.new(self) @message_buffer = ActionCable::Connection::MessageBuffer.new(self) + @_internal_redis_subscriptions = nil @started_at = Time.now end @@ -138,10 +139,11 @@ module ActionCable end - private + protected attr_reader :websocket attr_reader :message_buffer + private def on_open connect if respond_to?(:connect) subscribe_to_internal_channel diff --git a/actioncable/lib/action_cable/connection/message_buffer.rb b/actioncable/lib/action_cable/connection/message_buffer.rb index 25cff75b41..2f65a1e84a 100644 --- a/actioncable/lib/action_cable/connection/message_buffer.rb +++ b/actioncable/lib/action_cable/connection/message_buffer.rb @@ -29,10 +29,11 @@ module ActionCable receive_buffered_messages end - private + protected attr_reader :connection attr_accessor :buffered_messages + private def valid?(message) message.is_a?(String) end diff --git a/actioncable/lib/action_cable/connection/subscriptions.rb b/actioncable/lib/action_cable/connection/subscriptions.rb index 6199db4898..65d6634bb0 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -58,9 +58,10 @@ module ActionCable subscriptions.each { |id, channel| channel.unsubscribe_from_channel } end + protected + attr_reader :connection, :subscriptions private - attr_reader :connection, :subscriptions delegate :logger, to: :connection def find(data) diff --git a/actioncable/lib/action_cable/connection/web_socket.rb b/actioncable/lib/action_cable/connection/web_socket.rb index 169b683b8c..670d5690ae 100644 --- a/actioncable/lib/action_cable/connection/web_socket.rb +++ b/actioncable/lib/action_cable/connection/web_socket.rb @@ -22,7 +22,7 @@ module ActionCable websocket.send data end - private + protected attr_reader :websocket end end diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 5e4e01abbf..1424ded04c 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -45,7 +45,7 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase connection = TestConnection.new connection.expects(:pubsub).returns EM::Hiredis.connect.pubsub - channel = ChatChannel.new connection, "{id: 1}", { id: 1 } + ChatChannel.new connection, "{id: 1}", { id: 1 } assert_nil connection.last_transmission EM::Timer.new(0.1) do diff --git a/actioncable/test/connection/cross_site_forgery_test.rb b/actioncable/test/connection/cross_site_forgery_test.rb index ede3057e30..d445e08f2a 100644 --- a/actioncable/test/connection/cross_site_forgery_test.rb +++ b/actioncable/test/connection/cross_site_forgery_test.rb @@ -57,7 +57,7 @@ class ActionCable::Connection::CrossSiteForgeryTest < ActionCable::TestCase private def assert_origin_allowed(origin) response = connect_with_origin origin - assert_equal -1, response[0] + assert_equal(-1, response[0]) end def assert_origin_not_allowed(origin) |