made updatereceiver to actually update client in parameters that it can

This commit is contained in:
Dhanya Maliakal
2017-07-03 17:37:31 +02:00
parent 26f9b1ccbd
commit 460a44a9b1
9 changed files with 42 additions and 34 deletions

View File

@ -59,7 +59,7 @@ void HDF5File::PrintMembers() {
} else if (datatype == PredType::STD_U32LE) {
FILE_LOG(logINFO) << "Data Type: 32";
} else {
FILE_LOG(logERROR) << BG_RED,"unknown data type";
FILE_LOG(logERROR) << "unknown data type";
}
}

View File

@ -275,7 +275,7 @@ void Listener::ThreadExecution() {
//error check, (should not be here) if not transmitting yet (previous if) rc should be > 0
if (rc <= 0) {
//bprintf(BG_RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n");
//cprintf(RED,"Error:(Weird Early self shut down), UDP Sockets not shut down, but received nothing\n");
StopListening(buffer);
return;
}
@ -343,7 +343,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
//------------------------------------------------------------------------------------------------------------
if (fnum != currentFrameIndex) {
if (fnum < currentFrameIndex) {
bprintf(BG_RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex);
bprintf(RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex);
return 0;
}
new_header->packetNumber = numpackets;

View File

@ -203,9 +203,9 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
}
if (DataStreamer::GetErrorMask() || error) {
if (DataStreamer::GetErrorMask())
bprintf(BG_RED,"Error: Could not create data callback threads\n");
bprintf(RED,"Error: Could not create data callback threads\n");
else
bprintf(BG_RED,"Error: Could not create zmq sockets\n");
bprintf(RED,"Error: Could not create zmq sockets\n");
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
delete(*it);
dataStreamer.clear();
@ -731,7 +731,7 @@ int UDPStandardImplementation::SetupFifoStructure() {
(generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize),
fifoDepth, success));
if (!success) {
bprintf(BG_RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
bprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i);
for (vector<Fifo*>::const_iterator it = fifo.begin(); it != fifo.end(); ++it)
delete(*it);
fifo.clear();

View File

@ -510,6 +510,7 @@ int slsReceiverTCPIPInterface::lock_receiver() {
int slsReceiverTCPIPInterface::get_last_client_ip() {
ret = OK;
if (mySock->differentClients)
ret = FORCE_UPDATE;
@ -602,7 +603,8 @@ int slsReceiverTCPIPInterface::update_client() {
// send answer
mySock->SendDataOnly(&ret,sizeof(ret));
if (ret == FAIL){
//fail and force_update
if (ret != OK){
mySock->SendDataOnly(mess,sizeof(mess));
// return ok/fail
return ret;
@ -622,7 +624,7 @@ int slsReceiverTCPIPInterface::send_update() {
mySock->SendDataOnly(mySock->lastClientIP,sizeof(mySock->lastClientIP));
//filepath
// filepath
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
path = receiverBase->getFilePath();
#endif
@ -633,7 +635,7 @@ int slsReceiverTCPIPInterface::send_update() {
delete[] path;
}
//filename
// filename
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
path = receiverBase->getFileName();
#endif
@ -644,27 +646,29 @@ int slsReceiverTCPIPInterface::send_update() {
delete[] path;
}
//index
// index
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=receiverBase->getFileIndex();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
//file format
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=(int)receiverBase->getFileFormat();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
// file path
// file name
// file index
// file format
// file write enable
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=(int)receiverBase->getFileWriteEnable();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
// file overwrite enable
// activate
// fifo depth
// data stream enable
// receiver read frequency
// receiver read timer
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
ind=(int)receiverBase->getOverwriteEnable();
#endif
mySock->SendDataOnly(&ind,sizeof(ind));
if (!lockStatus)
strcpy(mySock->lastClientIP,mySock->thisClientIP);
@ -747,6 +751,10 @@ int slsReceiverTCPIPInterface::set_detector_type(){
}
}
#endif
// client has started updating receiver, update ip
if (!lockStatus)
strcpy(mySock->lastClientIP,mySock->thisClientIP);
if (ret == OK && mySock->differentClients)
ret = FORCE_UPDATE;