mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
slsReceiver: deleting slsReceiverUsers object before calling start() gives seg fault
This commit is contained in:
@ -318,6 +318,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** thread for TCP server */
|
||||
pthread_t TCPServer_thread;
|
||||
|
||||
/** tcp thread created flag*/
|
||||
bool tcpThreadCreated;
|
||||
|
||||
/** port number */
|
||||
int portNumber;
|
||||
|
||||
|
@ -105,7 +105,6 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success):
|
||||
}
|
||||
|
||||
if (success==OK){
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << tcpip_port_no << endl;
|
||||
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no);
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface*
|
||||
fnum(-1),
|
||||
lockStatus(0),
|
||||
killTCPServerThread(0),
|
||||
tcpThreadCreated(false),
|
||||
portNumber(DEFAULT_PORTNO+2),
|
||||
mySock(NULL)
|
||||
{
|
||||
@ -134,6 +135,7 @@ int slsReceiverTCPIPInterface::start(){
|
||||
FILE_LOG(logERROR) << "Could not create TCP Server thread";
|
||||
return FAIL;
|
||||
}
|
||||
tcpThreadCreated = true;
|
||||
//#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG) << "TCP Server thread created successfully.";
|
||||
//#endif
|
||||
@ -142,13 +144,16 @@ int slsReceiverTCPIPInterface::start(){
|
||||
|
||||
|
||||
void slsReceiverTCPIPInterface::stop(){
|
||||
FILE_LOG(logINFO) << "Shutting down TCP Socket";
|
||||
killTCPServerThread = 1;
|
||||
if(mySock) mySock->ShutDownSocket();
|
||||
FILE_LOG(logDEBUG) << "TCP Socket closed";
|
||||
pthread_join(TCPServer_thread, NULL);
|
||||
killTCPServerThread = 0;
|
||||
FILE_LOG(logINFO) << "TCP Server Thread closed";
|
||||
if (tcpThreadCreated) {
|
||||
FILE_LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber;
|
||||
killTCPServerThread = 1;
|
||||
if(mySock) mySock->ShutDownSocket();
|
||||
FILE_LOG(logDEBUG) << "TCP Socket closed on port " << portNumber;
|
||||
pthread_join(TCPServer_thread, NULL);
|
||||
tcpThreadCreated = false;
|
||||
killTCPServerThread = 0;
|
||||
FILE_LOG(logDEBUG) << "Exiting TCP Server Thread on port " << portNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -193,6 +198,7 @@ void* slsReceiverTCPIPInterface::startTCPServerThread(void *this_pointer){
|
||||
|
||||
void slsReceiverTCPIPInterface::startTCPServer(){
|
||||
cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
||||
FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << endl;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG5) << "Starting Receiver TCP Server";
|
||||
|
Reference in New Issue
Block a user