diff --git a/lib/ruby-mpd.rb b/lib/ruby-mpd.rb index 0c6b546..5ae8908 100644 --- a/lib/ruby-mpd.rb +++ b/lib/ruby-mpd.rb @@ -253,9 +253,10 @@ def callback_thread # @return [true] If "OK" is returned. # @raise [MPDError] If an "ACK" is returned. def handle_server_response + sock = socket # Cache to prevent an extra method call for every response line msg = '' while true - case line = socket.gets + case line = sock.gets when "OK\n", nil break when /^ACK/