client: Handle orphaned Operations

Allow Operation instances to outlive
the Context through which they were
created.
This commit is contained in:
Michael Davidsaver
2020-08-10 12:09:55 -07:00
parent 5f421ce46b
commit 33b6f362db
11 changed files with 88 additions and 13 deletions
+12
View File
@@ -149,6 +149,17 @@ struct Tester {
testOk1(!done.wait(2.1));
}
void orphan()
{
testShow()<<__func__;
auto op = cli.info("nonexistent").exec();
// clear Context to orphan in-progress operation
cli = client::Context();
op.reset();
}
};
struct ErrorSource : public server::Source
@@ -213,6 +224,7 @@ MAIN(testinfo)
Tester().lazy();
Tester().timeout();
Tester().cancel();
Tester().orphan();
testError();
return testDone();
}