Skip to content

Commit

Permalink
Fix UDP Multicast writes. See netty#237
Browse files Browse the repository at this point in the history
  • Loading branch information
normanmaurer committed Apr 2, 2012
1 parent 9b90e31 commit b350e8d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;
Expand All @@ -29,7 +28,6 @@
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;
Expand Down Expand Up @@ -168,15 +166,6 @@ void setRawInterestOpsNow(int interestOps) {
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public ChannelFuture write(Object message, SocketAddress remoteAddress) {
if (remoteAddress == null || remoteAddress.equals(getRemoteAddress())) {
return super.write(message, null);
} else {
return super.write(message, remoteAddress);
return Channels.write(this, message, remoteAddress);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

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 {
Expand Down Expand Up @@ -82,4 +84,15 @@ protected boolean setClosed() {
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();
}
}

}

0 comments on commit b350e8d

Please sign in to comment.