Fixed issue: NETTY-163 OioDatagramChannel.connect() hangs if called on a bound channel
* Set SO_TIMEOUT of DatagramSocket to 100ms
This commit is contained in:
parent
ffe2831502
commit
151bf08095
@ -30,6 +30,7 @@ import java.net.InetSocketAddress;
|
||||
import java.net.MulticastSocket;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
import org.jboss.netty.channel.AbstractChannel;
|
||||
import org.jboss.netty.channel.ChannelException;
|
||||
@ -68,6 +69,13 @@ final class OioDatagramChannel extends AbstractChannel
|
||||
} catch (IOException e) {
|
||||
throw new ChannelException("Failed to open a datagram socket.", e);
|
||||
}
|
||||
|
||||
try {
|
||||
socket.setSoTimeout(10);
|
||||
} catch (SocketException e) {
|
||||
throw new ChannelException(
|
||||
"Failed to configure the datagram socket timeout.", e);
|
||||
}
|
||||
config = new DefaultDatagramChannelConfig(socket);
|
||||
|
||||
fireChannelOpen(this);
|
||||
|
Loading…
Reference in New Issue
Block a user