server GET_FIELD fix onLastDisconnect

This commit is contained in:
Michael Davidsaver
2020-02-21 12:35:35 -08:00
parent 7d490dc69e
commit 5019744fa7
2 changed files with 17 additions and 5 deletions
+1 -2
View File
@@ -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);
});
}
+16 -3
View File
@@ -3,6 +3,9 @@
* pvxs is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <atomic>
#include <testMain.h>
#include <epicsUnitTest.h>
@@ -73,19 +76,29 @@ struct Tester {
{
testShow()<<__func__;
mbox.onFirstConnect([this](){
std::atomic<bool> 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();