From d793f72010849ccbef1c8221e9651295c21573f0 Mon Sep 17 00:00:00 2001 From: dan98765 <3498629+dan98765@users.noreply.github.com> Date: Mon, 15 Jun 2026 15:57:50 -0700 Subject: [PATCH] fix: add parentheses to is_a? call in SSEClient#close Without explicit parentheses, Ruby parses the condition as: @socket.is_a?(OpenSSL::SSL::SSLSocket && @config.debug_enabled) Since SSLSocket is truthy, && returns the right operand (a boolean), and is_a?(true/false) raises TypeError: class or module required. This fires on every SSE socket close and is caught by the rescue StandardError block, producing error-level log entries. Fixes #623. --- lib/splitclient-rb/sse/event_source/client.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/splitclient-rb/sse/event_source/client.rb b/lib/splitclient-rb/sse/event_source/client.rb index 5190ad6e..a0deec8c 100644 --- a/lib/splitclient-rb/sse/event_source/client.rb +++ b/lib/splitclient-rb/sse/event_source/client.rb @@ -47,7 +47,7 @@ def close(status = nil) @connected.make_false @socket.sync_close = true if @socket.is_a? OpenSSL::SSL::SSLSocket @socket.close - @config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a? OpenSSL::SSL::SSLSocket && @config.debug_enabled + @config.logger.debug("SSEClient socket state #{@socket.state}") if @socket.is_a?(OpenSSL::SSL::SSLSocket) && @config.debug_enabled rescue StandardError => e @config.logger.error("SSEClient close Error: #{e.inspect}") end