123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/rmpd/command.rb', line 123
def execute(connection, *args, &block)
tries = 0
@list = List.new
yield @list
begin
connection.synchronize do
connection.send_command("command_list_ok_begin")
@list.map do |command_w_args|
connection.send_command(*command_w_args)
end
connection.send_command("command_list_end")
handle_command_list_ok_response(connection.read_response)
end
rescue MpdDisconnectedError => e
tries += 1
if tries < 5
puts "CommandListOkStrategy MpdDisconnectedError received, retrying" if $DEBUG
connect
retry
else
puts "CommandListOkStrategy retries exceeded" if $DEBUG
raise e
end
end
end
|