Redo PR #2259 because I messed up my local git (#2263)

This commit is contained in:
Jeroen88 2019-01-02 16:44:17 +01:00 committed by Me No Dev
parent 229d9b7366
commit 00e69a28bc

View File

@ -58,6 +58,11 @@ private:
{
if(!_buffer){
_buffer = (uint8_t *)malloc(_size);
if(!_buffer) {
log_e("Not enough memory to allocate buffer");
_failed = true;
return 0;
}
}
if(_fill && _pos == _fill){
_fill = 0;
@ -67,8 +72,10 @@ private:
return 0;
}
int res = recv(_fd, _buffer + _fill, _size - _fill, MSG_DONTWAIT);
if(res < 0 && errno != EWOULDBLOCK) {
if(res < 0) {
if(errno != EWOULDBLOCK) {
_failed = true;
}
return 0;
}
_fill += res;