From 1d0ae3855af49099d36a66f5cba55f198c7b888c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 2 May 2018 12:33:08 -0700 Subject: [PATCH] ircd::server: Close link if the only commitment is a cancelled tag. --- ircd/server.cc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ircd/server.cc b/ircd/server.cc index 3f4d42434..346ffdce2 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -1351,6 +1351,17 @@ ircd::server::link::handle_writable_success() continue; } + if(tag.canceled() && tag.committed() && tag_committed() <= 1) + { + log.debug("link(%p) closing to interrupt canceled committed tag(%p) of %zu", + this, + &tag, + tag_count()); + + close(); + break; + } + if(tag_committed() == 0) wait_readable(); @@ -1423,7 +1434,7 @@ ircd::server::link::process_write_next(const const_buffer &buffer) void ircd::server::link::wait_readable() { - if(op_read || unlikely(op_fini)) + if(op_read || op_fini) return; auto handler @@ -1527,6 +1538,17 @@ try return false; } + if(tag.canceled() && tag_committed() <= 1) + { + log.debug("link(%p) closing to interrupt canceled committed tag(%p) of %zu", + this, + &tag, + tag_count()); + + close(); + return false; + } + bool done{false}; do { overrun = process_read_next(overrun, tag, done);