0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::server: Minor cleanup; branch expect; assertions.

This commit is contained in:
Jason Volk 2019-09-12 16:53:53 -07:00
parent 1bba6f12a6
commit 605c7dd37c

View file

@ -1994,7 +1994,7 @@ ircd::server::link::handle_writable_success()
continue;
}
if(tag.canceled() && tag.committed() && tag_committed() <= 1)
if(unlikely(tag.canceled() && tag.committed() && tag_committed() <= 1))
{
log::debug
{
@ -2189,19 +2189,22 @@ bool
ircd::server::link::process_read(const_buffer &overrun)
try
{
assert(peer);
assert(!queue.empty());
auto &tag
{
queue.front()
};
if(!tag.committed())
if(unlikely(!tag.committed()))
{
discard_read(); // Should stumble on a socket error.
assert(empty(overrun)); // Tag hasn't sent its data yet, we shouldn't
return false;
}
if(tag.canceled() && tag_committed() <= 1)
if(unlikely(tag.canceled() && tag_committed() <= 1))
{
log::debug
{
@ -2221,18 +2224,17 @@ try
}
while(!done && !empty(overrun));
if(!done)
if(likely(!done))
{
// This branch represents a read of -EAGAIN.
assert(empty(overrun));
return false;
return done;
}
assert(peer);
peer->handle_tag_done(*this, tag);
assert(!queue.empty());
queue.pop_front();
return true;
return done;
}
catch(const buffer_overrun &e)
{