Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions vertx-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http3</artifactId>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
Expand Down Expand Up @@ -98,6 +108,16 @@
<artifactId>netty-transport-classes-kqueue</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-classes-quic</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<optional>true</optional>
</dependency>

<!-- Jackson -->
<dependency>
Expand Down Expand Up @@ -880,6 +900,12 @@
<classifier>linux-x86_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<classifier>linux-x86_64</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand All @@ -904,6 +930,12 @@
<classifier>linux-x86_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<classifier>linux-x86_64</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand All @@ -928,6 +960,12 @@
<classifier>linux-aarch_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<classifier>linux-aarch_64</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand All @@ -952,6 +990,12 @@
<classifier>osx-x86_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<classifier>osx-x86_64</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand All @@ -976,6 +1020,12 @@
<classifier>osx-aarch_64</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-native-quic</artifactId>
<classifier>osx-aarch_64</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>

Expand Down
2 changes: 2 additions & 0 deletions vertx-core/src/main/asciidoc/net.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ The default shut-down timeout is 30 seconds, you can override the amount of time
{@link examples.NetExamples#serverShutdownWithAmountOfTime}
----

NOTE: any socket without a shutdown handler is closed immediately

=== TCP close

You can close a {@link io.vertx.core.net.NetServer#close() server} or {@link io.vertx.core.net.NetClient#close() client} to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ public class DatagramSocketOptionsConverter {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DatagramSocketOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "reuseAddress":
if (member.getValue() instanceof Boolean) {
obj.setReuseAddress((Boolean)member.getValue());
}
break;
case "logActivity":
if (member.getValue() instanceof Boolean) {
obj.setLogActivity((Boolean)member.getValue());
}
break;
case "activityLogDataFormat":
if (member.getValue() instanceof String) {
obj.setActivityLogDataFormat(io.netty.handler.logging.ByteBufFormat.valueOf((String)member.getValue()));
}
break;
case "reusePort":
if (member.getValue() instanceof Boolean) {
obj.setReusePort((Boolean)member.getValue());
}
break;
case "sendBufferSize":
if (member.getValue() instanceof Number) {
obj.setSendBufferSize(((Number)member.getValue()).intValue());
}
break;
case "receiveBufferSize":
if (member.getValue() instanceof Number) {
obj.setReceiveBufferSize(((Number)member.getValue()).intValue());
}
break;
case "trafficClass":
if (member.getValue() instanceof Number) {
obj.setTrafficClass(((Number)member.getValue()).intValue());
}
break;
case "broadcast":
if (member.getValue() instanceof Boolean) {
obj.setBroadcast((Boolean)member.getValue());
Expand Down Expand Up @@ -46,6 +81,15 @@ static void toJson(DatagramSocketOptions obj, JsonObject json) {
}

static void toJson(DatagramSocketOptions obj, java.util.Map<String, Object> json) {
json.put("reuseAddress", obj.isReuseAddress());
json.put("logActivity", obj.getLogActivity());
if (obj.getActivityLogDataFormat() != null) {
json.put("activityLogDataFormat", obj.getActivityLogDataFormat().name());
}
json.put("reusePort", obj.isReusePort());
json.put("sendBufferSize", obj.getSendBufferSize());
json.put("receiveBufferSize", obj.getReceiveBufferSize());
json.put("trafficClass", obj.getTrafficClass());
json.put("broadcast", obj.isBroadcast());
json.put("loopbackModeDisabled", obj.isLoopbackModeDisabled());
json.put("multicastTimeToLive", obj.getMulticastTimeToLive());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ public class TCPSSLOptionsConverter {
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TCPSSLOptions obj) {
for (java.util.Map.Entry<String, Object> member : json) {
switch (member.getKey()) {
case "sendBufferSize":
if (member.getValue() instanceof Number) {
obj.setSendBufferSize(((Number)member.getValue()).intValue());
}
break;
case "receiveBufferSize":
if (member.getValue() instanceof Number) {
obj.setReceiveBufferSize(((Number)member.getValue()).intValue());
}
break;
case "reuseAddress":
if (member.getValue() instanceof Boolean) {
obj.setReuseAddress((Boolean)member.getValue());
}
break;
case "trafficClass":
if (member.getValue() instanceof Number) {
obj.setTrafficClass(((Number)member.getValue()).intValue());
}
break;
case "logActivity":
if (member.getValue() instanceof Boolean) {
obj.setLogActivity((Boolean)member.getValue());
}
break;
case "activityLogDataFormat":
if (member.getValue() instanceof String) {
obj.setActivityLogDataFormat(io.netty.handler.logging.ByteBufFormat.valueOf((String)member.getValue()));
}
break;
case "reusePort":
if (member.getValue() instanceof Boolean) {
obj.setReusePort((Boolean)member.getValue());
}
break;
case "tcpNoDelay":
if (member.getValue() instanceof Boolean) {
obj.setTcpNoDelay((Boolean)member.getValue());
Expand Down Expand Up @@ -130,6 +165,15 @@ static void toJson(TCPSSLOptions obj, JsonObject json) {
}

static void toJson(TCPSSLOptions obj, java.util.Map<String, Object> json) {
json.put("sendBufferSize", obj.getSendBufferSize());
json.put("receiveBufferSize", obj.getReceiveBufferSize());
json.put("reuseAddress", obj.isReuseAddress());
json.put("trafficClass", obj.getTrafficClass());
json.put("logActivity", obj.getLogActivity());
if (obj.getActivityLogDataFormat() != null) {
json.put("activityLogDataFormat", obj.getActivityLogDataFormat().name());
}
json.put("reusePort", obj.isReusePort());
json.put("tcpNoDelay", obj.isTcpNoDelay());
json.put("tcpKeepAlive", obj.isTcpKeepAlive());
json.put("soLinger", obj.getSoLinger());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @author <a href="http://tfox.org">Tim Fox</a>
*/
@DataObject
@JsonGen(publicConverter = false)
@JsonGen(publicConverter = false, inheritConverter = true)
public class DatagramSocketOptions extends NetworkOptions {

/**
Expand Down Expand Up @@ -57,6 +57,7 @@ public class DatagramSocketOptions extends NetworkOptions {
*/
public static final boolean DEFAULT_IPV6 = false;

private boolean reusePort;
private boolean broadcast;
private boolean loopbackModeDisabled;
private int multicastTimeToLive;
Expand All @@ -79,6 +80,7 @@ public DatagramSocketOptions() {
*/
public DatagramSocketOptions(DatagramSocketOptions other) {
super(other);
this.reusePort = other.reusePort;
this.broadcast = other.isBroadcast();
this.loopbackModeDisabled = other.isLoopbackModeDisabled();
this.multicastTimeToLive = other.getMulticastTimeToLive();
Expand All @@ -98,13 +100,25 @@ public DatagramSocketOptions(JsonObject json) {
}

private void init() {
reusePort = DEFAULT_REUSE_PORT;
broadcast = DEFAULT_BROADCAST;
loopbackModeDisabled = DEFAULT_LOOPBACK_MODE_DISABLED;
multicastTimeToLive = DEFAULT_MULTICAST_TIME_TO_LIVE;
multicastNetworkInterface = DEFAULT_MULTICAST_NETWORK_INTERFACE;
ipV6 = DEFAULT_IPV6;
}

@Override
public boolean isReusePort() {
return reusePort;
}

@Override
public DatagramSocketOptions setReusePort(boolean reusePort) {
this.reusePort = reusePort;
return this;
}

@Override
public int getSendBufferSize() {
return super.getSendBufferSize();
Expand Down Expand Up @@ -133,11 +147,6 @@ public DatagramSocketOptions setReuseAddress(boolean reuseAddress) {
return this;
}

@Override
public DatagramSocketOptions setReusePort(boolean reusePort) {
return (DatagramSocketOptions) super.setReusePort(reusePort);
}

@Override
public int getTrafficClass() {
return super.getTrafficClass();
Expand Down Expand Up @@ -252,4 +261,11 @@ public DatagramSocketOptions setLogActivity(boolean logEnabled) {
public DatagramSocketOptions setActivityLogDataFormat(ByteBufFormat activityLogDataFormat) {
return (DatagramSocketOptions) super.setActivityLogDataFormat(activityLogDataFormat);
}

@Override
public JsonObject toJson() {
JsonObject json = new JsonObject();
DatagramSocketOptionsConverter.toJson(this, json);
return json;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private DnsAddressResolverProvider(VertxInternal vertx, AddressResolverOptions o

DnsNameResolverBuilder builder = new DnsNameResolverBuilder();
builder.hostsFileEntriesResolver(this);
builder.channelFactory(() -> vertx.transport().datagramChannel());
builder.datagramChannelFactory(vertx.transport().datagramChannelFactory());
builder.socketChannelFactory(() -> (SocketChannel) vertx.transport().channelFactory(false).newChannel());
builder.nameServerProvider(nameServerAddressProvider);
builder.queryServerAddressStream(new ThreadLocalNameServerAddressStream(nameServerAddressProvider, ""));
Expand Down
Loading
Loading