all: upgrade to netty 4.1.8 and tcnative Fork26

This commit is contained in:
Carl Mastrangelo 2017-01-30 12:40:46 -08:00 committed by GitHub
parent cbe0ecd5e2
commit 0c0ce37bbd
3 changed files with 31 additions and 38 deletions

View File

@ -62,7 +62,7 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven-
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId> <artifactId>netty-tcnative-boringssl-static</artifactId>
<version>1.1.33.Fork25</version> <version>1.1.33.Fork26</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
@ -80,7 +80,7 @@ buildscript {
} }
dependencies { dependencies {
compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork25' compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork26'
} }
``` ```
@ -115,7 +115,7 @@ In Maven, you can use the [os-maven-plugin](https://github.com/trustin/os-maven-
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId> <artifactId>netty-tcnative</artifactId>
<version>1.1.33.Fork25</version> <version>1.1.33.Fork26</version>
<classifier>${tcnative.classifier}</classifier> <classifier>${tcnative.classifier}</classifier>
</dependency> </dependency>
</dependencies> </dependencies>
@ -183,7 +183,7 @@ if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) {
} }
dependencies { dependencies {
compile 'io.netty:netty-tcnative:1.1.33.Fork25:' + tcnative_classifier compile 'io.netty:netty-tcnative:1.1.33.Fork26:' + tcnative_classifier
} }
``` ```

View File

@ -161,10 +161,10 @@ subprojects {
protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.0', protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.8.0',
protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}", protobuf_util: "com.google.protobuf:protobuf-java-util:${protobufVersion}",
netty: 'io.netty:netty-codec-http2:[4.1.7.Final]', netty: 'io.netty:netty-codec-http2:[4.1.8.Final]',
netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.7.Final' + epoll_suffix, netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.8.Final' + epoll_suffix,
netty_proxy_handler: 'io.netty:netty-handler-proxy:4.1.7.Final', netty_proxy_handler: 'io.netty:netty-handler-proxy:4.1.8.Final',
netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork25', netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork26',
// Test dependencies. // Test dependencies.
junit: 'junit:junit:4.11', junit: 'junit:junit:4.11',

View File

@ -58,7 +58,6 @@ import io.grpc.Metadata;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http2.DefaultHttp2HeadersDecoder; import io.netty.handler.codec.http2.DefaultHttp2HeadersDecoder;
import io.netty.handler.codec.http2.Http2Exception; import io.netty.handler.codec.http2.Http2Exception;
import io.netty.handler.codec.http2.Http2HeaderTable;
import io.netty.handler.codec.http2.Http2Headers; import io.netty.handler.codec.http2.Http2Headers;
import io.netty.handler.codec.http2.Http2HeadersDecoder; import io.netty.handler.codec.http2.Http2HeadersDecoder;
import io.netty.handler.codec.http2.internal.hpack.Decoder; import io.netty.handler.codec.http2.internal.hpack.Decoder;
@ -79,21 +78,11 @@ abstract class GrpcHttp2HeadersDecoder implements Http2HeadersDecoder,
private static final float HEADERS_COUNT_WEIGHT_NEW = 1 / 5f; private static final float HEADERS_COUNT_WEIGHT_NEW = 1 / 5f;
private static final float HEADERS_COUNT_WEIGHT_HISTORICAL = 1 - HEADERS_COUNT_WEIGHT_NEW; private static final float HEADERS_COUNT_WEIGHT_HISTORICAL = 1 - HEADERS_COUNT_WEIGHT_NEW;
private final Decoder decoder = new Decoder(); private final Decoder decoder;
private final Http2HeaderTable headerTable = new GrpcHttp2HeaderTable();
private float numHeadersGuess = 8; private float numHeadersGuess = 8;
GrpcHttp2HeadersDecoder(long maxHeaderListSize) { GrpcHttp2HeadersDecoder(long maxHeaderListSize) {
try { decoder = new Decoder(maxHeaderListSize, 32 /* same as default */);
decoder.setMaxHeaderListSize(maxHeaderListSize);
} catch (Http2Exception e) {
PlatformDependent.throwException(e);
}
}
@Override
public Http2HeaderTable headerTable() {
return headerTable;
} }
@Override @Override
@ -114,26 +103,30 @@ abstract class GrpcHttp2HeadersDecoder implements Http2HeadersDecoder,
return this; return this;
} }
private final class GrpcHttp2HeaderTable implements Http2HeaderTable { @Override
@Override public long maxHeaderListSize() {
public void maxHeaderTableSize(long max) throws Http2Exception { return decoder.getMaxHeaderListSize();
decoder.setMaxHeaderTableSize(max); }
}
@Override @Override
public long maxHeaderTableSize() { public void maxHeaderListSize(long maxHeaderListSize, long maxHeaderListSizeGoAway)
return decoder.getMaxHeaderTableSize(); throws Http2Exception {
} decoder.setMaxHeaderListSize(maxHeaderListSize, maxHeaderListSizeGoAway);
}
@Override @Override
public void maxHeaderListSize(long max) throws Http2Exception { public long maxHeaderListSizeGoAway() {
decoder.setMaxHeaderListSize(max); return decoder.getMaxHeaderListSizeGoAway();
} }
@Override @Override
public long maxHeaderListSize() { public long maxHeaderTableSize() {
return decoder.getMaxHeaderListSize(); return decoder.getMaxHeaderTableSize();
} }
@Override
public void maxHeaderTableSize(long max) throws Http2Exception {
decoder.setMaxHeaderTableSize(max);
} }
static final class GrpcHttp2ServerHeadersDecoder extends GrpcHttp2HeadersDecoder { static final class GrpcHttp2ServerHeadersDecoder extends GrpcHttp2HeadersDecoder {