You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2021/06/02 13:31:34 UTC

[apisix-java-plugin-runner] branch main updated: feat: use netty's own unpacking decoder (#26)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
     new 99cea32  feat: use netty's own unpacking decoder (#26)
99cea32 is described below

commit 99cea325562a62d2842ee6df62c8aac9355d7468
Author: tzssangglass <tz...@gmail.com>
AuthorDate: Wed Jun 2 21:31:25 2021 +0800

    feat: use netty's own unpacking decoder (#26)
---
 .../apisix/plugin/runner/codec/DelayedDecoder.java      | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/runner-core/src/main/java/org/apache/apisix/plugin/runner/codec/DelayedDecoder.java b/runner-core/src/main/java/org/apache/apisix/plugin/runner/codec/DelayedDecoder.java
index c950390..df883fa 100644
--- a/runner-core/src/main/java/org/apache/apisix/plugin/runner/codec/DelayedDecoder.java
+++ b/runner-core/src/main/java/org/apache/apisix/plugin/runner/codec/DelayedDecoder.java
@@ -17,26 +17,11 @@
 
 package org.apache.apisix.plugin.runner.codec;
 
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
 
 public class DelayedDecoder extends LengthFieldBasedFrameDecoder {
 
     public DelayedDecoder() {
-        super(16777215, 0, 0);
-    }
-
-    @Override
-    protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) {
-        in.readByte();
-        int length = in.readMedium();
-        if (in.readableBytes() < length) {
-            return null;
-        }
-        in.readerIndex(0);
-
-        int readLength = in.readableBytes();
-        return in.retainedSlice(0, readLength);
+        super(16777215, 1, 3, 0, 0);
     }
 }
\ No newline at end of file