rendered paste bodybool ByteBuffer::PutToSocket(int socket) {
CHECK_READ_WRITE_SIZE_CURSORS;
bool result;
int32_t sent=send(socket, _pBuffer+_readCursor, _writeCursor-_readCursor, 0);
if(sent<=0) {
char *pTemp=strerror(errno);
DEBUG("Trying to send %d bytes", _writeCursor-_readCursor);
DEBUG("Unable to send data (retry %d): %s", _sendRetryCount, pTemp);
if(errno==EAGAIN){
_sendRetryCount++;
if(_sendRetryCount>MAX_SEND_RETRY_COUNT){
FATAL("MAX_SEND_RETRY_COUNT reached: %d", MAX_SEND_RETRY_COUNT);
return false;
}
else{
return true;
}
}
else{
return false;
}
}
else {
_sendRetryCount=0;
_readCursor+=sent;
result=true;
}
if(result)
Realloc(0);
CHECK_READ_WRITE_SIZE_CURSORS;
return result;
}