X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FClientSocketHandle.ct;h=33ef74be651e00d8f8c307c2d35696bc242e69d7;hb=a4911c1fd3f53dc2a7bda6c1d2b00bdc4b864cff;hp=0c6b61b86a710820e3410dbca00cb5552ee3a88d;hpb=032707d24b1059febe83ce56b11fd79df106c6e2;p=senf.git diff --git a/Socket/ClientSocketHandle.ct b/Socket/ClientSocketHandle.ct index 0c6b61b..33ef74b 100644 --- a/Socket/ClientSocketHandle.ct +++ b/Socket/ClientSocketHandle.ct @@ -20,7 +20,9 @@ // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// Definition of non-inline template functions +/** \file + \brief ClientSocketHandle non-inline template implementation + */ //#include "ClientSocketHandle.ih" @@ -98,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; }