Improvements for BOA

- Allowed write buffers to become very large in asynnet. Thus in order to allow for the transfer
  of large images. tested ub to 2kx2k, 16MB
- Handle lack of space in the write buffer more gracefully: just skip the image
This commit is contained in:
2014-08-27 16:24:39 +02:00
parent 9e898d1476
commit 8f704ebab9
5 changed files with 116 additions and 4 deletions

View File

@ -1178,6 +1178,8 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
SCWrite(self, "ERROR: no data to write in SCWriteZiped", eError);
return 0;
}
pBuf = malloc(iDataLen*sizeof(char));
memset(pBuf,0,iDataLen*sizeof(char));
@ -1204,6 +1206,19 @@ int SCWriteZipped(SConnection * self, char *pName, void *pData,
}
compressedLength = compStream.total_out;
/*
If data is large, test if we can do it
*/
if(compressedLength > 2*1000*1024) {
if(!ANETcanWrite(self->sockHandle,pData,compressedLength)){
SCWrite(self,"WARNING: skipping excessive data in SCWriteZipped",eLogError);
deflateEnd(&compStream);
free(pBuf);
return 0;
}
}
/* write header line */
memset(outBuf, 0, 65536);
@ -1270,6 +1285,16 @@ int SCWriteBinary(SConnection * self, char *pName, void *pData,
return 0;
}
/*
If data is large, test if we can do it
*/
if(iDataLen > 2*1000*1024) {
if(!ANETcanWrite(self->sockHandle,pData,iDataLen)){
SCWrite(self,"WARNING: skipping excessive data in SCWriteBinary",eLogError);
return 0;
}
}
/* write header line */
memset(outBuf, 0, 65536);