- if (h->cl)
- return h->cl;
- rpcc *cl = new rpcc(h->m);
- LOG("trying to bind..." << h->m);
- // The test script assumes that the failure can be detected by paxos and
- // rsm layer within few seconds. We have to set the timeout with a small
- // value to support the assumption.
- //
- // With RPC_LOSSY=5, tests may fail due to delays and time outs.
- int ret = cl->bind(milliseconds(1000));
- if (ret < 0) {
- LOG("bind failure! " << h->m << " " << ret);
- delete cl;
- h->del = true;
- } else {
- LOG("bind succeeded " << h->m);
- h->cl = cl;
+ if (!h->client) {
+ unique_ptr<rpcc> client(new rpcc(h->destination));
+ LOG("trying to bind..." << h->destination);
+ // The test script assumes that the failure can be detected by paxos and
+ // rsm layer within few seconds. We have to set the timeout with a small
+ // value to support the assumption.
+ //
+ // With RPC_LOSSY=5, tests may fail due to delays and time outs.
+ int ret = client->bind(milliseconds(1000));
+ if (ret < 0) {
+ LOG("bind failure! " << h->destination << " " << ret);
+ h->valid = false;
+ } else {
+ LOG("bind succeeded " << h->destination);
+ h->client = move(client);
+ }