Simplify stream availability handling

Just have a simply number of bytes argument to avoid a lot of
complexity.
This commit is contained in:
Pierre Ossman
2020-05-19 21:07:05 +02:00
committed by Lauri Kasanen
parent 92c7695981
commit 57a3c3bba8
20 changed files with 67 additions and 132 deletions

View File

@@ -93,19 +93,12 @@ void TLSOutStream::flush()
out->flush();
}
size_t TLSOutStream::overrun(size_t itemSize, size_t nItems)
void TLSOutStream::overrun(size_t needed)
{
if (itemSize > bufSize)
throw Exception("TLSOutStream overrun: max itemSize exceeded");
if (needed > bufSize)
throw Exception("TLSOutStream overrun: buffer size exceeded");
flush();
size_t nAvail;
nAvail = avail() / itemSize;
if (nAvail < nItems)
return nAvail;
return nItems;
}
size_t TLSOutStream::writeTLS(const U8* data, size_t length)