Skip to content

Commit b416250

Browse files
committed
Clear stop_iteration_ flag non-status-returning callbacks.
Signed-off-by: mathetake <takeshi@tetrate.io>
1 parent 376ffaf commit b416250

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

include/proxy-wasm/context.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ class ContextBase : public RootInterface,
377377

378378
protected:
379379
friend class WasmBase;
380+
friend class DeferAfterCallActions;
380381

381382
void initializeRootBase(WasmBase *wasm, std::shared_ptr<PluginBase> plugin);
382383
std::string makeRootLogPrefix(std::string_view vm_id) const;
@@ -402,11 +403,12 @@ class ContextBase : public RootInterface,
402403

403404
class DeferAfterCallActions {
404405
public:
405-
DeferAfterCallActions(ContextBase *context) : wasm_(context->wasm()) {}
406+
DeferAfterCallActions(ContextBase *context) : context_(context) {}
406407
~DeferAfterCallActions();
407408

409+
protected:
408410
private:
409-
WasmBase *const wasm_;
411+
ContextBase *const context_;
410412
};
411413

412414
uint32_t resolveQueueForTest(std::string_view vm_id, std::string_view queue_name);

src/context.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ SharedData global_shared_data;
225225

226226
} // namespace
227227

228-
DeferAfterCallActions::~DeferAfterCallActions() { wasm_->doAfterVmCallActions(); }
228+
DeferAfterCallActions::~DeferAfterCallActions() {
229+
context_->stop_iteration_ = false;
230+
context_->wasm()->doAfterVmCallActions();
231+
}
229232

230233
WasmResult BufferBase::copyTo(WasmBase *wasm, size_t start, size_t length, uint64_t ptr_ptr,
231234
uint64_t size_ptr) const {

0 commit comments

Comments
 (0)