Comparison

plugins/disco.lua @ 172:1a32e9ae79d0

plugins.disco: Fix disco_local_services() to call callback with empty array in case of disco error
author Matthew Wild <mwild1@gmail.com>
date Thu, 30 Dec 2010 20:19:47 +0000
parent 167:a2ae7a9d360f
child 175:4d2a5d02fdfa
comparison
equal deleted inserted replaced
171:741f5311d30c 172:1a32e9ae79d0
158 return results; 158 return results;
159 end 159 end
160 160
161 function stream:disco_local_services(callback) 161 function stream:disco_local_services(callback)
162 self:disco_items(self.host, nil, function (items) 162 self:disco_items(self.host, nil, function (items)
163 if not items then
164 return callback({});
165 end
163 local n_items = 0; 166 local n_items = 0;
164 local function item_callback() 167 local function item_callback()
165 n_items = n_items - 1; 168 n_items = n_items - 1;
166 if n_items == 0 then 169 if n_items == 0 then
167 return callback(items); 170 return callback(items);