From 840b3c4b0c390edae020676f831f7deadd051a90 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 28 Mar 2019 15:36:33 -0700 Subject: [PATCH] ircd::json::stack: Add method to check for pending eptr. --- include/ircd/json/stack.h | 1 + ircd/json.cc | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/ircd/json/stack.h b/include/ircd/json/stack.h index 7a368297b..5440ed094 100644 --- a/include/ircd/json/stack.h +++ b/include/ircd/json/stack.h @@ -68,6 +68,7 @@ struct ircd::json::stack public: bool opened() const; ///< Current stacking in progress. bool closed() const; ///< No stacking in progress. + bool failed() const; ///< Exception pending in eptr. bool clean() const; ///< Never opened. bool done() const; ///< Opened and closed. size_t remaining() const; diff --git a/ircd/json.cc b/ircd/json.cc index 67fd5ed8f..cc5dcf995 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -671,7 +671,7 @@ ircd::json::stack::append(const size_t &expect, const window_buffer::closure &closure) noexcept try { - if(unlikely(eptr)) + if(unlikely(failed())) return; if(expect > buf.remaining()) @@ -724,7 +724,7 @@ noexcept try if(!flusher) return false; - if(unlikely(eptr)) + if(unlikely(failed())) return false; if(!force && buf.consumed() < lowat) @@ -787,6 +787,13 @@ const return buf.remaining(); } +bool +ircd::json::stack::failed() +const +{ + return bool(eptr); +} + bool ircd::json::stack::done() const