Handle connection closed/no data in Socket::Read().

This commit is contained in:
Bartosz Taudul 2017-09-13 23:26:18 +02:00
parent efd66bb609
commit 037a4d7fac

View File

@ -146,8 +146,17 @@ bool Socket::Read( void* _buf, int len, const timeval* tv, bool(*exitCb)() )
{ {
if( exitCb() ) return false; if( exitCb() ) return false;
const auto sz = Recv( buf, len, tv ); const auto sz = Recv( buf, len, tv );
len -= sz; switch( sz )
buf += sz; {
case 0:
return false;
case -1:
break;
default:
len -= sz;
buf += sz;
break;
}
} }
return true; return true;