netty: improve code readability (#6375)

This commit is contained in:
Steve Rao 2019-11-13 00:48:58 +08:00 committed by Kun Zhang
parent 6d3fb53128
commit 1118793bfb
4 changed files with 7 additions and 5 deletions

View File

@ -64,7 +64,7 @@ class KeepAliveEnforcer {
}
if (!valid) {
pingStrikes++;
return !(pingStrikes > MAX_PING_STRIKES);
return pingStrikes <= MAX_PING_STRIKES;
} else {
lastValidPingTime = now;
return true;

View File

@ -65,7 +65,8 @@ import javax.net.ssl.SSLException;
public final class NettyChannelBuilder
extends AbstractManagedChannelImplBuilder<NettyChannelBuilder> {
public static final int DEFAULT_FLOW_CONTROL_WINDOW = 1048576; // 1MiB
// 1MiB.
public static final int DEFAULT_FLOW_CONTROL_WINDOW = 1024 * 1024;
private static final long AS_LARGE_AS_INFINITE = TimeUnit.DAYS.toNanos(1000L);

View File

@ -63,7 +63,8 @@ import javax.net.ssl.SSLException;
@CanIgnoreReturnValue
public final class NettyServerBuilder extends AbstractServerImplBuilder<NettyServerBuilder> {
public static final int DEFAULT_FLOW_CONTROL_WINDOW = 1048576; // 1MiB
// 1MiB
public static final int DEFAULT_FLOW_CONTROL_WINDOW = 1024 * 1024;
static final long MAX_CONNECTION_IDLE_NANOS_DISABLED = Long.MAX_VALUE;
static final long MAX_CONNECTION_AGE_NANOS_DISABLED = Long.MAX_VALUE;

View File

@ -34,9 +34,9 @@ import io.netty.buffer.ByteBufAllocator;
class NettyWritableBufferAllocator implements WritableBufferAllocator {
// Use 4k as our minimum buffer size.
private static final int MIN_BUFFER = 4096;
private static final int MIN_BUFFER = 4 * 1024;
// Set the maximum buffer size to 1MB
// Set the maximum buffer size to 1MB.
private static final int MAX_BUFFER = 1024 * 1024;
private final ByteBufAllocator allocator;