Skip to content

Commit

Permalink
fix old version decode
Browse files Browse the repository at this point in the history
  • Loading branch information
Bughue committed Jul 24, 2024
1 parent dda2b2f commit 6719e60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public static String getChannelVersion(Channel c) {
public static void checkVersion(String version) throws IncompatibleVersionException {
long current = convertVersion(CURRENT);
long clientVersion = convertVersion(version);
long divideVersion = convertVersion(VERSION_0_7_1);
if ((current > divideVersion && clientVersion < divideVersion) || (current < divideVersion && clientVersion > divideVersion)) {
if (current < clientVersion) {
throw new IncompatibleVersionException("incompatible client version:" + version);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,15 @@ public RpcMessage decodeFrame(ByteBuf in) {

@Override
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
Object decoded;
try {
decoded = super.decode(ctx, in);
if (decoded instanceof ByteBuf) {
ByteBuf frame = (ByteBuf)decoded;
try {
return decodeFrame(frame);
} finally {
frame.release();
}
if (in instanceof ByteBuf) {
return decodeFrame(in);
}
} catch (Exception exx) {
LOGGER.error("Decode frame error, cause: {}", exx.getMessage());
throw new DecodeException(exx);
}
return decoded;
return in;
}

}

0 comments on commit 6719e60

Please sign in to comment.