From f7fadd67dd983076e4a05e8fa3dd55ffc58b545d Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 4 Dec 2019 20:09:12 +0100 Subject: [PATCH] Remove support for epoll level-triggered (#9826) Motivation: Netty uses epoll edge-triggered by default forever and there is really not reason why someone should use level-triggered (its considered a implementation detail). Modifications: - Remove code that was related to level-triggered mode - Adjust testclass names Result: Fixes https://github.com/netty/netty/issues/9349 --- .../epoll/AbstractEpollServerChannel.java | 1 - .../epoll/AbstractEpollStreamChannel.java | 1 - .../channel/epoll/EpollChannelConfig.java | 70 ------------------- .../channel/epoll/EpollChannelOption.java | 5 -- .../channel/epoll/EpollDatagramChannel.java | 1 - .../epoll/EpollDatagramChannelConfig.java | 6 -- .../epoll/EpollDomainSocketChannel.java | 1 - .../epoll/EpollDomainSocketChannelConfig.java | 6 -- .../io/netty/channel/epoll/EpollMode.java | 36 ---------- .../epoll/EpollRecvByteAllocatorHandle.java | 12 +--- .../epoll/EpollServerChannelConfig.java | 6 -- .../epoll/EpollSocketChannelConfig.java | 6 -- .../EpollETSocketStringEchoBusyWaitTest.java | 31 -------- .../epoll/EpollLTSocketAutoReadTest.java | 39 ----------- ...ollLTSocketConditionalWritabilityTest.java | 39 ----------- ...EpollLTSocketDataReadInitialStateTest.java | 39 ----------- .../EpollLTSocketExceptionHandlingTest.java | 39 ----------- .../epoll/EpollLTSocketHalfClosed.java | 39 ----------- .../epoll/EpollLTSocketReadPendingTest.java | 39 ----------- .../EpollLTSocketStringEchoBusyWaitTest.java | 31 -------- ...Test.java => EpollSocketAutoReadTest.java} | 11 +-- ...pollSocketConditionalWritabilityTest.java} | 10 +-- ... EpollSocketDataReadInitialStateTest.java} | 10 +-- ... => EpollSocketExceptionHandlingTest.java} | 10 +-- ...Closed.java => EpollSocketHalfClosed.java} | 10 +-- ...t.java => EpollSocketReadPendingTest.java} | 10 +-- 26 files changed, 7 insertions(+), 501 deletions(-) delete mode 100644 transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollMode.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketStringEchoBusyWaitTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketAutoReadTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketConditionalWritabilityTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketDataReadInitialStateTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketExceptionHandlingTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketHalfClosed.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketReadPendingTest.java delete mode 100644 transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketStringEchoBusyWaitTest.java rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketAutoReadTest.java => EpollSocketAutoReadTest.java} (66%) rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketConditionalWritabilityTest.java => EpollSocketConditionalWritabilityTest.java} (67%) rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketDataReadInitialStateTest.java => EpollSocketDataReadInitialStateTest.java} (68%) rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketExceptionHandlingTest.java => EpollSocketExceptionHandlingTest.java} (68%) rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketHalfClosed.java => EpollSocketHalfClosed.java} (68%) rename transport-native-epoll/src/test/java/io/netty/channel/epoll/{EpollETSocketReadPendingTest.java => EpollSocketReadPendingTest.java} (68%) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollServerChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollServerChannel.java index fcae7fee75..d76f53687c 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollServerChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollServerChannel.java @@ -102,7 +102,6 @@ public abstract class AbstractEpollServerChannel extends AbstractEpollChannel im return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); - allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); allocHandle.reset(config); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java index b0b742ec4c..2b20ab121d 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java @@ -543,7 +543,6 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); - allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelConfig.java index e89f86c529..5777da74e2 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelConfig.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelConfig.java @@ -16,16 +16,13 @@ package io.netty.channel.epoll; import io.netty.buffer.ByteBufAllocator; -import io.netty.channel.ChannelOption; import io.netty.channel.DefaultChannelConfig; import io.netty.channel.MessageSizeEstimator; import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.WriteBufferWaterMark; -import java.util.Map; import static io.netty.channel.unix.Limits.SSIZE_MAX; -import static java.util.Objects.requireNonNull; public class EpollChannelConfig extends DefaultChannelConfig { private volatile long maxBytesPerGatheringWrite = SSIZE_MAX; @@ -34,31 +31,6 @@ public class EpollChannelConfig extends DefaultChannelConfig { super(channel); } - @Override - public Map, Object> getOptions() { - return getOptions(super.getOptions(), EpollChannelOption.EPOLL_MODE); - } - - @SuppressWarnings("unchecked") - @Override - public T getOption(ChannelOption option) { - if (option == EpollChannelOption.EPOLL_MODE) { - return (T) getEpollMode(); - } - return super.getOption(option); - } - - @Override - public boolean setOption(ChannelOption option, T value) { - validate(option, value); - if (option == EpollChannelOption.EPOLL_MODE) { - setEpollMode((EpollMode) value); - } else { - return super.setOption(option, value); - } - return true; - } - @Override public EpollChannelConfig setConnectTimeoutMillis(int connectTimeoutMillis) { super.setConnectTimeoutMillis(connectTimeoutMillis); @@ -126,48 +98,6 @@ public class EpollChannelConfig extends DefaultChannelConfig { return this; } - /** - * Return the {@link EpollMode} used. Default is - * {@link EpollMode#EDGE_TRIGGERED}. If you want to use {@link #isAutoRead()} {@code false} or - * {@link #getMaxMessagesPerRead()} and have an accurate behaviour you should use - * {@link EpollMode#LEVEL_TRIGGERED}. - */ - public EpollMode getEpollMode() { - return ((AbstractEpollChannel) channel).isFlagSet(Native.EPOLLET) - ? EpollMode.EDGE_TRIGGERED : EpollMode.LEVEL_TRIGGERED; - } - - /** - * Set the {@link EpollMode} used. Default is - * {@link EpollMode#EDGE_TRIGGERED}. If you want to use {@link #isAutoRead()} {@code false} or - * {@link #getMaxMessagesPerRead()} and have an accurate behaviour you should use - * {@link EpollMode#LEVEL_TRIGGERED}. - * - * Be aware this config setting can only be adjusted before the channel was registered. - */ - public EpollChannelConfig setEpollMode(EpollMode mode) { - requireNonNull(mode, "mode"); - switch (mode) { - case EDGE_TRIGGERED: - checkChannelNotRegistered(); - ((AbstractEpollChannel) channel).setFlag(Native.EPOLLET); - break; - case LEVEL_TRIGGERED: - checkChannelNotRegistered(); - ((AbstractEpollChannel) channel).clearFlag(Native.EPOLLET); - break; - default: - throw new Error(); - } - return this; - } - - private void checkChannelNotRegistered() { - if (channel.isRegistered()) { - throw new IllegalStateException("EpollMode can only be changed before channel is registered"); - } - } - @Override protected final void autoReadCleared() { ((AbstractEpollChannel) channel).clearEpollIn(); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelOption.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelOption.java index 765eea25d1..29dcb0b71d 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelOption.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollChannelOption.java @@ -39,12 +39,7 @@ public final class EpollChannelOption extends UnixChannelOption { ChannelOption.valueOf(EpollChannelOption.class, "TCP_DEFER_ACCEPT"); public static final ChannelOption TCP_QUICKACK = valueOf(EpollChannelOption.class, "TCP_QUICKACK"); public static final ChannelOption SO_BUSY_POLL = valueOf(EpollChannelOption.class, "SO_BUSY_POLL"); - - public static final ChannelOption EPOLL_MODE = - ChannelOption.valueOf(EpollChannelOption.class, "EPOLL_MODE"); - public static final ChannelOption> TCP_MD5SIG = valueOf("TCP_MD5SIG"); - public static final ChannelOption MAX_DATAGRAM_PAYLOAD_SIZE = valueOf("MAX_DATAGRAM_PAYLOAD_SIZE"); @SuppressWarnings({ "unused", "deprecation" }) diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannel.java index 508ace7096..0c0d0f81d5 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannel.java @@ -468,7 +468,6 @@ public final class EpollDatagramChannel extends AbstractEpollChannel implements return; } final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); - allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java index e97d2c5eda..c7861bf2e0 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDatagramChannelConfig.java @@ -399,12 +399,6 @@ public final class EpollDatagramChannelConfig extends EpollChannelConfig impleme } } - @Override - public EpollDatagramChannelConfig setEpollMode(EpollMode mode) { - super.setEpollMode(mode); - return this; - } - /** * Returns {@code true} if the SO_REUSEPORT option is set. */ diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannel.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannel.java index 66aed9035b..7b8804f542 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannel.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannel.java @@ -153,7 +153,6 @@ public final class EpollDomainSocketChannel extends AbstractEpollStreamChannel i } final ChannelConfig config = config(); final EpollRecvByteAllocatorHandle allocHandle = recvBufAllocHandle(); - allocHandle.edgeTriggered(isFlagSet(Native.EPOLLET)); final ChannelPipeline pipeline = pipeline(); allocHandle.reset(config); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannelConfig.java index 9d0e08e465..89749b5b4e 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannelConfig.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollDomainSocketChannelConfig.java @@ -154,12 +154,6 @@ public final class EpollDomainSocketChannelConfig extends EpollChannelConfig return this; } - @Override - public EpollDomainSocketChannelConfig setEpollMode(EpollMode mode) { - super.setEpollMode(mode); - return this; - } - @Override public EpollDomainSocketChannelConfig setReadMode(DomainSocketReadMode mode) { requireNonNull(mode, "mode"); diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollMode.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollMode.java deleted file mode 100644 index ec73fb70aa..0000000000 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollMode.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -/** - * The epoll mode to use. - */ -public enum EpollMode { - - /** - * Use {@code EPOLLET} (edge-triggered). - * - * @see man 7 epoll. - */ - EDGE_TRIGGERED, - - /** - * Do not use {@code EPOLLET} (level-triggered). - * - * @see man 7 epoll. - */ - LEVEL_TRIGGERED -} diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollRecvByteAllocatorHandle.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollRecvByteAllocatorHandle.java index 41d9887154..fa9c0e4b80 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollRecvByteAllocatorHandle.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollRecvByteAllocatorHandle.java @@ -26,7 +26,6 @@ class EpollRecvByteAllocatorHandle extends DelegatingHandle implements ExtendedH private final PreferredDirectByteBufAllocator preferredDirectByteBufAllocator = new PreferredDirectByteBufAllocator(); private final UncheckedBooleanSupplier defaultMaybeMoreDataSupplier = this::maybeMoreDataToRead; - private boolean isEdgeTriggered; private boolean receivedRdHup; EpollRecvByteAllocatorHandle(ExtendedHandle handle) { @@ -51,16 +50,7 @@ class EpollRecvByteAllocatorHandle extends DelegatingHandle implements ExtendedH * * It is assumed RDHUP is handled externally by checking {@link #isReceivedRdHup()}. */ - return (isEdgeTriggered && lastBytesRead() > 0) || - (!isEdgeTriggered && lastBytesRead() == attemptedBytesRead()); - } - - final void edgeTriggered(boolean edgeTriggered) { - isEdgeTriggered = edgeTriggered; - } - - final boolean isEdgeTriggered() { - return isEdgeTriggered; + return lastBytesRead() > 0; } @Override diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerChannelConfig.java index 6f85573881..e36cb094db 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerChannelConfig.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollServerChannelConfig.java @@ -223,10 +223,4 @@ public class EpollServerChannelConfig extends EpollChannelConfig implements Serv super.setMessageSizeEstimator(estimator); return this; } - - @Override - public EpollServerChannelConfig setEpollMode(EpollMode mode) { - super.setEpollMode(mode); - return this; - } } diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java index f3d04dd3f9..da4c03f9b3 100644 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java +++ b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java @@ -655,12 +655,6 @@ public final class EpollSocketChannelConfig extends EpollChannelConfig implement return this; } - @Override - public EpollSocketChannelConfig setEpollMode(EpollMode mode) { - super.setEpollMode(mode); - return this; - } - private void calculateMaxBytesPerGatheringWrite() { // Multiply by 2 to give some extra space in case the OS can process write data faster than we can provide. int newSendBufferSize = getSendBufferSize() << 1; diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketStringEchoBusyWaitTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketStringEchoBusyWaitTest.java deleted file mode 100644 index e599e3bef8..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketStringEchoBusyWaitTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; - -public class EpollETSocketStringEchoBusyWaitTest extends EpollSocketStringEchoBusyWaitTest { - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketAutoReadTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketAutoReadTest.java deleted file mode 100644 index cd4f7c2d0b..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketAutoReadTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2016 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketAutoReadTest; - -import java.util.List; - -public class EpollLTSocketAutoReadTest extends SocketAutoReadTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketConditionalWritabilityTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketConditionalWritabilityTest.java deleted file mode 100644 index 31cb81964d..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketConditionalWritabilityTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2018 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketConditionalWritabilityTest; - -import java.util.List; - -public class EpollLTSocketConditionalWritabilityTest extends SocketConditionalWritabilityTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketDataReadInitialStateTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketDataReadInitialStateTest.java deleted file mode 100644 index 78614edd35..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketDataReadInitialStateTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2018 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketDataReadInitialStateTest; - -import java.util.List; - -public class EpollLTSocketDataReadInitialStateTest extends SocketDataReadInitialStateTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketExceptionHandlingTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketExceptionHandlingTest.java deleted file mode 100644 index d9ad6c1eec..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketExceptionHandlingTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2016 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketExceptionHandlingTest; - -import java.util.List; - -public class EpollLTSocketExceptionHandlingTest extends SocketExceptionHandlingTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketHalfClosed.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketHalfClosed.java deleted file mode 100644 index d544651b2f..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketHalfClosed.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketHalfClosedTest; - -import java.util.List; - -public class EpollLTSocketHalfClosed extends SocketHalfClosedTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketReadPendingTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketReadPendingTest.java deleted file mode 100644 index b12516a318..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketReadPendingTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2016 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; -import io.netty.testsuite.transport.TestsuitePermutation; -import io.netty.testsuite.transport.socket.SocketReadPendingTest; - -import java.util.List; - -public class EpollLTSocketReadPendingTest extends SocketReadPendingTest { - @Override - protected List> newFactories() { - return EpollSocketTestPermutation.INSTANCE.socket(); - } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketStringEchoBusyWaitTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketStringEchoBusyWaitTest.java deleted file mode 100644 index d6098774c0..0000000000 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollLTSocketStringEchoBusyWaitTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.bootstrap.Bootstrap; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; - -public class EpollLTSocketStringEchoBusyWaitTest extends EpollSocketStringEchoBusyWaitTest { - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.LEVEL_TRIGGERED); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketAutoReadTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketAutoReadTest.java similarity index 66% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketAutoReadTest.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketAutoReadTest.java index 8e35662646..4d2066ceca 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketAutoReadTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketAutoReadTest.java @@ -17,23 +17,14 @@ package io.netty.channel.epoll; import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.ByteBufAllocator; import io.netty.testsuite.transport.TestsuitePermutation; import io.netty.testsuite.transport.socket.SocketAutoReadTest; import java.util.List; -public class EpollETSocketAutoReadTest extends SocketAutoReadTest { +public class EpollSocketAutoReadTest extends SocketAutoReadTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } } diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketConditionalWritabilityTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketConditionalWritabilityTest.java similarity index 67% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketConditionalWritabilityTest.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketConditionalWritabilityTest.java index 773e3d63c8..61349242ee 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketConditionalWritabilityTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketConditionalWritabilityTest.java @@ -23,17 +23,9 @@ import io.netty.testsuite.transport.socket.SocketConditionalWritabilityTest; import java.util.List; -public class EpollETSocketConditionalWritabilityTest extends SocketConditionalWritabilityTest { +public class EpollSocketConditionalWritabilityTest extends SocketConditionalWritabilityTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } } diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketDataReadInitialStateTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketDataReadInitialStateTest.java similarity index 68% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketDataReadInitialStateTest.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketDataReadInitialStateTest.java index 9c27f25030..5cef36d55e 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketDataReadInitialStateTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketDataReadInitialStateTest.java @@ -23,17 +23,9 @@ import io.netty.testsuite.transport.socket.SocketDataReadInitialStateTest; import java.util.List; -public class EpollETSocketDataReadInitialStateTest extends SocketDataReadInitialStateTest { +public class EpollSocketDataReadInitialStateTest extends SocketDataReadInitialStateTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } } diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketExceptionHandlingTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketExceptionHandlingTest.java similarity index 68% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketExceptionHandlingTest.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketExceptionHandlingTest.java index 29ccc9a2fa..6eb91ba924 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketExceptionHandlingTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketExceptionHandlingTest.java @@ -23,17 +23,9 @@ import io.netty.testsuite.transport.socket.SocketExceptionHandlingTest; import java.util.List; -public class EpollETSocketExceptionHandlingTest extends SocketExceptionHandlingTest { +public class EpollSocketExceptionHandlingTest extends SocketExceptionHandlingTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } } diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketHalfClosed.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketHalfClosed.java similarity index 68% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketHalfClosed.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketHalfClosed.java index 4a5356043f..db1b4d22f0 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketHalfClosed.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketHalfClosed.java @@ -23,17 +23,9 @@ import io.netty.testsuite.transport.socket.SocketHalfClosedTest; import java.util.List; -public class EpollETSocketHalfClosed extends SocketHalfClosedTest { +public class EpollSocketHalfClosed extends SocketHalfClosedTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } } diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketReadPendingTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketReadPendingTest.java similarity index 68% rename from transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketReadPendingTest.java rename to transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketReadPendingTest.java index 38697ded19..7280359671 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollETSocketReadPendingTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollSocketReadPendingTest.java @@ -23,17 +23,9 @@ import io.netty.testsuite.transport.socket.SocketReadPendingTest; import java.util.List; -public class EpollETSocketReadPendingTest extends SocketReadPendingTest { +public class EpollSocketReadPendingTest extends SocketReadPendingTest { @Override protected List> newFactories() { return EpollSocketTestPermutation.INSTANCE.socket(); } - - @Override - protected void configure(ServerBootstrap bootstrap, Bootstrap bootstrap2, ByteBufAllocator allocator) { - super.configure(bootstrap, bootstrap2, allocator); - bootstrap.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED) - .childOption(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - bootstrap2.option(EpollChannelOption.EPOLL_MODE, EpollMode.EDGE_TRIGGERED); - } }