mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Listener bug fix: switching to make_unique ptr side effects, the dummy socket still alive when destructor of listener called
This commit is contained in:
@ -247,35 +247,24 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(uint64_t s) {
|
|||||||
memset(eth, 0, MAX_STR_LENGTH);
|
memset(eth, 0, MAX_STR_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
// shutdown if any open
|
|
||||||
if(udpSocket){
|
|
||||||
udpSocket->ShutDownSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
//create dummy socket
|
//create dummy socket
|
||||||
try {
|
try {
|
||||||
udpSocket = sls::make_unique<genericSocket>(*udpPortNumber, genericSocket::UDP,
|
genericSocket g(*udpPortNumber, genericSocket::UDP,
|
||||||
generalData->packetSize, (strlen(eth)?eth:nullptr), generalData->headerPacketSize,
|
generalData->packetSize, (strlen(eth)?eth:nullptr), generalData->headerPacketSize,
|
||||||
*udpSocketBufferSize);
|
*udpSocketBufferSize);
|
||||||
|
|
||||||
|
// doubled due to kernel bookkeeping (could also be less due to permissions)
|
||||||
|
*actualUDPSocketBufferSize = g.getActualUDPSocketBufferSize();
|
||||||
|
if (*actualUDPSocketBufferSize != (s*2)) {
|
||||||
|
*udpSocketBufferSize = temp;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
FILE_LOG(logERROR) << "Could not create a test UDP socket on port " << *udpPortNumber;
|
FILE_LOG(logERROR) << "Could not create a test UDP socket on port " << *udpPortNumber;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// doubled due to kernel bookkeeping (could also be less due to permissions)
|
|
||||||
*actualUDPSocketBufferSize = udpSocket->getActualUDPSocketBufferSize();
|
|
||||||
if (*actualUDPSocketBufferSize != (s*2)) {
|
|
||||||
*udpSocketBufferSize = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// shutdown socket
|
|
||||||
if(udpSocket){
|
|
||||||
udpSocketAlive = false;
|
|
||||||
udpSocket->ShutDownSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user