Skip to content

Commit 1b5f69c

Browse files
authored
Move onLog to ContextBase since it can be called on a Root Context. (#55)
Signed-off-by: John Plevyak <[email protected]>
1 parent 6cdb4a7 commit 1b5f69c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

proxy_wasm_api.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ class ContextBase {
285285

286286
virtual void onCreate() {}
287287
virtual bool onDoneBase() = 0;
288+
// Called on Stream Context after onDone when logging is requested or called on Root Context
289+
// if so requested.
290+
virtual void onLog() {}
288291
// Called to indicate that no more calls will come and this context is being
289292
// deleted.
290293
virtual void onDelete() {} // Called when the stream or VM is being deleted.
@@ -476,7 +479,6 @@ class Context : public ContextBase {
476479
return FilterTrailersStatus::Continue;
477480
}
478481
virtual void onDone() {} // Called when the stream has completed.
479-
virtual void onLog() {} // Called after onDone when logging is requested.
480482

481483
private:
482484
// For stream Contexts, onDone always returns true.

proxy_wasm_intrinsics.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ extern "C" PROXY_WASM_KEEPALIVE uint32_t proxy_on_done(uint32_t context_id) {
227227
}
228228

229229
extern "C" PROXY_WASM_KEEPALIVE void proxy_on_log(uint32_t context_id) {
230-
getContext(context_id)->onLog();
230+
getContextBase(context_id)->onLog();
231231
}
232232

233233
extern "C" PROXY_WASM_KEEPALIVE void proxy_on_delete(uint32_t context_id) {

0 commit comments

Comments
 (0)