diff --git a/actioncable/lib/action_cable/channel/base.rb b/actioncable/lib/action_cable/channel/base.rb index ca903a810dd9965ec18eba779f176be588046691..f3085840ca481ea25df8527c627ca123bc63ccc4 100644 --- a/actioncable/lib/action_cable/channel/base.rb +++ b/actioncable/lib/action_cable/channel/base.rb @@ -137,6 +137,9 @@ def initialize(connection, identifier, params = {}) # 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 7e9eec75087c8a6c2ed6a814a2aaa8d938ecb8b9..f7b18a85ae0c6148128fe62c58ebb194113ba15c 100644 --- a/actioncable/lib/action_cable/connection/base.rb +++ b/actioncable/lib/action_cable/connection/base.rb @@ -62,6 +62,7 @@ def initialize(server, env) @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 @@ def cookies 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 25cff75b41d03e6627349ccc9986ff75299b5a2d..2f65a1e84a5246456d577f006b9753d65306dc57 100644 --- a/actioncable/lib/action_cable/connection/message_buffer.rb +++ b/actioncable/lib/action_cable/connection/message_buffer.rb @@ -29,10 +29,11 @@ def process! 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 6199db48981eaea99972dbff511ddcfc7bbfe707..65d6634bb00beb5f405d2b0d9fa709d15cac339c 100644 --- a/actioncable/lib/action_cable/connection/subscriptions.rb +++ b/actioncable/lib/action_cable/connection/subscriptions.rb @@ -58,9 +58,10 @@ def unsubscribe_from_all 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 169b683b8cb8c6b3f7c65c7e6bc475fbc05c7af5..670d5690aecf14d17af8115bbfb40e5f8d847011 100644 --- a/actioncable/lib/action_cable/connection/web_socket.rb +++ b/actioncable/lib/action_cable/connection/web_socket.rb @@ -22,7 +22,7 @@ def transmit(data) 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 5e4e01abbff122698c660fd871ad2d71bc69af0f..1424ded04cd173621169ee702764e9298a8fe3c5 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -45,7 +45,7 @@ def send_confirmation 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 ede3057e3065259a79feac0b55d64908896afcab..d445e08f2a7d6d3be7033f3377f2f593fa3bd74d 100644 --- a/actioncable/test/connection/cross_site_forgery_test.rb +++ b/actioncable/test/connection/cross_site_forgery_test.rb @@ -57,7 +57,7 @@ def send_async(method, *args) 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)