Fix UDP Multicast writes. See #237

This commit is contained in:
norman 2012-04-02 14:20:40 +02:00
parent 9b90e3191a
commit b350e8d289
3 changed files with 14 additions and 12 deletions

View File

@ -20,7 +20,6 @@ import io.netty.buffer.ChannelBuffer;
import io.netty.channel.AbstractChannel;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelSink;
import io.netty.channel.MessageEvent;
@ -29,7 +28,6 @@ import io.netty.util.internal.QueueFactory;
import io.netty.util.internal.ThreadLocalBoolean;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Collection;
import java.util.Iterator;
import java.util.Queue;
@ -168,15 +166,6 @@ public abstract class AbstractNioChannel extends AbstractChannel implements NioC
super.setInterestOpsNow(interestOps);
}
@Override
public ChannelFuture write(Object message, SocketAddress remoteAddress) {
if (remoteAddress == null || remoteAddress.equals(getRemoteAddress())) {
return super.write(message, null);
} else {
return getUnsupportedOperationFuture();
}
}
@Override
public int getInterestOps() {
if (!isOpen()) {

View File

@ -273,7 +273,7 @@ public final class NioDatagramChannel extends AbstractNioChannel implements io.n
if (remoteAddress == null || remoteAddress.equals(getRemoteAddress())) {
return super.write(message, null);
} else {
return super.write(message, remoteAddress);
return Channels.write(this, message, remoteAddress);
}
}

View File

@ -17,9 +17,11 @@ package io.netty.channel.socket.nio;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ChannelSink;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
public abstract class NioSocketChannel extends AbstractNioChannel implements io.netty.channel.socket.SocketChannel {
@ -82,4 +84,15 @@ public abstract class NioSocketChannel extends AbstractNioChannel implements io.
state = ST_CLOSED;
return super.setClosed();
}
@Override
public ChannelFuture write(Object message, SocketAddress remoteAddress) {
if (remoteAddress == null || remoteAddress.equals(getRemoteAddress())) {
return super.write(message, null);
} else {
return getUnsupportedOperationFuture();
}
}
}