client: Handle orphaned Operations

Allow Operation instances to outlive
the Context through which they were
created.
This commit is contained in:
Michael Davidsaver
2020-07-27 11:41:07 -07:00
parent 5f421ce46b
commit 33b6f362db
11 changed files with 88 additions and 13 deletions
+14
View File
@@ -174,6 +174,19 @@ struct Tester : public TesterBase
testOk1(!done.wait(2.1));
}
void orphan()
{
testShow()<<__func__;
auto op = cli.put("nonexistent")
.set("value", "foo")
.exec();
// clear Context to orphan in-progress operation
cli = client::Context();
op.reset();
}
};
struct TestPutBuilder : public TesterBase
@@ -326,6 +339,7 @@ MAIN(testput)
Tester().lazy();
Tester().timeout();
Tester().cancel();
Tester().orphan();
TestPutBuilder().testSet();
testRO();
testError();