shukitchan commented on code in PR #9483:
URL: https://github.com/apache/trafficserver/pull/9483#discussion_r1142567120


##########
plugins/experimental/wasm/wasm_main.cc:
##########
@@ -181,11 +189,21 @@ http_event_handler(TSCont contp, TSEvent event, void 
*data)
   case TS_EVENT_HTTP_READ_CACHE_HDR:
     break;
 
-  case TS_EVENT_HTTP_TXN_CLOSE:
+  case TS_EVENT_HTTP_TXN_CLOSE: {
     context->onDone();
     context->onDelete();
 
-    if (context->wasm() == wasm_config->wasm.get()) {
+    bool found = false;
+    for (auto it = wasm_config->configs.begin(); it != 
wasm_config->configs.end(); it++) {
+      std::shared_ptr<ats_wasm::Wasm> wbp = it->first;
+      if (wbp.get() == context->wasm()) {
+        found = true;
+      }
+
+      break;

Review Comment:
   fixed



##########
plugins/experimental/wasm/wasm_main.cc:
##########
@@ -60,23 +59,32 @@ schedule_handler(TSCont contp, TSEvent /*event*/, void * 
/*data*/)
 
   c->onTick(0); // use 0 as  token
 
-  if (!wasm_config->wasm) {
-    TSError("[wasm][%s] Configuration object is null", __FUNCTION__);
+  if (wasm_config->configs.empty()) {
+    TSError("[wasm][%s] Configuration objects are empty", __FUNCTION__);
     TSMutexUnlock(old_wasm->mutex());
     return 0;
   }
 
-  if (c->wasm() == wasm_config->wasm.get()) {
-    auto *wasm               = static_cast<ats_wasm::Wasm *>(c->wasm());
-    uint32_t root_context_id = c->id();
-    if (wasm->existsTimerPeriod(root_context_id)) {
-      TSDebug(WASM_DEBUG_TAG, "[%s] reschedule continuation", __FUNCTION__);
-      std::chrono::milliseconds period = wasm->getTimerPeriod(root_context_id);
-      TSContScheduleOnPool(contp, static_cast<TSHRTime>(period.count()), 
TS_THREAD_POOL_NET);
-    } else {
-      TSDebug(WASM_DEBUG_TAG, "[%s] can't find period for root context id: 
%d", __FUNCTION__, root_context_id);
+  bool found = false;
+  for (auto it = wasm_config->configs.begin(); it != 
wasm_config->configs.end(); it++) {
+    std::shared_ptr<ats_wasm::Wasm> wbp = it->first;
+    if (wbp.get() == old_wasm) {
+      found                    = true;
+      auto *wasm               = static_cast<ats_wasm::Wasm *>(c->wasm());
+      uint32_t root_context_id = c->id();
+      if (wasm->existsTimerPeriod(root_context_id)) {
+        TSDebug(WASM_DEBUG_TAG, "[%s] reschedule continuation", __FUNCTION__);
+        std::chrono::milliseconds period = 
wasm->getTimerPeriod(root_context_id);
+        TSContScheduleOnPool(contp, static_cast<TSHRTime>(period.count()), 
TS_THREAD_POOL_NET);
+      } else {
+        TSDebug(WASM_DEBUG_TAG, "[%s] can't find period for root context id: 
%d", __FUNCTION__, root_context_id);
+      }
     }
-  } else {
+
+    break;

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to