shuaijinchao commented on a change in pull request #4835:
URL: https://github.com/apache/apisix/pull/4835#discussion_r690863417
##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -400,9 +442,26 @@ local rpc_handlers = {
return nil, "failed to send RPC_HTTP_REQ_CALL: " .. err
end
- local ty, resp = receive(sock)
- if ty == nil then
- return nil, "failed to receive RPC_HTTP_REQ_CALL: " .. resp
+ local ty, resp
+ while true do
+ ty, resp = receive(sock)
+ if ty == nil then
+ return nil, "failed to receive RPC_HTTP_REQ_CALL: " .. resp
+ end
+
+ if ty ~= constants.RPC_EXTRA_INFO then
+ break
+ end
+
+ local out, err = handle_extra_info(ctx, resp)
+ if not out then
+ return nil, "failed to handle RPC_EXTRA_INFO: " .. err
+ end
+
+ local ok, err = send(sock, constants.RPC_EXTRA_INFO, out)
+ if not ok then
+ return nil, "failed to reply RPC_EXTRA_INFO: " .. err
+ end
end
Review comment:
Can you explain the relationship between `RPC_EXTRA_INFO` and
`RPC_HTTP_REQ_CALL`? I don't understand too much. Why do I receive an
`RPC_EXTRA_INFO` response when I send an `RPC_HTTP_REQ_CALL` request? What is
his application scenario?
##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -400,9 +442,26 @@ local rpc_handlers = {
return nil, "failed to send RPC_HTTP_REQ_CALL: " .. err
end
- local ty, resp = receive(sock)
- if ty == nil then
- return nil, "failed to receive RPC_HTTP_REQ_CALL: " .. resp
+ local ty, resp
+ while true do
+ ty, resp = receive(sock)
+ if ty == nil then
+ return nil, "failed to receive RPC_HTTP_REQ_CALL: " .. resp
+ end
+
+ if ty ~= constants.RPC_EXTRA_INFO then
+ break
+ end
+
+ local out, err = handle_extra_info(ctx, resp)
+ if not out then
+ return nil, "failed to handle RPC_EXTRA_INFO: " .. err
+ end
+
+ local ok, err = send(sock, constants.RPC_EXTRA_INFO, out)
+ if not ok then
+ return nil, "failed to reply RPC_EXTRA_INFO: " .. err
+ end
end
Review comment:
OK, I see
--
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]