0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::server: Adjust discard error expectations.

This commit is contained in:
Jason Volk 2018-04-06 01:53:50 -07:00
parent c4b18438ce
commit 5648903998

View file

@ -1610,9 +1610,12 @@ ircd::server::link::discard_read()
SSL_pending(socket->ssl.native_handle())
};
if(discard <= 0)
if(discard <= 0 && queue.empty())
discard = available(*socket);
if(discard <= 0 && !queue.empty())
discard = 1;
const size_t discarded
{
discard_any(*socket, size_t(discard))
@ -1632,7 +1635,7 @@ ircd::server::link::discard_read()
// just in case so this doesn't get loopy with discarding zero with
// an empty queue...
if(unlikely(!discard || !discarded))
if(unlikely(!discard && !discarded))
throw assertive
{
"peer(%p) link(%p) socket(%p) queue is empty and nothing to discard.",