diff --git a/slsReceiverSoftware/include/genericSocket.h b/slsReceiverSoftware/include/genericSocket.h index a798a0fef..bbe119439 100644 --- a/slsReceiverSoftware/include/genericSocket.h +++ b/slsReceiverSoftware/include/genericSocket.h @@ -103,7 +103,6 @@ enum communicationProtocol{ nsent(0), total_sent(0)// sender (client): where to? ip { - // strcpy(hostname,host_ip_or_name); struct hostent *hostInfo = gethostbyname(host_ip_or_name); if (hostInfo == NULL){ diff --git a/slsReceiverSoftware/src/UDPBaseImplementation.cpp b/slsReceiverSoftware/src/UDPBaseImplementation.cpp index 1c6b1a976..7641a5a1e 100644 --- a/slsReceiverSoftware/src/UDPBaseImplementation.cpp +++ b/slsReceiverSoftware/src/UDPBaseImplementation.cpp @@ -1328,8 +1328,8 @@ int UDPBaseImplementation::startListening(){ FILE_LOG(logDEBUG) << __AT__ << " s thread_started = 1; - int i,total; - int lastpacketoffset, expected, rc, rc1,packetcount, maxBufferSize, carryonBufferSize; + int total; + int lastpacketoffset, expected, rc,packetcount, maxBufferSize, carryonBufferSize; uint32_t lastframeheader;// for moench to check for all the packets in last frame char* tempchar = NULL; int imageheader = 0; @@ -1534,9 +1534,8 @@ int UDPBaseImplementation::startWriting(){ FILE_LOG(logDEBUG) << __AT__ << " sta char* wbuf[numListeningThreads];//interleaved char *d=new char[bufferSize*numListeningThreads]; int xmax=0,ymax=0; - int ret,i,j; + int ret,i; int packetsPerThread = packetsPerFrame/numListeningThreads; -int loop; while(1){ diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 16b9de1f4..a2ddd6e39 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -67,7 +67,6 @@ UDPStandardImplementation::UDPStandardImplementation() rawDataReadyCallBack = NULL; pRawDataReady = NULL; - initializeMembers(); //mutex pthread_mutex_init(&dataReadyMutex,NULL); @@ -75,6 +74,8 @@ UDPStandardImplementation::UDPStandardImplementation() pthread_mutex_init(&progress_mutex,NULL); pthread_mutex_init(&write_mutex,NULL); + initializeMembers(); + //to increase socket receiver buffer size and max length of input queue by changing kernel settings if(system("echo $((100*1024*1024)) > /proc/sys/net/core/rmem_max")) cout << "\nWARNING: Could not change socket receiver buffer size in file /proc/sys/net/core/rmem_max" << endl; @@ -1567,8 +1568,8 @@ int UDPStandardImplementation::startListening(){ thread_started = 1; - int i,total; - int lastpacketoffset, expected, rc, rc1,packetcount, maxBufferSize, carryonBufferSize; + int total; + int lastpacketoffset, expected, rc,packetcount, maxBufferSize, carryonBufferSize; uint32_t lastframeheader;// for moench to check for all the packets in last frame char* tempchar = NULL; int imageheader = 0; @@ -1750,6 +1751,8 @@ int UDPStandardImplementation::startListening(){ if(tempchar) {delete [] tempchar;tempchar = NULL;} pthread_exit(NULL); } + + if(tempchar) {delete [] tempchar;tempchar = NULL;} } return OK; @@ -1782,9 +1785,8 @@ int UDPStandardImplementation::startWriting(){ char* wbuf[numListeningThreads];//interleaved char *d=new char[bufferSize*numListeningThreads]; int xmax=0,ymax=0; - int ret,i,j; + int ret,i; int packetsPerThread = packetsPerFrame/numListeningThreads; -int loop; while(1){ @@ -1792,17 +1794,17 @@ int loop; nf = 0; packetsPerThread = packetsPerFrame/numListeningThreads; if(myDetectorType == MOENCH){ - xmax = MOENCH_PIXELS_IN_ONE_ROW-1; - ymax = MOENCH_PIXELS_IN_ONE_ROW-1; - }else{ - if(shortFrame == -1){ + xmax = MOENCH_PIXELS_IN_ONE_ROW-1; + ymax = MOENCH_PIXELS_IN_ONE_ROW-1; + }else{ + if(shortFrame == -1){ xmax = GOTTHARD_PIXELS_IN_ROW-1; ymax = GOTTHARD_PIXELS_IN_COL-1; - }else{ - xmax = GOTTHARD_SHORT_PIXELS_IN_ROW-1; - ymax = GOTTHARD_SHORT_PIXELS_IN_COL-1; - } + }else{ + xmax = GOTTHARD_SHORT_PIXELS_IN_ROW-1; + ymax = GOTTHARD_SHORT_PIXELS_IN_COL-1; } + } @@ -1880,7 +1882,7 @@ int loop; for(i=0;ipush(wbuf[i])); #ifdef VERYDEBUG - cout << ithread << ":" << i+j << " fifo freed:" << (void*)wbuf[i] << endl; + cout << ithread << ":" << i << " fifo freed:" << (void*)wbuf[i] << endl; #endif } @@ -1888,10 +1890,12 @@ int loop; } else{ //copy to gui - copyFrameToGui(NULL,-1,wbuf[0]+HEADER_SIZE_NUM_TOT_PACKETS); + if((packetsPerFrame * numpackets) == bufferSize){ + copyFrameToGui(NULL,-1,wbuf[0]+HEADER_SIZE_NUM_TOT_PACKETS); #ifdef VERYVERBOSE - cout << ithread << " finished copying" << endl; + cout << ithread << " finished copying" << endl; #endif + }//else cout << "unfinished buffersize" << endl; while(!fifoFree[0]->push(wbuf[0])); #ifdef VERYVERBOSE cout<<"buf freed:"<<(void*)wbuf[0]<push(buffer[ithread]); - else if(rc > 0){cout<< ithread << " last rc:"< 0){ pc = (rc/onePacketSize); #ifdef VERYDEBUG + cout << ithread << " last rc:"<stop(); } + delete user; cout << "Goodbye!" << endl; return 0; } diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 20c95a051..b1fe40aca 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -26,7 +26,8 @@ using namespace std; slsReceiverTCPIPInterface::~slsReceiverTCPIPInterface() { - if(socket) delete socket; + if(socket) {delete socket; socket=NULL;} + if(receiverBase) {delete receiverBase; receiverBase=NULL;} closeFile(0); } @@ -1221,8 +1222,8 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){ } //all adc else{ - //ignore if half frame is missing - if ((bindex != 0xFFFFFFFF) && (bindex2 != 0xFFFFFFFF)){ + /*//ignore if half frame is missing + if ((bindex != 0xFFFFFFFF) && (bindex2 != 0xFFFFFFFF)){*/ //should be same frame if (index == index2){ @@ -1239,11 +1240,11 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){ } }else cout << "different frames caught. frame1:"<< hex << index << ":"<