Fix failure during accept(...)
Motivation: Sometimes accept failed as we not correctly set the active variable when constructing the server channel. This lead to the situation that we tried to add POLLIN before the channel become active and so tried to call accept before it was listen. Modifications: - Use the correct constructor - Cleanup Result: No more accept failures.
This commit is contained in:
parent
51e20ecd3c
commit
614323e132
@ -56,7 +56,7 @@ import static io.netty.channel.unix.UnixChannelUtil.*;
|
|||||||
import static io.netty.util.internal.ObjectUtil.*;
|
import static io.netty.util.internal.ObjectUtil.*;
|
||||||
|
|
||||||
abstract class AbstractIOUringChannel extends AbstractChannel implements UnixChannel {
|
abstract class AbstractIOUringChannel extends AbstractChannel implements UnixChannel {
|
||||||
private static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractIOUringChannel.class);
|
static final InternalLogger logger = InternalLoggerFactory.getInstance(AbstractIOUringChannel.class);
|
||||||
private static final ChannelMetadata METADATA = new ChannelMetadata(false);
|
private static final ChannelMetadata METADATA = new ChannelMetadata(false);
|
||||||
final LinuxSocket socket;
|
final LinuxSocket socket;
|
||||||
protected volatile boolean active;
|
protected volatile boolean active;
|
||||||
|
@ -29,12 +29,8 @@ import static io.netty.channel.unix.Errors.*;
|
|||||||
|
|
||||||
abstract class AbstractIOUringServerChannel extends AbstractIOUringChannel implements ServerChannel {
|
abstract class AbstractIOUringServerChannel extends AbstractIOUringChannel implements ServerChannel {
|
||||||
|
|
||||||
AbstractIOUringServerChannel(int fd) {
|
protected AbstractIOUringServerChannel(LinuxSocket socket, boolean active) {
|
||||||
super(null, new LinuxSocket(fd));
|
super(null, socket, active);
|
||||||
}
|
|
||||||
|
|
||||||
AbstractIOUringServerChannel(LinuxSocket fd) {
|
|
||||||
super(null, fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,22 +18,15 @@ package io.netty.channel.uring;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.socket.ServerSocketChannel;
|
import io.netty.channel.socket.ServerSocketChannel;
|
||||||
import io.netty.channel.unix.FileDescriptor;
|
import io.netty.channel.unix.FileDescriptor;
|
||||||
import io.netty.channel.unix.Socket;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public final class IOUringServerSocketChannel extends AbstractIOUringServerChannel implements ServerSocketChannel {
|
public final class IOUringServerSocketChannel extends AbstractIOUringServerChannel implements ServerSocketChannel {
|
||||||
private final IOUringServerSocketChannelConfig config;
|
private final IOUringServerSocketChannelConfig config;
|
||||||
private volatile Collection<InetAddress> tcpMd5SigAddresses = Collections.emptyList();
|
|
||||||
|
|
||||||
public IOUringServerSocketChannel() {
|
public IOUringServerSocketChannel() {
|
||||||
super(Socket.newSocketStream().intValue());
|
super(LinuxSocket.newSocketStream(), false);
|
||||||
this.config = new IOUringServerSocketChannelConfig(this);
|
this.config = new IOUringServerSocketChannelConfig(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user