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