NETWORKING: Fix Portability of SO_LINGER=0 in Tests (#33895)
* Setting SO_LINGER for open but not connected non-blocking sockets throws on OSX * Fixed by only applying setting to connected sockets which will save the same number of FDs as doing it on open sockets anyway * closes #33879
This commit is contained in:
parent
5f7f793f43
commit
3a5b8a71b4
|
@ -277,8 +277,9 @@ public class MockNioTransport extends TcpTransport {
|
|||
|
||||
@Override
|
||||
public void setSoLinger(int value) throws IOException {
|
||||
if (isOpen()) {
|
||||
getRawChannel().setOption(StandardSocketOptions.SO_LINGER, value);
|
||||
SocketChannel rawChannel = getRawChannel();
|
||||
if (rawChannel.isConnected()) {
|
||||
rawChannel.setOption(StandardSocketOptions.SO_LINGER, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.transport.nio;
|
||||
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
|
@ -100,7 +99,6 @@ public class SimpleMockNioTransportTests extends AbstractSimpleTransportTestCase
|
|||
}
|
||||
|
||||
public void testConnectException() throws UnknownHostException {
|
||||
assumeFalse("Broken on Darwin - https://github.com/elastic/elasticsearch/issues/33879", Constants.MAC_OS_X);
|
||||
try {
|
||||
serviceA.connectToNode(new DiscoveryNode("C", new TransportAddress(InetAddress.getByName("localhost"), 9876),
|
||||
emptyMap(), emptySet(),Version.CURRENT));
|
||||
|
|
Loading…
Reference in New Issue