included the stop receiver function for the users

This commit is contained in:
Maliakal Dhanya
2014-05-23 14:50:11 +02:00
parent af89269c0c
commit 567501c6f7
6 changed files with 64 additions and 33 deletions

View File

@@ -105,7 +105,7 @@ void slsReceiverUDPFunctions::deleteMembers(){
receiverdata[i] = NULL;
}
}
if(udpSocket) {delete udpSocket; udpSocket = NULL;}
shutDownUDPSocket();
if(eth) {delete [] eth; eth = NULL;}
if(latestData) {delete [] latestData; latestData = NULL;}
if(guiFileName) {delete [] guiFileName; guiFileName = NULL;}
@@ -802,14 +802,11 @@ void slsReceiverUDPFunctions::copyFrameToGui(char* startbuf){
int slsReceiverUDPFunctions::createUDPSocket(){
if(udpSocket)
udpSocket->ShutDownSocket();
//if eth is mistaken with ip address
if (strchr(eth,'.')!=NULL)
strcpy(eth,"");
if(udpSocket){delete udpSocket; udpSocket = NULL;}
shutDownUDPSocket();
//if no eth, listen to all
if(!strlen(eth)){
@@ -838,6 +835,22 @@ int slsReceiverUDPFunctions::createUDPSocket(){
int slsReceiverUDPFunctions::shutDownUDPSocket(){
if(udpSocket){
udpSocket->ShutDownSocket();
delete udpSocket;
udpSocket = NULL;
}
return OK;
}
int slsReceiverUDPFunctions::createListeningThreads(bool destroy){
void* status;
@@ -1224,8 +1237,7 @@ int slsReceiverUDPFunctions::startReceiver(char message[]){
if(setupWriter() == FAIL){
//stop udp socket
if(udpSocket)
udpSocket->ShutDownSocket();
shutDownUDPSocket();
sprintf(message,"Could not create file %s.\n",savefilename);
return FAIL;
@@ -1312,11 +1324,7 @@ void slsReceiverUDPFunctions::startReadout(){
cout << "Status: Transmitting" << endl;
//kill udp socket to tell the listening thread to push last packet
if(udpSocket){
udpSocket->ShutDownSocket();
delete udpSocket;
udpSocket = NULL;
}
shutDownUDPSocket();
}