Merged to developer

This commit is contained in:
2017-06-13 15:30:33 +02:00
98 changed files with 8027 additions and 19952 deletions

View File

@ -308,7 +308,7 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int ret = receiveDataOnly(file_des, buf, length);
#ifndef PCCOMPILE
#ifdef EIGERD
swapData(buf, length, itype);
if (ret >= 0) swapData(buf, length, itype);
#endif
#endif
return ret;
@ -316,9 +316,9 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int sendDataOnly(int file_des, void* buf,int length) {
return write(file_des, buf, length);
int ret = write(file_des, buf, length); //value of -1 is other end socket crash as sigpipe is ignored
if (ret < 0) cprintf(BG_RED, "Error writing to socket. Possible socket crash\n");
return ret;
}
@ -328,37 +328,32 @@ int receiveData(int file_des, void* buf,int length, intType itype){
int nreceiving;
int nreceived;
if (file_des<0) return -1;
<<<<<<< HEAD
#ifdef VERY_VERBOSE
printf("want to receive %d Bytes\n", length);
#endif
=======
#ifdef VERY_VERBOSE
printf("want to receive %d Bytes\n", length);
#endif
>>>>>>> e564542ad33a64e66ad6153066741c69c707f99d
while(length>0){
while(length > 0) {
nreceiving = (length>send_rec_max_size) ? send_rec_max_size:length;
//#ifdef VERY_VERBOSE
// printf("want to receive %d Bytes\n", nreceiving);
//#endif
nreceived = read(file_des,(char*)buf+total_received,nreceiving);
//#ifdef VERY_VERBOSE
// printf("read %d \n", nreceived);
//#endif
if(!nreceived) break;
// if(nreceived<0) break;
if(!nreceived){
if(!total_received) {
return -1; //to handle it
}
break;
}
length-=nreceived;
total_received+=nreceived;
// cout<<"nrec: "<<nreceived<<" waiting for ("<<length<<")"<<endl;
}
//#ifdef VERY_VERBOSE
// printf("received %d Bytes\n", total_received);
//#endif
if (total_received>0)
strcpy(thisClientIP,dummyClientIP);
//if (strcmp(lastClientIP,"none")==0)
//strcpy(lastClientIP,thisClientIP);
if (strcmp(lastClientIP,thisClientIP))
differentClients=1;
else