diff --git a/src/serverintrospect.cpp b/src/serverintrospect.cpp index 0915eba..6699e10 100644 --- a/src/serverintrospect.cpp +++ b/src/serverintrospect.cpp @@ -101,8 +101,7 @@ struct ServerIntrospectControl : public server::ConnectOp return; serv->acceptor_loop.call([this, &fn](){ if(auto oper = op.lock()) - if(auto chan = oper->chan.lock()) - chan->onClose = std::move(fn); + oper->onClose = std::move(fn); }); } diff --git a/test/testinfo.cpp b/test/testinfo.cpp index 4472291..bd0c503 100644 --- a/test/testinfo.cpp +++ b/test/testinfo.cpp @@ -3,6 +3,9 @@ * pvxs is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ + +#include + #include #include @@ -73,19 +76,29 @@ struct Tester { { testShow()<<__func__; - mbox.onFirstConnect([this](){ + std::atomic onFC{false}, onLD{false}; + + mbox.onFirstConnect([this, &onFC](){ testShow()<<__func__; mbox.open(initial); + onFC.store(true); }); - mbox.onLastDisconnect([this](){ + mbox.onLastDisconnect([this, &onLD](){ testShow()<<__func__; mbox.close(); + onLD.store(true); }); serv.start(); testWait(); + + serv.stop(); + + testOk1(!mbox.isOpen()); + testOk1(!!onFC.load()); + testOk1(!!onLD.load()); } void timeout() @@ -187,7 +200,7 @@ void testError() MAIN(testinfo) { - testPlan(8); + testPlan(11); logger_config_env(); Tester().loopback(); Tester().lazy();