diff --git a/slsReceiverSoftware/include/genericSocket.h b/slsReceiverSoftware/include/genericSocket.h index 1ceb7203b..b4a5cb712 100644 --- a/slsReceiverSoftware/include/genericSocket.h +++ b/slsReceiverSoftware/include/genericSocket.h @@ -446,6 +446,7 @@ enum communicationProtocol{ close(file_des); } else { + while(!shutdown(socketDescriptor, SHUT_RDWR)); close(socketDescriptor); socketDescriptor=-1; } diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 9d2b70db9..1f726bb7e 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -1408,12 +1408,14 @@ void UDPStandardImplementation::setThreadPriorities(){ break; } } - for(int i = 0; i < numberofDataCallbackThreads; ++i){ - if(rights) - if (pthread_setschedparam(dataCallbackThreads[i], SCHED_RR, &datacallback_param) == EPERM){ - rights = false; - break; - } + if(dataStreamEnable){ + for(int i = 0; i < numberofDataCallbackThreads; ++i){ + if(rights) + if (pthread_setschedparam(dataCallbackThreads[i], SCHED_RR, &datacallback_param) == EPERM){ + rights = false; + break; + } + } } if (pthread_setschedparam(pthread_self(),5 , &tcp_param) == EPERM) rights = false; @@ -1534,12 +1536,6 @@ int UDPStandardImplementation::setupWriter(){ int UDPStandardImplementation::createNewFile(int ithread){ FILE_LOG(logDEBUG) << __AT__ << " called"; - int index = 0; - if(totalWritingPacketCount[ithread]){ - index = frameIndex[ithread]; - cout << "\nThread " << ithread << "\tFile:" << completeFileName[ithread] < acquisitionIndex) - acquisitionIndex = currentFrameNumber[ithread] - startAcquisitionIndex; - if((currentFrameNumber[ithread] - startFrameIndex) > frameIndex[ithread]) - frameIndex[ithread] = currentFrameNumber[ithread] - startFrameIndex; - pthread_mutex_unlock(&progressMutex); //callback to write data if (cbAction < DO_EVERYTHING) - rawDataReadyCallBack((int)currentFrameNumber[ithread], wbuffer + fifoBufferHeaderSize, npackets * onePacketSize, + rawDataReadyCallBack((int)tempframenumber, wbuffer + fifoBufferHeaderSize, npackets * onePacketSize, sfilefd[ithread], latestData[ithread],pRawDataReady);//know which thread from sfilefd @@ -2891,7 +2879,7 @@ void UDPStandardImplementation::writeFileWithoutCompression(int ithread, char* w packetsCaught += packetsWritten; totalPacketsCaught += packetsWritten; pthread_mutex_unlock(&writeMutex); - currentFrameNumber[ithread] += lastFrameNumberInFile[ithread]; + currentFrameNumber[ithread] = lastFrameNumberInFile[ithread]; } } }