X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FClientSocketHandle.ct;h=9379c7c6a2f14365068cdd4d897e83e4399a8dd4;hb=aec1302f91b51edb58f8a97985ab2e0aa9c8db66;hp=3f5112fc173914fa047b8400f79630d8c0079239;hpb=ac88c68bb3aebad5f7d91ce44f1c845d973f9613;p=senf.git diff --git a/Socket/ClientSocketHandle.ct b/Socket/ClientSocketHandle.ct index 3f5112f..9379c7c 100644 --- a/Socket/ClientSocketHandle.ct +++ b/Socket/ClientSocketHandle.ct @@ -100,8 +100,14 @@ prefix_ unsigned senf::ClientSocketHandle::available() { unsigned nread = this->protocol().available(); if (nread == 0 && this->blocking()) { - this->waitReadable(); - nread = this->protocol().available(); + // We have to block explicitly here so we can return the + // number of bytes available explicitly. If no more date can + // be expected to arive (i.e. the other end has closed the + // connection), the socket will always be in the readable + // state. This is the only case when available() will return + // 0. + this->waitReadable(); + nread = this->protocol().available(); } return nread; }