Skip to content

Commit

Permalink
Slightly improve performance when hundreds of lines are received
Browse files Browse the repository at this point in the history
  • Loading branch information
Phrogz committed Feb 21, 2016
1 parent 364e609 commit b01adf4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/ruby-mpd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit b01adf4

Please sign in to comment.