Having this early check means that we somewhat randomly get different
exception behaviours on errors in deeper layers as some exceptions are
allowed to propagate unhindered and some are not (since they are thrown
in the pull function).
{
int n;
- if (gnutls_record_check_pending(session) == 0) {
- if (!in->hasData(1))
- return 0;
- }
-
n = gnutls_record_recv(session, (void *) buf, len);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0) throw TLSException("readTLS", n);
+ if (n == 0)
+ throw EndOfStream();
+
return n;
}