Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into hotfix/fix_netty…
Browse files Browse the repository at this point in the history
…_handshake

# Conflicts:
#	remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingServer.java
  • Loading branch information
dingshuangxi888 committed Jul 10, 2023
2 parents 18ae254 + 58550f0 commit c24eed3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ public HandshakeHandler() {
}

@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
protected void decode(ChannelHandlerContext ctx, ByteBuf byteBuf, List<Object> out) throws Exception {
try {
ProtocolDetectionResult<HAProxyProtocolVersion> ha = HAProxyMessageDecoder.detectProtocol(in);
if (ha.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
ProtocolDetectionResult<HAProxyProtocolVersion> detectionResult = HAProxyMessageDecoder.detectProtocol(byteBuf);
if (detectionResult.state() == ProtocolDetectionState.NEEDS_MORE_DATA) {
return;
}
if (ha.state() == ProtocolDetectionState.DETECTED) {
if (detectionResult.state() == ProtocolDetectionState.DETECTED) {
ctx.pipeline().addAfter(defaultEventExecutorGroup, ctx.name(), HA_PROXY_DECODER, new HAProxyMessageDecoder())
.addAfter(defaultEventExecutorGroup, HA_PROXY_DECODER, HA_PROXY_HANDLER, new HAProxyMessageHandler())
.addAfter(defaultEventExecutorGroup, HA_PROXY_HANDLER, TLS_MODE_HANDLER, tlsModeHandler);
Expand Down Expand Up @@ -494,8 +494,8 @@ public class TlsModeHandler extends SimpleChannelInboundHandler<ByteBuf> {
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {

// Peek the first byte to determine if the content is starting with TLS handshake
byte b = msg.getByte(0);
// Peek the current read index byte to determine if the content is starting with TLS handshake
byte b = msg.getByte(msg.readerIndex());

if (b == HANDSHAKE_MAGIC_CODE) {
switch (tlsMode) {
Expand Down
10 changes: 9 additions & 1 deletion store/src/main/java/org/apache/rocketmq/store/timer/Slot.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@
*/
package org.apache.rocketmq.store.timer;

/**
* Represents a slot of timing wheel. Format:
* ┌────────────┬───────────┬───────────┬───────────┬───────────┐
* │delayed time│ first pos │ last pos │ num │ magic │
* ├────────────┼───────────┼───────────┼───────────┼───────────┤
* │ 8bytes │ 8bytes │ 8bytes │ 4bytes │ 4bytes │
* └────────────┴───────────┴───────────┴───────────┴───────────┘
*/
public class Slot {
public static final short SIZE = 32;
public final long timeMs;
public final long timeMs; //delayed time
public final long firstPos;
public final long lastPos;
public final int num;
Expand Down

0 comments on commit c24eed3

Please sign in to comment.