public void handleSerializedLispBuffer(TransportAddress address, ByteBuffer outBuffer,
final MessageType packetType) {
InetAddress ip = getInetAddress(address);
- handleSerializedLispBuffer(ip, outBuffer, packetType, address.getPort().getValue());
+ handleSerializedLispBuffer(ip, outBuffer, packetType, address.getPort().getValue(), null);
}
public void handleSerializedLispBuffer(InetAddress address, ByteBuffer outBuffer,
- final MessageType packetType, final int portNumber) {
+ final MessageType packetType, final int portNumber, Channel senderChannel) {
+ if (senderChannel == null) {
+ senderChannel = this.channel;
+ }
InetSocketAddress recipient = new InetSocketAddress(address, portNumber);
outBuffer.position(0);
ByteBuf data = wrappedBuffer(outBuffer);
if (LOG.isTraceEnabled()) {
LOG.trace("Buffer:\n{}", ByteBufUtil.prettyHexDump(data));
}
- channel.write(packet).addListener(new ChannelFutureListener() {
+ senderChannel.write(packet).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
if (future.isSuccess()) {
}
}
});
- channel.flush();
+ senderChannel.flush();
}
private InetAddress getInetAddress(TransportAddress address) {
package org.opendaylight.lispflowmapping.southbound.lisp;
import io.netty.buffer.ByteBufUtil;
+import io.netty.channel.Channel;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
private DataStoreBackEnd dsbe;
private boolean isReadFromChannelEnabled = true;
+ private Channel channel;
+
public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
this.lispSbPlugin = lispSbPlugin;
}
outBuffer = calculateAndSetNewMAC(outBuffer, mapRegisterValue.getMappingAuthkey().getKeyString());
}
outBuffer.position(0);
- lispSbPlugin.handleSerializedLispBuffer(inetAddress, outBuffer, MessageType.MapNotify, portNumber);
+ lispSbPlugin.handleSerializedLispBuffer(inetAddress, outBuffer, MessageType.MapNotify, portNumber,
+ this.channel);
} else {
LOG.error("Map-Register Cache: authentication succeeded, but can't find auth key for sending Map-Notify");
}
LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
}
+ this.channel = ctx.channel();
handlePacket(msg);
}
}
Mockito.eq(Inet4Address.getByAddress("0.0.0.0", new byte[]{0, 0, 0, 0})),
Mockito.eq(byteBuffer),
Mockito.eq(MessageType.MapNotify),
- Mockito.eq(0));
+ Mockito.eq(0),
+ Mockito.eq(null));
}
static void afterMapRegisterInvocationValidation(final NotificationPublishService mockedNotificationProvider, final