Skip to content

Commit

Permalink
fix: reset vtable_start and vtable_size of PrepareConf/Req (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzssangglass committed Sep 10, 2021
1 parent df69b2e commit 62d3a57
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -31,6 +31,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -51,6 +52,15 @@ public void handle(A6Request request, A6Response response) {
Req req = ((A6ConfigRequest) request).getReq();
long token = ((A6ConfigResponse) response).getConfToken();
PluginFilterChain chain = createFilterChain(req);
ByteBuffer bb = req.getByteBuffer();

/**
* to reset vtable_start and vtable_size of req,
* so that req can be reused after being got from the cache.
* {@link org.apache.apisix.plugin.runner.handler.A6HttpCallHandler#handle cache.getIfPresent()}
* @see <a href="Issues63"> https://github.com/apache/apisix-java-plugin-runner/issues/63</a>
* */
req.__init(bb.getInt(bb.position()) + bb.position(), bb);
A6Conf config = new A6Conf(req, chain);
cache.put(token, config);
}
Expand Down

0 comments on commit 62d3a57

Please sign in to comment.