| 190 | } |
| 191 | |
| 192 | void pong(const UPID& from, const string& body) |
| 193 | { |
| 194 | ++responses; |
| 195 | |
| 196 | if (responses == totalRequests) { |
| 197 | duration->set(watch.elapsed()); |
| 198 | duration.reset(); |
| 199 | } else if (requests < totalRequests) { |
| 200 | send(server, "ping", message.c_str(), message.size()); |
| 201 | ++requests; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | // The address of the ponger (server). |
| 206 | UPID server; |