Fix rx arping socket bind (#646)

* first tries with a process intead of thread for rx_arping

* Moving delete pointer of udp socket to stopReciever,so rx_arping can only be set when udp socket is closed

* refactoring and formatting

* unused variable processId

* ignore sigchild to prevent zombie from child processes being killed
This commit is contained in:
Dhanya Thattil
2023-02-03 17:18:09 +01:00
committed by GitHub
parent e172df79f3
commit ebb6f53b21
9 changed files with 75 additions and 52 deletions

View File

@ -351,19 +351,19 @@ std::array<pid_t, NUM_RX_THREAD_IDS> Implementation::getThreadIds() const {
retval[id++] = 0;
}
}
retval[NUM_RX_THREAD_IDS - 1] = arping.GetThreadId();
retval[NUM_RX_THREAD_IDS - 1] = arping.GetProcessId();
return retval;
}
bool Implementation::getArping() const { return arping.IsRunning(); }
pid_t Implementation::getArpingThreadId() const { return arping.GetThreadId(); }
pid_t Implementation::getArpingProcessId() const { return arping.GetProcessId(); }
void Implementation::setArping(const bool i,
const std::vector<std::string> ips) {
if (i != arping.IsRunning()) {
if (!i) {
arping.StopThread();
arping.StopProcess();
} else {
// setup interface
for (int i = 0; i != generalData->numUDPInterfaces; ++i) {
@ -374,7 +374,7 @@ void Implementation::setArping(const bool i,
}
arping.SetInterfacesAndIps(i, eth[i], ips[i]);
}
arping.StartThread();
arping.StartProcess();
}
}
}
@ -713,6 +713,10 @@ void Implementation::stopReceiver() {
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
// delete the udp sockets
for (const auto &it : listener)
it->DeleteUDPSocket();
if (fileWriteEnable && modulePos == 0) {
// master and virtual file (hdf5)
StartMasterWriter();