@@ -118,7 +118,8 @@ func pingPeer(ctx context.Context, n *core.IpfsNode, pid peer.ID, numPings int)
118
118
if len (n .Peerstore .Addrs (pid )) == 0 {
119
119
// Make sure we can find the node in question
120
120
outChan <- & PingResult {
121
- Text : fmt .Sprintf ("Looking up peer %s" , pid .Pretty ()),
121
+ Text : fmt .Sprintf ("Looking up peer %s" , pid .Pretty ()),
122
+ Success : true ,
122
123
}
123
124
124
125
ctx , cancel := context .WithTimeout (ctx , kPingTimeout )
@@ -131,14 +132,18 @@ func pingPeer(ctx context.Context, n *core.IpfsNode, pid peer.ID, numPings int)
131
132
n .Peerstore .AddAddrs (p .ID , p .Addrs , pstore .TempAddrTTL )
132
133
}
133
134
134
- outChan <- & PingResult {Text : fmt .Sprintf ("PING %s." , pid .Pretty ())}
135
+ outChan <- & PingResult {
136
+ Text : fmt .Sprintf ("PING %s." , pid .Pretty ()),
137
+ Success : true ,
138
+ }
135
139
136
140
ctx , cancel := context .WithTimeout (ctx , kPingTimeout * time .Duration (numPings ))
137
141
defer cancel ()
138
142
pings , err := n .Ping .Ping (ctx , pid )
139
143
if err != nil {
140
144
log .Debugf ("Ping error: %s" , err )
141
- outChan <- & PingResult {Text : fmt .Sprintf ("Ping error: %s" , err )}
145
+ outChan <- & PingResult {
146
+ Text : fmt .Sprintf ("Ping error: %s" , err )}
142
147
return
143
148
}
144
149
@@ -165,7 +170,8 @@ func pingPeer(ctx context.Context, n *core.IpfsNode, pid peer.ID, numPings int)
165
170
}
166
171
averagems := total .Seconds () * 1000 / float64 (numPings )
167
172
outChan <- & PingResult {
168
- Text : fmt .Sprintf ("Average latency: %.2fms" , averagems ),
173
+ Success : true ,
174
+ Text : fmt .Sprintf ("Average latency: %.2fms" , averagems ),
169
175
}
170
176
}()
171
177
return outChan
0 commit comments