mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +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 */
|
/** thread for TCP server */
|
||||||
pthread_t TCPServer_thread;
|
pthread_t TCPServer_thread;
|
||||||
|
|
||||||
|
/** tcp thread created flag*/
|
||||||
|
bool tcpThreadCreated;
|
||||||
|
|
||||||
/** port number */
|
/** port number */
|
||||||
int portNumber;
|
int portNumber;
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success==OK){
|
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);
|
tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface*
|
|||||||
fnum(-1),
|
fnum(-1),
|
||||||
lockStatus(0),
|
lockStatus(0),
|
||||||
killTCPServerThread(0),
|
killTCPServerThread(0),
|
||||||
|
tcpThreadCreated(false),
|
||||||
portNumber(DEFAULT_PORTNO+2),
|
portNumber(DEFAULT_PORTNO+2),
|
||||||
mySock(NULL)
|
mySock(NULL)
|
||||||
{
|
{
|
||||||
@ -134,6 +135,7 @@ int slsReceiverTCPIPInterface::start(){
|
|||||||
FILE_LOG(logERROR) << "Could not create TCP Server thread";
|
FILE_LOG(logERROR) << "Could not create TCP Server thread";
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
tcpThreadCreated = true;
|
||||||
//#ifdef VERYVERBOSE
|
//#ifdef VERYVERBOSE
|
||||||
FILE_LOG(logDEBUG) << "TCP Server thread created successfully.";
|
FILE_LOG(logDEBUG) << "TCP Server thread created successfully.";
|
||||||
//#endif
|
//#endif
|
||||||
@ -142,13 +144,16 @@ int slsReceiverTCPIPInterface::start(){
|
|||||||
|
|
||||||
|
|
||||||
void slsReceiverTCPIPInterface::stop(){
|
void slsReceiverTCPIPInterface::stop(){
|
||||||
FILE_LOG(logINFO) << "Shutting down TCP Socket";
|
if (tcpThreadCreated) {
|
||||||
killTCPServerThread = 1;
|
FILE_LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber;
|
||||||
if(mySock) mySock->ShutDownSocket();
|
killTCPServerThread = 1;
|
||||||
FILE_LOG(logDEBUG) << "TCP Socket closed";
|
if(mySock) mySock->ShutDownSocket();
|
||||||
pthread_join(TCPServer_thread, NULL);
|
FILE_LOG(logDEBUG) << "TCP Socket closed on port " << portNumber;
|
||||||
killTCPServerThread = 0;
|
pthread_join(TCPServer_thread, NULL);
|
||||||
FILE_LOG(logINFO) << "TCP Server Thread closed";
|
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(){
|
void slsReceiverTCPIPInterface::startTCPServer(){
|
||||||
cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid));
|
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
|
#ifdef VERYVERBOSE
|
||||||
FILE_LOG(logDEBUG5) << "Starting Receiver TCP Server";
|
FILE_LOG(logDEBUG5) << "Starting Receiver TCP Server";
|
||||||
|
Reference in New Issue
Block a user