Skip to content

Commit

Permalink
When using connectx for TFO on non-blocking sockets, it will return E…
Browse files Browse the repository at this point in the history
…INPROGRESS

Make sure we handle that as a successful call.
  • Loading branch information
chrisvest committed Aug 11, 2021
1 parent aeec6fa commit 14306fc
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -27,6 +27,7 @@

import static io.netty.channel.kqueue.AcceptFilter.PLATFORM_UNSUPPORTED;
import static io.netty.channel.kqueue.Native.CONNECT_TCP_FASTOPEN;
import static io.netty.channel.unix.Errors.ERRNO_EINPROGRESS_NEGATIVE;
import static io.netty.channel.unix.Errors.ioResult;
import static io.netty.channel.unix.NativeInetAddress.ipv4MappedIpv6Address;
import static io.netty.util.internal.ObjectUtil.checkNotNull;
Expand Down Expand Up @@ -161,6 +162,12 @@ private int connectx(InetSocketAddress source, InetSocketAddress destination, Io
UNSPECIFIED_SOURCE_INTERFACE, sourceIPv6, sourceAddress, sourceScopeId, sourcePort,
destinationIPv6, destinationAddress, destinationScopeId, destinationPort,
flags, iovAddress, iovCount, iovDataLength);
if (result == ERRNO_EINPROGRESS_NEGATIVE) {
// This is normal for non-blocking sockets.
// We'll know the connection has been established when the socket is selectable for writing.
// Tell the channel the data was written, so the outbound buffer can update its position.
return iovDataLength;
}
if (result < 0) {
return ioResult("connectx", result);
}
Expand Down

0 comments on commit 14306fc

Please sign in to comment.