Added entire matched peer list to output
This commit is contained in:
parent
60081acdfd
commit
606a4723a6
|
@ -126,11 +126,13 @@ type IndividualTestKeys struct {
|
|||
// Number of DHT bootsrap nodes
|
||||
BootstrapNum int `json:"bootstrap_num"`
|
||||
// Number of DHT peers contacted
|
||||
PeersTried uint32 `json:"peers_tried"`
|
||||
PeersTriedNum uint32 `json:"peers_tried_num"`
|
||||
// Number of DHT peers who answered
|
||||
PeersResponded uint32 `json:"peers_responded"`
|
||||
PeersRespondedNum uint32 `json:"peers_responded_num"`
|
||||
// Number of DHT peers found for specific requested infohash
|
||||
InfohashPeers int `json:"infohash_peers"`
|
||||
InfohashPeersNum int `json:"infohash_peers_num"`
|
||||
// Actual DHT peers found for requested infohash
|
||||
InfohashPeers []string `json:"infohash_peers"`
|
||||
// Individual failure aborting the test run for this address/port combo
|
||||
Failure string `json:"failure"`
|
||||
}
|
||||
|
@ -220,19 +222,20 @@ func TestDHTServer(dht *dht.Server, infohash [20]byte, bootstrap_nodes []string,
|
|||
counter := 0
|
||||
for entry := range announce.Peers {
|
||||
counter += 1
|
||||
itk.InfohashPeers = append(itk.InfohashPeers, entry.NodeInfo.Addr.String())
|
||||
itk.logger.Debugf("peer %d: %s", counter, entry.NodeInfo.Addr)
|
||||
}
|
||||
|
||||
stats := announce.TraversalStats()
|
||||
itk.PeersTried = stats.NumAddrsTried
|
||||
itk.PeersResponded = stats.NumResponses
|
||||
itk.InfohashPeers = counter
|
||||
itk.PeersTriedNum = stats.NumAddrsTried
|
||||
itk.PeersRespondedNum = stats.NumResponses
|
||||
itk.InfohashPeersNum = counter
|
||||
|
||||
if itk.PeersResponded == 0 {
|
||||
if itk.PeersRespondedNum == 0 {
|
||||
itk.error(errors.New("No DHT peers were found"))
|
||||
return false
|
||||
} else {
|
||||
itk.logger.Infof("Tried %d peers obtained from %d bootstrap nodes. Got response from %d. %d have requested infohash.", itk.PeersTried, itk.BootstrapNum, itk.PeersResponded, itk.InfohashPeers)
|
||||
itk.logger.Infof("Tried %d peers obtained from %d bootstrap nodes. Got response from %d. %d have requested infohash.", itk.PeersTriedNum, itk.BootstrapNum, itk.PeersRespondedNum, itk.InfohashPeersNum)
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
|
@ -105,7 +105,7 @@ func TestMeasurer_run(t *testing.T) {
|
|||
t.Fatal("Expected only one bootstrap node")
|
||||
}
|
||||
|
||||
if run.PeersResponded != 1 {
|
||||
if run.PeersRespondedNum != 1 {
|
||||
t.Fatal("Expected bootstrap node to respond")
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user