|
|
|
@ -68,55 +68,45 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func trackChunks(testData []byte) error { |
|
|
|
|
log.Warn("Test timed out; running chunk debug sequence") |
|
|
|
|
log.Warn("Test timed out, running chunk debug sequence") |
|
|
|
|
|
|
|
|
|
addrs, err := getAllRefs(testData) |
|
|
|
|
if err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
log.Trace("All references retrieved") |
|
|
|
|
|
|
|
|
|
for i, ref := range addrs { |
|
|
|
|
log.Trace(fmt.Sprintf("ref %d", i), "ref", ref) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// has-chunks
|
|
|
|
|
for _, host := range hosts { |
|
|
|
|
httpHost := fmt.Sprintf("ws://%s:%d", host, 8546) |
|
|
|
|
log.Trace("Calling `Has` on host", "httpHost", httpHost) |
|
|
|
|
|
|
|
|
|
hostChunks := []string{} |
|
|
|
|
|
|
|
|
|
rpcClient, err := rpc.Dial(httpHost) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Trace("Error dialing host", "err", err) |
|
|
|
|
log.Error("Error dialing host", "err", err) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
log.Trace("rpc dial ok") |
|
|
|
|
|
|
|
|
|
var hasInfo []api.HasInfo |
|
|
|
|
err = rpcClient.Call(&hasInfo, "bzz_has", addrs) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Trace("Error calling host", "err", err) |
|
|
|
|
log.Error("Error calling host", "err", err) |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
log.Trace("rpc call ok") |
|
|
|
|
count := 0 |
|
|
|
|
for i, info := range hasInfo { |
|
|
|
|
if i == 0 { |
|
|
|
|
log.Trace("first hasInfo", "addr", info.Addr, "host", host, "i", i) |
|
|
|
|
} |
|
|
|
|
if i == len(hasInfo)-1 { |
|
|
|
|
log.Trace("last hasInfo", "addr", info.Addr, "host", host, "i", i) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
count := 0 |
|
|
|
|
for _, info := range hasInfo { |
|
|
|
|
if info.Has { |
|
|
|
|
hostChunks = append(hostChunks, "1") |
|
|
|
|
} else { |
|
|
|
|
hostChunks = append(hostChunks, "0") |
|
|
|
|
count++ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if count == 0 { |
|
|
|
|
log.Info("host reported to have all chunks", "host", host) |
|
|
|
|
} |
|
|
|
|