Skip to content

Commit 7afb39d

Browse files
authored
Do not auto-close a GrpcStream. (#58)
Signed-off-by: John Plevyak <jplevyak@gmail.com>
1 parent 7470993 commit 7afb39d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎proxy_wasm_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ class GrpcCallHandlerBase {
201201
RootContext *context() { return context_; }
202202

203203
void cancel();
204+
uint32_t token() { return token_; }
204205

205206
virtual void onSuccess(size_t body_size) = 0;
206207
virtual void onFailure(GrpcStatus status) = 0;
@@ -233,6 +234,7 @@ class GrpcStreamHandlerBase {
233234
void close(); // NB: callbacks can still occur: reset() to prevent further
234235
// callbacks.
235236
void reset();
237+
uint32_t token() { return token_; }
236238

237239
virtual void onReceiveInitialMetadata(uint32_t /* headers */) {}
238240
virtual void onReceiveTrailingMetadata(uint32_t /* trailers */) {}
@@ -1483,7 +1485,6 @@ inline void RootContext::onGrpcReceive(uint32_t token, size_t body_size) {
14831485
auto it = grpc_streams_.find(token);
14841486
if (it != grpc_streams_.end()) {
14851487
it->second->onReceive(body_size);
1486-
grpc_streams_.erase(token);
14871488
return;
14881489
}
14891490
}

0 commit comments

Comments
 (0)