included mismatched indices error shouldnt return fail, but client should try to read again

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@375 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-12-13 08:33:22 +00:00
parent f74ea5191d
commit 9c6886d030
3 changed files with 18 additions and 15 deletions

View File

@ -391,15 +391,13 @@ void* postProcessing::processData(int delflag) {
bool newData=false; bool newData=false;
char currentfName[MAX_STR_LENGTH]; char currentfName[MAX_STR_LENGTH];
int currentfIndex=0; int currentfIndex=0;
while(1){cout<<"\t"<<flush;
while(1){
if (checkJoinThread()) break; if (checkJoinThread()) break;
usleep(200000); usleep(200000);
pthread_mutex_lock(&mg); pthread_mutex_lock(&mg);
caught=getCurrentFrameIndex(); caught=getCurrentFrameIndex();
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);
incrementProgress(caught-prevCaught); incrementProgress(caught-prevCaught);
if(caught-prevCaught) newData=true; if(caught-prevCaught) newData=true;
else newData=false; else newData=false;
@ -414,16 +412,22 @@ void* postProcessing::processData(int delflag) {
cout<<"****Detector returned NULL***"<<endl; cout<<"****Detector returned NULL***"<<endl;
return 0; return 0;
} }
fdata=decodeData(receiverData);
delete [] receiverData; if(currentfIndex>=0){
if(fdata){ fdata=decodeData(receiverData);
if (dataReady) { delete [] receiverData;
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels()); if(fdata){
dataReady(thisData, currentfIndex, pCallbackArg); if (dataReady) {
delete thisData; thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
fdata=NULL; dataReady(thisData, currentfIndex, pCallbackArg);
delete thisData;
fdata=NULL;
}
} }
} }
else{
cout<<"****Detector returned mismatched indeices***"<<endl;
}
} }
} }
} }

View File

@ -328,7 +328,7 @@ int slsReceiverFunctionList::startWriting(){
//start writing //start writing
sfilefd = fopen((const char *) (actualfilename), "w"); sfilefd = fopen((const char *) (actualfilename), "w");
cout << "Saving to " << actualfilename << ". Ready! " << endl; cout << "Ready! " << endl << "Saving to " << actualfilename << endl;
while(listening_thread_running){ while(listening_thread_running){

View File

@ -679,7 +679,6 @@ int slsReceiverFuncs::read_frame(){
//got atleast first frame, read buffer //got atleast first frame, read buffer
if(ret==OK){ if(ret==OK){
ret=FAIL;
while(count<20){ while(count<20){
//get frame //get frame
raw=slsReceiverList->readFrame(fName); raw=slsReceiverList->readFrame(fName);
@ -696,7 +695,6 @@ int slsReceiverFuncs::read_frame(){
if(index%2){ if(index%2){
memcpy(retval,((char*) origVal)+2, onedatasize); memcpy(retval,((char*) origVal)+2, onedatasize);
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+8+onedatasize, onedatasize); memcpy((((char*)retval)+onedatasize), ((char*) origVal)+8+onedatasize, onedatasize);
ret=OK;
break; break;
} }
@ -705,7 +703,6 @@ int slsReceiverFuncs::read_frame(){
memcpy((((char*)retval)+onedatasize),((char*) origVal)+2, onedatasize); memcpy((((char*)retval)+onedatasize),((char*) origVal)+2, onedatasize);
memcpy(retval, ((char*) origVal)+8+onedatasize, onedatasize); memcpy(retval, ((char*) origVal)+8+onedatasize, onedatasize);
index=index2; index=index2;
ret=OK;
break; break;
} }
@ -718,6 +715,8 @@ int slsReceiverFuncs::read_frame(){
if(count==20){ if(count==20){
cout << "same type: index:" << index << "\tindex2:" << index2 << endl; cout << "same type: index:" << index << "\tindex2:" << index2 << endl;
/**send garbage with -1 index to try again*/ /**send garbage with -1 index to try again*/
memcpy(retval,((char*) origVal)+2, onedatasize);
memcpy((((char*)retval)+onedatasize), ((char*) origVal)+8+onedatasize, onedatasize);
} }
arg=((index - startIndex)/2)-1; arg=((index - startIndex)/2)-1;