Skip to content
Permalink
Browse files
fix: reset vtable_start and vtable_size of PrepareConf/Req (#66)
  • Loading branch information
tzssangglass committed Sep 10, 2021
1 parent df69b2e commit 62d3a575754e5035e30e33d469ef52f794791e9d
Showing 1 changed file with 10 additions and 0 deletions.
@@ -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;
@@ -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);
}

0 comments on commit 62d3a57

Please sign in to comment.