Skip to content

Commit

Permalink
Merge pull request #4752 from eclipse-vertx/upgrade-to-netty-4.94.Fin…
Browse files Browse the repository at this point in the history
…al-4.x

Upgrade to netty 4.94.final 4.x
  • Loading branch information
vietj authored Jun 22, 2023
2 parents 744a27c + 2b716af commit 10e44d9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>brotli4j</artifactId>
<version>1.8.0</version>
<version>1.12.0</version>
<scope>test</scope>
</dependency>

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/io/vertx/core/net/impl/ConnectionBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ public SocketAddress remoteAddress() {
address = socketAdressOverride(REMOTE_ADDRESS_OVERRIDE);
if (address == null) {
address = channelRemoteAddress();
if (address != null && address.isDomainSocket() && address.path().isEmpty()) {
address = channelLocalAddress();
}
}
if (address != null) {
remoteAddress = address;
Expand All @@ -654,10 +657,6 @@ public SocketAddress remoteAddress(boolean real) {

private SocketAddress channelLocalAddress() {
java.net.SocketAddress addr = chctx.channel().localAddress();
if (addr == null && channel().getClass().getSimpleName().endsWith("DomainSocketChannel")) {
// Workaround bug https://github.com/netty/netty/issues/13417
return SocketAddress.domainSocketAddress("");
}
return addr != null ? vertx.transport().convert(addr) : null;
}

Expand All @@ -667,6 +666,9 @@ public SocketAddress localAddress() {
address = socketAdressOverride(LOCAL_ADDRESS_OVERRIDE);
if (address == null) {
address = channelLocalAddress();
if (address != null && address.isDomainSocket() && address.path().isEmpty()) {
address = channelRemoteAddress();
}
}
if (address != null) {
localAddress = address;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/vertx/core/net/NetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ public void testSocketAddress() {
assertEquals("127.0.0.1", addr.hostAddress());
} else {
assertEquals(testAddress.path(), addr.path());
assertEquals("", socket.remoteAddress().path());
assertEquals(testAddress.path(), socket.remoteAddress().path());
}
socket.close();
}).listen(1234, "localhost").onComplete(onSuccess(v -> {
Expand All @@ -2228,7 +2228,7 @@ public void testSocketAddress() {
assertEquals(addr.port(), 1234);
} else {
assertEquals(testAddress.path(), addr.path());
assertEquals("", socket.localAddress().path());
assertEquals(testAddress.path(), socket.localAddress().path());
}
socket.closeHandler(v2 -> testComplete());
}));
Expand Down

0 comments on commit 10e44d9

Please sign in to comment.