@@ -221,21 +221,27 @@ func (d *daemon) runCidCheck(ctx context.Context, cidKey cid.Cid, ipniURL string
221
221
wg .Add (1 )
222
222
go func (provider peer.AddrInfo , src string ) {
223
223
defer wg .Done ()
224
+
225
+ provOutput := providerOutput {
226
+ ID : provider .ID .String (),
227
+ Source : src ,
228
+ DataAvailableOverBitswap : BitswapCheckOutput {},
229
+ DataAvailableOverHTTP : HTTPCheckOutput {},
230
+ }
231
+
232
+ testHost , err := d .createTestHost ()
233
+ if err != nil {
234
+ log .Printf ("Error creating test host: %v\n " , err )
235
+ return
236
+ }
237
+ defer testHost .Close ()
238
+
224
239
// Get http retrieval out of the way if this is such
225
240
// provider.
226
241
httpInfo , libp2pInfo := network .SplitHTTPAddrs (provider )
227
242
if len (httpInfo .Addrs ) > 0 && httpRetrieval {
243
+ provOutput .DataAvailableOverHTTP .Enabled = true
228
244
229
- provOutput := providerOutput {
230
- ID : provider .ID .String (),
231
- DataAvailableOverBitswap : BitswapCheckOutput {
232
- Enabled : false ,
233
- },
234
- DataAvailableOverHTTP : HTTPCheckOutput {
235
- Enabled : true ,
236
- },
237
- Source : src ,
238
- }
239
245
for _ , ma := range httpInfo .Addrs {
240
246
provOutput .Addrs = append (provOutput .Addrs , ma .String ())
241
247
}
@@ -255,14 +261,15 @@ func (d *daemon) runCidCheck(ctx context.Context, cidKey cid.Cid, ipniURL string
255
261
provOutput .ConnectionMaddrs = append (provOutput .ConnectionMaddrs , ma .String ())
256
262
}
257
263
258
- mu .Lock ()
259
- out = append (out , provOutput )
260
- mu .Unlock ()
261
-
262
264
// Do not continue processing if there are no
263
265
// other addresses as we would trigger dht
264
266
// lookups etc.
265
267
if len (libp2pInfo .Addrs ) == 0 {
268
+ provOutput .DataAvailableOverBitswap .Enabled = false
269
+ mu .Lock ()
270
+ out = append (out , provOutput )
271
+ mu .Unlock ()
272
+
266
273
return
267
274
}
268
275
}
@@ -291,24 +298,8 @@ func (d *daemon) runCidCheck(ctx context.Context, cidKey cid.Cid, ipniURL string
291
298
}
292
299
}
293
300
294
- provOutput := providerOutput {
295
- ID : provider .ID .String (),
296
- Addrs : outputAddrs ,
297
- DataAvailableOverBitswap : BitswapCheckOutput {
298
- Enabled : true ,
299
- },
300
- DataAvailableOverHTTP : HTTPCheckOutput {
301
- Enabled : false ,
302
- },
303
- Source : src ,
304
- }
305
-
306
- testHost , err := d .createTestHost ()
307
- if err != nil {
308
- log .Printf ("Error creating test host: %v\n " , err )
309
- return
310
- }
311
- defer testHost .Close ()
301
+ provOutput .Addrs = append (provOutput .Addrs , outputAddrs ... )
302
+ provOutput .DataAvailableOverBitswap .Enabled = true
312
303
313
304
// Test Is the target connectable
314
305
dialCtx , dialCancel := context .WithTimeout (ctx , time .Second * 15 )
0 commit comments