bug fix for starting and stopping receiver, without listening

This commit is contained in:
maliakal_d 2018-12-03 10:45:46 +01:00
parent 228cfa35c0
commit 05d8ef6277

View File

@ -227,8 +227,10 @@ void Listener::ShutDownUDPSocket() {
udpSocket->ShutDownSocket();
FILE_LOG(logINFO) << "Shut down of UDP port " << *udpPortNumber;
fflush(stdout);
//delete socket at stoplistening
sem_wait(&semaphore_socket);
// wait only if the threads have started as it is the threads that
//give a post to semaphore(at stopListening)
if (runningFlag)
sem_wait(&semaphore_socket);
delete udpSocket;
udpSocket = 0;
sem_destroy(&semaphore_socket);