Skip to content

Commit ea7268f

Browse files
committed
Clear stop_iteration_ flag non-status-returning callbacks.
Signed-off-by: mathetake <[email protected]>
1 parent 376ffaf commit ea7268f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/context.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,15 @@ FilterStatus ContextBase::onUpstreamData(uint32_t data_length, bool end_of_strea
458458

459459
void ContextBase::onDownstreamConnectionClose(CloseType close_type) {
460460
if (!isFailed() && wasm_->on_downstream_connection_close_) {
461+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
461462
DeferAfterCallActions actions(this);
462463
wasm_->on_downstream_connection_close_(this, id_, static_cast<uint32_t>(close_type));
463464
}
464465
}
465466

466467
void ContextBase::onUpstreamConnectionClose(CloseType close_type) {
467468
if (!isFailed() && wasm_->on_upstream_connection_close_) {
469+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
468470
DeferAfterCallActions actions(this);
469471
wasm_->on_upstream_connection_close_(this, id_, static_cast<uint32_t>(close_type));
470472
}
@@ -549,12 +551,14 @@ void ContextBase::onHttpCallResponse(uint32_t token, uint32_t headers, uint32_t
549551
if (isFailed() || !wasm_->on_http_call_response_) {
550552
return;
551553
}
554+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
552555
DeferAfterCallActions actions(this);
553556
wasm_->on_http_call_response_(this, id_, token, headers, body_size, trailers);
554557
}
555558

556559
void ContextBase::onQueueReady(uint32_t token) {
557560
if (!isFailed() && wasm_->on_queue_ready_) {
561+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
558562
DeferAfterCallActions actions(this);
559563
wasm_->on_queue_ready_(this, id_, token);
560564
}
@@ -564,6 +568,7 @@ void ContextBase::onGrpcReceiveInitialMetadata(uint32_t token, uint32_t elements
564568
if (isFailed() || !wasm_->on_grpc_receive_initial_metadata_) {
565569
return;
566570
}
571+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
567572
DeferAfterCallActions actions(this);
568573
wasm_->on_grpc_receive_initial_metadata_(this, id_, token, elements);
569574
}
@@ -572,6 +577,7 @@ void ContextBase::onGrpcReceiveTrailingMetadata(uint32_t token, uint32_t trailer
572577
if (isFailed() || !wasm_->on_grpc_receive_trailing_metadata_) {
573578
return;
574579
}
580+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
575581
DeferAfterCallActions actions(this);
576582
wasm_->on_grpc_receive_trailing_metadata_(this, id_, token, trailers);
577583
}
@@ -580,6 +586,7 @@ void ContextBase::onGrpcReceive(uint32_t token, uint32_t response_size) {
580586
if (isFailed() || !wasm_->on_grpc_receive_) {
581587
return;
582588
}
589+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
583590
DeferAfterCallActions actions(this);
584591
wasm_->on_grpc_receive_(this, id_, token, response_size);
585592
}
@@ -588,12 +595,14 @@ void ContextBase::onGrpcClose(uint32_t token, uint32_t status_code) {
588595
if (isFailed() || !wasm_->on_grpc_close_) {
589596
return;
590597
}
598+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
591599
DeferAfterCallActions actions(this);
592600
wasm_->on_grpc_close_(this, id_, token, status_code);
593601
}
594602

595603
bool ContextBase::onDone() {
596604
if (!isFailed() && wasm_->on_done_) {
605+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
597606
DeferAfterCallActions actions(this);
598607
return wasm_->on_done_(this, id_).u64_ != 0;
599608
}
@@ -602,13 +611,15 @@ bool ContextBase::onDone() {
602611

603612
void ContextBase::onLog() {
604613
if (!isFailed() && wasm_->on_log_) {
614+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
605615
DeferAfterCallActions actions(this);
606616
wasm_->on_log_(this, id_);
607617
}
608618
}
609619

610620
void ContextBase::onDelete() {
611621
if (in_vm_context_created_ && !isFailed() && wasm_->on_delete_) {
622+
wasm_->addAfterVmCallAction([this]() { this->stop_iteration_ = false; });
612623
DeferAfterCallActions actions(this);
613624
wasm_->on_delete_(this, id_);
614625
}

0 commit comments

Comments
 (0)