Update to latest netty and tcnative.

This commit is contained in:
nmittler 2016-02-19 10:08:15 -08:00
parent af6a2650af
commit 86fd2523ec
3 changed files with 12 additions and 16 deletions

View File

@ -30,7 +30,7 @@ Support for OpenSSL is only provided for the Netty transport via [netty-tcnative
### OpenSSL: Dynamic vs Static (which to use?) ### OpenSSL: Dynamic vs Static (which to use?)
As of version `1.1.33.Fork13`, netty-tcnative provides two options for usage: statically or dynamically linked. For simplification of initial setup, As of version `1.1.33.Fork14`, netty-tcnative provides two options for usage: statically or dynamically linked. For simplification of initial setup,
we recommend that users first look at `netty-tcnative-boringssl-static`, which is statically linked against BoringSSL and Apache APR. Using this artifact requires no extra installation and guarantees that ALPN and the ciphers required for we recommend that users first look at `netty-tcnative-boringssl-static`, which is statically linked against BoringSSL and Apache APR. Using this artifact requires no extra installation and guarantees that ALPN and the ciphers required for
HTTP/2 are available. HTTP/2 are available.
@ -60,7 +60,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.Fork13</version> <version>1.1.33.Fork14</version>
<classifier>${os.detected.classifier}</classifier> <classifier>${os.detected.classifier}</classifier>
</dependency> </dependency>
</dependencies> </dependencies>
@ -96,7 +96,7 @@ buildscript {
apply plugin: "com.google.osdetector" apply plugin: "com.google.osdetector"
dependencies { dependencies {
compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork13:' + osdetector.classifier compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork14:' + osdetector.classifier
} }
``` ```
@ -131,7 +131,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.Fork13</version> <version>1.1.33.Fork14</version>
<classifier>${tcnative.classifier}</classifier> <classifier>${tcnative.classifier}</classifier>
</dependency> </dependency>
</dependencies> </dependencies>
@ -199,7 +199,7 @@ if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) {
} }
dependencies { dependencies {
compile 'io.netty:netty-tcnative:1.1.33.Fork13:' + tcnative_classifier compile 'io.netty:netty-tcnative:1.1.33.Fork14:' + tcnative_classifier
} }
``` ```

View File

@ -136,9 +136,9 @@ subprojects {
protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}", protobuf_nano: "com.google.protobuf.nano:protobuf-javanano:${protobufNanoVersion}",
protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.7.4', protobuf_plugin: 'com.google.protobuf:protobuf-gradle-plugin:0.7.4',
netty: 'io.netty:netty-codec-http2:4.1.0.CR1', netty: 'io.netty:netty-codec-http2:4.1.0.CR3',
netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.0.CR1' + epoll_suffix, netty_epoll: 'io.netty:netty-transport-native-epoll:4.1.0.CR3' + epoll_suffix,
netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork13:' + osdetector.classifier, netty_tcnative: 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork14:' + osdetector.classifier,
// Test dependencies. // Test dependencies.
junit: 'junit:junit:4.11', junit: 'junit:junit:4.11',

View File

@ -114,7 +114,6 @@ class NettyClientHandler extends AbstractNettyHandler {
private Http2Ping ping; private Http2Ping ping;
private Status goAwayStatus; private Status goAwayStatus;
private Throwable goAwayStatusThrowable; private Throwable goAwayStatusThrowable;
private int nextStreamId;
static NettyClientHandler newHandler(ManagedClientTransport.Listener listener, static NettyClientHandler newHandler(ManagedClientTransport.Listener listener,
int flowControlWindow, int maxHeaderListSize, int flowControlWindow, int maxHeaderListSize,
@ -185,7 +184,6 @@ class NettyClientHandler extends AbstractNettyHandler {
Http2Connection connection = encoder.connection(); Http2Connection connection = encoder.connection();
streamKey = connection.newKey(); streamKey = connection.newKey();
nextStreamId = connection.local().nextStreamId();
connection.addListener(new Http2ConnectionAdapter() { connection.addListener(new Http2ConnectionAdapter() {
@Override @Override
public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) { public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) {
@ -336,7 +334,7 @@ class NettyClientHandler extends AbstractNettyHandler {
// Get the stream ID for the new stream. // Get the stream ID for the new stream.
final int streamId; final int streamId;
try { try {
streamId = getAndIncrementNextStreamId(); streamId = incrementAndGetNextStreamId();
} catch (StatusException e) { } catch (StatusException e) {
// Stream IDs have been exhausted for this connection. Fail the promise immediately. // Stream IDs have been exhausted for this connection. Fail the promise immediately.
promise.setFailure(e); promise.setFailure(e);
@ -531,16 +529,14 @@ class NettyClientHandler extends AbstractNettyHandler {
return stream == null ? null : (NettyClientStream) stream.getProperty(streamKey); return stream == null ? null : (NettyClientStream) stream.getProperty(streamKey);
} }
private int getAndIncrementNextStreamId() throws StatusException { private int incrementAndGetNextStreamId() throws StatusException {
int nextStreamId = connection().local().incrementAndGetNextStreamId();
if (nextStreamId < 0) { if (nextStreamId < 0) {
logger.fine("Stream IDs have been exhausted for this connection. " logger.fine("Stream IDs have been exhausted for this connection. "
+ "Initiating graceful shutdown of the connection."); + "Initiating graceful shutdown of the connection.");
throw EXHAUSTED_STREAMS_STATUS.asException(); throw EXHAUSTED_STREAMS_STATUS.asException();
} }
return nextStreamId;
int id = nextStreamId;
nextStreamId += 2;
return id;
} }
private Http2Stream requireHttp2Stream(int streamId) { private Http2Stream requireHttp2Stream(int streamId) {