diff --git a/slsReceiverSoftware/include/ZmqSocket.h b/slsReceiverSoftware/include/ZmqSocket.h index d63d5093b..7fdb51c51 100644 --- a/slsReceiverSoftware/include/ZmqSocket.h +++ b/slsReceiverSoftware/include/ZmqSocket.h @@ -10,6 +10,8 @@ #include "ansi.h" //#include "sls_receiver_defs.h" +//#define ZMQ_DETAIL + #include #include #include //gethostbyname() @@ -303,21 +305,23 @@ public: int len = ReceiveMessage(index, message); if ( len > 0 ) { bool dummy = false; -#ifdef VERBOSE - cprintf( BLUE,"Header %d Length: %d Header:%s \n", index, len, (char*) zmq_msg_data (&message) ); +#ifdef ZMQ_DETAIL + cprintf( BLUE,"Header %d [%d] Length: %d Header:%s \n", index, portno, len, (char*) zmq_msg_data (&message) ); #endif if ( ParseHeader (index, len, message, acqIndex, frameIndex, subframeIndex, filename, dummy)) { - zmq_msg_close (&message); -#ifdef VERBOSE - cprintf( RED,"Parsed Header %d Length: %d Header:%s \n", index, len, (char*) zmq_msg_data (&message) ); +#ifdef ZMQ_DETAIL + cprintf( RED,"Parsed Header %d [%d] Length: %d Header:%s \n", index, portno, len, (char*) zmq_msg_data (&message) ); #endif + zmq_msg_close (&message); if (dummy) { -#ifdef VERBOSE - cprintf(RED,"%d Received end of acquisition\n", index); +#ifdef ZMQ_DETAIL + cprintf(RED,"%d [%d] Received end of acquisition\n", index, portno ); #endif return 0; } - cprintf(GREEN,"%d data\n",index); +#ifdef ZMQ_DETAIL + cprintf(GREEN,"%d [%d] data\n",index, portno ); +#endif return 1; } } diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 0038656c3..b6d62e9c0 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -275,6 +275,9 @@ void DataProcessor::ThreadExecution() { //check dummy uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer)); +#ifdef VERBOSE + if (!index) cprintf(BLUE,"DataProcessor %d, Numbytes:%u\n", index,numBytes); +#endif if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -292,6 +295,10 @@ void DataProcessor::ThreadExecution() { void DataProcessor::StopProcessing(char* buf) { +#ifdef VERBOSE + if (!index) + cprintf(RED,"DataProcessing %d: Dummy\n", index); +#endif //stream or free if (*dataStreamEnable) fifo->PushAddressToStream(buf); @@ -318,7 +325,8 @@ void DataProcessor::ProcessAnImage(char* buf) { #ifdef VERBOSE - if (!index) cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum); + if (!index) + cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum); #endif if (!measurementStartedFlag) { diff --git a/slsReceiverSoftware/src/DataStreamer.cpp b/slsReceiverSoftware/src/DataStreamer.cpp index d6a9cd0d8..bd9eaa918 100644 --- a/slsReceiverSoftware/src/DataStreamer.cpp +++ b/slsReceiverSoftware/src/DataStreamer.cpp @@ -183,11 +183,14 @@ void DataStreamer::ThreadExecution() { char* buffer=0; fifo->PopAddressToStream(buffer); #ifdef FIFODEBUG - if (!index) cprintf(BLUE,"DataProcessor %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer); + if (!index) cprintf(BLUE,"DataStreamer %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer); #endif //check dummy uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer)); +#ifdef VERBOSE + cprintf(GREEN,"DataStreamer %d, Numbytes:%u\n", index,numBytes); +#endif if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -203,7 +206,10 @@ void DataStreamer::ThreadExecution() { void DataStreamer::StopProcessing(char* buf) { - +#ifdef VERBOSE + if (!index) + cprintf(RED,"DataStreamer %d: Dummy\n", index); +#endif sls_detector_header* header = (sls_detector_header*) (buf); //send dummy header and data if (!SendHeader(header, true)) @@ -222,7 +228,7 @@ void DataStreamer::ProcessAnImage(char* buf) { sls_detector_header* header = (sls_detector_header*) (buf); uint64_t fnum = header->frameNumber; #ifdef VERBOSE - if (!index) cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum); + cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum); #endif if (!measurementStartedFlag) { diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index d98c4a2c5..46f7b898c 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -251,7 +251,7 @@ void Listener::ThreadExecution() { //udpsocket doesnt exist if (*activated && !udpSocket) { - FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier"; + //FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier"; (*((uint32_t*)buffer)) = 0; StopListening(buffer); return; @@ -265,15 +265,16 @@ void Listener::ThreadExecution() { rc = CreateAnImage(buffer + generalData->fifoBufferHeaderSize); } - //done acquiring + + /*//done acquiring if ((*status == TRANSMITTING) || ( (!(*activated)) && (rc == 0)) ) { StopListening(buffer); return; - } + }*/ //error check, (should not be here) if not transmitting yet (previous if) rc should be > 0 if (rc <= 0) { - cprintf(BG_RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n"); + //cprintf(BG_RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n"); StopListening(buffer); return; } @@ -282,8 +283,10 @@ void Listener::ThreadExecution() { (*((uint64_t*)(buffer + FIFO_HEADER_NUMBYTES ))) = currentFrameIndex; //for those returning earlier currentFrameIndex++; + //push into fifo fifo->PushAddress(buffer); + } @@ -317,11 +320,10 @@ uint32_t Listener::ListenToAnImage(char* buf) { //reset to -1 memset(buf, 0, fifohsize); - memset(buf + fifohsize, 0xFF, dsize); + memset(buf + fifohsize, 0xFF, generalData->imageSize); new_header = (sls_detector_header*) (buf + FIFO_HEADER_NUMBYTES); - //look for carry over if (carryOverFlag) { cprintf(RED,"%d carry flag\n",index); @@ -422,6 +424,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { //------------------------------------------------------------------------------------------------------------ lastCaughtFrameIndex = fnum; + #ifdef VERBOSE //if (!index) cprintf(GREEN,"Listening %d: currentfindex:%lu, fnum:%lu, pnum:%u numpackets:%u\n",