Cleaned up Kryo names + exceptions
This commit is contained in:
parent
7b74a730ba
commit
a52c67671d
|
@ -26,8 +26,8 @@ import org.slf4j.Logger;
|
||||||
|
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
import dorkbox.network.connection.registration.Registration;
|
import dorkbox.network.connection.registration.Registration;
|
||||||
import dorkbox.network.pipeline.tcp.KryoEncoder;
|
import dorkbox.network.pipeline.tcp.KryoEncoderTcp;
|
||||||
import dorkbox.network.pipeline.tcp.KryoEncoderCrypto;
|
import dorkbox.network.pipeline.tcp.KryoEncoderTcpCrypto;
|
||||||
import dorkbox.network.pipeline.udp.KryoDecoderUdp;
|
import dorkbox.network.pipeline.udp.KryoDecoderUdp;
|
||||||
import dorkbox.network.pipeline.udp.KryoDecoderUdpCrypto;
|
import dorkbox.network.pipeline.udp.KryoDecoderUdpCrypto;
|
||||||
import dorkbox.network.pipeline.udp.KryoEncoderUdp;
|
import dorkbox.network.pipeline.udp.KryoEncoderUdp;
|
||||||
|
@ -52,8 +52,8 @@ class RegistrationWrapper {
|
||||||
|
|
||||||
private final org.slf4j.Logger logger;
|
private final org.slf4j.Logger logger;
|
||||||
|
|
||||||
public final KryoEncoder kryoTcpEncoder;
|
public final KryoEncoderTcp kryoTcpEncoder;
|
||||||
public final KryoEncoderCrypto kryoTcpEncoderCrypto;
|
public final KryoEncoderTcpCrypto kryoTcpEncoderCrypto;
|
||||||
|
|
||||||
public final KryoEncoderUdp kryoUdpEncoder;
|
public final KryoEncoderUdp kryoUdpEncoder;
|
||||||
public final KryoEncoderUdpCrypto kryoUdpEncoderCrypto;
|
public final KryoEncoderUdpCrypto kryoUdpEncoderCrypto;
|
||||||
|
@ -71,8 +71,8 @@ class RegistrationWrapper {
|
||||||
this.endPoint = endPoint;
|
this.endPoint = endPoint;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
|
||||||
this.kryoTcpEncoder = new KryoEncoder(endPoint.serializationManager);
|
this.kryoTcpEncoder = new KryoEncoderTcp(endPoint.serializationManager);
|
||||||
this.kryoTcpEncoderCrypto = new KryoEncoderCrypto(endPoint.serializationManager);
|
this.kryoTcpEncoderCrypto = new KryoEncoderTcpCrypto(endPoint.serializationManager);
|
||||||
|
|
||||||
|
|
||||||
this.kryoUdpEncoder = new KryoEncoderUdp(endPoint.serializationManager);
|
this.kryoUdpEncoder = new KryoEncoderUdp(endPoint.serializationManager);
|
||||||
|
|
|
@ -30,8 +30,8 @@ import dorkbox.network.connection.registration.ConnectionRegistrationImpl;
|
||||||
import dorkbox.network.connection.registration.MetaChannel;
|
import dorkbox.network.connection.registration.MetaChannel;
|
||||||
import dorkbox.network.connection.registration.Registration;
|
import dorkbox.network.connection.registration.Registration;
|
||||||
import dorkbox.network.connection.registration.RegistrationHandler;
|
import dorkbox.network.connection.registration.RegistrationHandler;
|
||||||
import dorkbox.network.pipeline.tcp.KryoDecoder;
|
import dorkbox.network.pipeline.tcp.KryoDecoderTcp;
|
||||||
import dorkbox.network.pipeline.tcp.KryoDecoderCrypto;
|
import dorkbox.network.pipeline.tcp.KryoDecoderTcpCrypto;
|
||||||
import dorkbox.network.serialization.NetworkSerializationManager;
|
import dorkbox.network.serialization.NetworkSerializationManager;
|
||||||
import dorkbox.util.crypto.CryptoECC;
|
import dorkbox.util.crypto.CryptoECC;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
@ -99,7 +99,7 @@ class RegistrationRemoteHandler extends RegistrationHandler {
|
||||||
// DECODE (or upstream)
|
// DECODE (or upstream)
|
||||||
///////////////////////
|
///////////////////////
|
||||||
pipeline.addFirst(FRAME_AND_KRYO_DECODER,
|
pipeline.addFirst(FRAME_AND_KRYO_DECODER,
|
||||||
new KryoDecoder(this.serializationManager)); // cannot be shared because of possible fragmentation.
|
new KryoDecoderTcp(this.serializationManager)); // cannot be shared because of possible fragmentation.
|
||||||
}
|
}
|
||||||
else if (isUdpChannel) {
|
else if (isUdpChannel) {
|
||||||
// can be shared because there cannot be fragmentation for our UDP packets. If there is, we throw an error and continue...
|
// can be shared because there cannot be fragmentation for our UDP packets. If there is, we throw an error and continue...
|
||||||
|
@ -230,7 +230,7 @@ class RegistrationRemoteHandler extends RegistrationHandler {
|
||||||
if (metaChannel.tcpChannel == channel) {
|
if (metaChannel.tcpChannel == channel) {
|
||||||
pipeline.replace(FRAME_AND_KRYO_DECODER,
|
pipeline.replace(FRAME_AND_KRYO_DECODER,
|
||||||
FRAME_AND_KRYO_CRYPTO_DECODER,
|
FRAME_AND_KRYO_CRYPTO_DECODER,
|
||||||
new KryoDecoderCrypto(this.serializationManager)); // cannot be shared because of possible fragmentation.
|
new KryoDecoderTcpCrypto(this.serializationManager)); // cannot be shared because of possible fragmentation.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaChannel.udpChannel == channel) {
|
if (metaChannel.udpChannel == channel) {
|
||||||
|
|
|
@ -25,16 +25,15 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||||
|
|
||||||
public
|
public
|
||||||
class KryoDecoder extends ByteToMessageDecoder {
|
class KryoDecoderTcp extends ByteToMessageDecoder {
|
||||||
private final NetworkSerializationManager serializationManager;
|
private final NetworkSerializationManager serializationManager;
|
||||||
|
|
||||||
public
|
public
|
||||||
KryoDecoder(final NetworkSerializationManager serializationManager) {
|
KryoDecoderTcp(final NetworkSerializationManager serializationManager) {
|
||||||
super();
|
super();
|
||||||
this.serializationManager = serializationManager;
|
this.serializationManager = serializationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
protected
|
protected
|
||||||
Object readObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, ByteBuf in, int length) throws Exception {
|
Object readObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, ByteBuf in, int length) throws Exception {
|
||||||
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
||||||
|
@ -165,8 +164,8 @@ class KryoDecoder extends ByteToMessageDecoder {
|
||||||
try {
|
try {
|
||||||
object = readObject(serializationManager, context, in, length);
|
object = readObject(serializationManager, context, in, length);
|
||||||
out.add(object);
|
out.add(object);
|
||||||
} catch (Exception ex) {
|
} catch (Exception e) {
|
||||||
context.fireExceptionCaught(new IOException("Unable to deserialize object for " + this.getClass(), ex));
|
context.fireExceptionCaught(new IOException("Unable to deserialize object!", e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
40
src/dorkbox/network/pipeline/tcp/KryoDecoderTcpCrypto.java
Normal file
40
src/dorkbox/network/pipeline/tcp/KryoDecoderTcpCrypto.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2018 dorkbox, llc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package dorkbox.network.pipeline.tcp;
|
||||||
|
|
||||||
|
import dorkbox.network.connection.Connection_;
|
||||||
|
import dorkbox.network.serialization.NetworkSerializationManager;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
|
|
||||||
|
// on client this is MessageToMessage (because of the UdpDecoder in the pipeline!)
|
||||||
|
|
||||||
|
public
|
||||||
|
class KryoDecoderTcpCrypto extends KryoDecoderTcp {
|
||||||
|
|
||||||
|
public
|
||||||
|
KryoDecoderTcpCrypto(final NetworkSerializationManager serializationManager) {
|
||||||
|
super(serializationManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected
|
||||||
|
Object readObject(final NetworkSerializationManager serializationManager,
|
||||||
|
final ChannelHandlerContext context, final ByteBuf in, final int length) throws Exception {
|
||||||
|
Connection_ connection = (Connection_) context.pipeline().last();
|
||||||
|
return serializationManager.readWithCrypto(connection, in, length);
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,20 +26,19 @@ import io.netty.handler.codec.MessageToByteEncoder;
|
||||||
|
|
||||||
@Sharable
|
@Sharable
|
||||||
public
|
public
|
||||||
class KryoEncoder extends MessageToByteEncoder<Object> {
|
class KryoEncoderTcp extends MessageToByteEncoder<Object> {
|
||||||
// maximum size of length field. Un-optimized will always be 4, but optimized version can take from 1 - 4 (for 0-Integer.MAX_VALUE).
|
// maximum size of length field. Un-optimized will always be 4, but optimized version can take from 1 - 4 (for 0-Integer.MAX_VALUE).
|
||||||
private static final int reservedLengthIndex = 4;
|
private static final int reservedLengthIndex = 4;
|
||||||
private final NetworkSerializationManager serializationManager;
|
private final NetworkSerializationManager serializationManager;
|
||||||
|
|
||||||
// When this is a UDP encode, there are ALREADY size limits placed on the buffer, so any extra checks are unnecessary
|
// When this is a UDP encode, there are ALREADY size limits placed on the buffer, so any extra checks are unnecessary
|
||||||
public
|
public
|
||||||
KryoEncoder(final NetworkSerializationManager serializationManager) {
|
KryoEncoderTcp(final NetworkSerializationManager serializationManager) {
|
||||||
super(true); // just use direct buffers anyways. When using Heap buffers, they because chunked and the backing array is invalid.
|
super(true); // just use direct buffers anyways. When using Heap buffers, they because chunked and the backing array is invalid.
|
||||||
this.serializationManager = serializationManager;
|
this.serializationManager = serializationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the crypto writer will override this
|
// the crypto writer will override this
|
||||||
@SuppressWarnings("unused")
|
|
||||||
protected
|
protected
|
||||||
void writeObject(final NetworkSerializationManager kryoWrapper,
|
void writeObject(final NetworkSerializationManager kryoWrapper,
|
||||||
final ChannelHandlerContext context,
|
final ChannelHandlerContext context,
|
||||||
|
@ -52,16 +51,16 @@ class KryoEncoder extends MessageToByteEncoder<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected
|
protected
|
||||||
void encode(final ChannelHandlerContext context, final Object msg, final ByteBuf out) throws Exception {
|
void encode(final ChannelHandlerContext context, final Object message, final ByteBuf out) throws Exception {
|
||||||
// we don't necessarily start at 0!!
|
// we don't necessarily start at 0!!
|
||||||
// START at index = 4. This is to make room for the integer placed by the frameEncoder for TCP.
|
// START at index = 4. This is to make room for the integer placed by the frameEncoder for TCP.
|
||||||
int startIndex = out.writerIndex() + reservedLengthIndex;
|
int startIndex = out.writerIndex() + reservedLengthIndex;
|
||||||
|
|
||||||
if (msg != null) {
|
if (message != null) {
|
||||||
out.writerIndex(startIndex);
|
out.writerIndex(startIndex);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
writeObject(this.serializationManager, context, msg, out);
|
writeObject(this.serializationManager, context, message, out);
|
||||||
int index = out.writerIndex();
|
int index = out.writerIndex();
|
||||||
|
|
||||||
// now set the frame length
|
// now set the frame length
|
||||||
|
@ -80,8 +79,8 @@ class KryoEncoder extends MessageToByteEncoder<Object> {
|
||||||
|
|
||||||
// newIndex is actually where we want to start reading the data as well when written to the socket
|
// newIndex is actually where we want to start reading the data as well when written to the socket
|
||||||
out.setIndex(indexForLength, index);
|
out.setIndex(indexForLength, index);
|
||||||
} catch (Exception ex) {
|
} catch (Exception e) {
|
||||||
context.fireExceptionCaught(new IOException("Unable to serialize object of type: " + msg.getClass().getName(), ex));
|
context.fireExceptionCaught(new IOException("Unable to serialize object of type: " + message.getClass().getName(), e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,22 +25,18 @@ import io.netty.channel.ChannelHandlerContext;
|
||||||
|
|
||||||
@Sharable
|
@Sharable
|
||||||
public
|
public
|
||||||
class KryoEncoderCrypto extends KryoEncoder {
|
class KryoEncoderTcpCrypto extends KryoEncoderTcp {
|
||||||
|
|
||||||
public
|
public
|
||||||
KryoEncoderCrypto(final NetworkSerializationManager serializationManager) {
|
KryoEncoderTcpCrypto(final NetworkSerializationManager serializationManager) {
|
||||||
super(serializationManager);
|
super(serializationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected
|
protected
|
||||||
void writeObject(final NetworkSerializationManager serializationManager,
|
void writeObject(final NetworkSerializationManager serializationManager,
|
||||||
final ChannelHandlerContext context,
|
final ChannelHandlerContext context, final Object msg, final ByteBuf buffer) throws IOException {
|
||||||
final Object msg,
|
Connection_ connection = (Connection_) context.pipeline().last();
|
||||||
final ByteBuf buffer) throws IOException {
|
|
||||||
|
|
||||||
Connection_ connection = (Connection_) context.pipeline()
|
|
||||||
.last();
|
|
||||||
serializationManager.writeWithCrypto(connection, buffer, msg);
|
serializationManager.writeWithCrypto(connection, buffer, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,8 +18,6 @@ package dorkbox.network.pipeline.udp;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import dorkbox.network.serialization.NetworkSerializationManager;
|
import dorkbox.network.serialization.NetworkSerializationManager;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.AddressedEnvelope;
|
import io.netty.channel.AddressedEnvelope;
|
||||||
|
@ -40,6 +38,12 @@ class KryoDecoderUdp extends MessageToMessageDecoder<Object> {
|
||||||
this.serializationManager = serializationManager;
|
this.serializationManager = serializationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected
|
||||||
|
Object readObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, ByteBuf in, int length) throws Exception {
|
||||||
|
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
||||||
|
return serializationManager.read(in, length);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public
|
public
|
||||||
boolean acceptInboundMessage(final Object msg) throws Exception {
|
boolean acceptInboundMessage(final Object msg) throws Exception {
|
||||||
|
@ -76,14 +80,9 @@ class KryoDecoderUdp extends MessageToMessageDecoder<Object> {
|
||||||
ByteBuf data = (ByteBuf) ((AddressedEnvelope) message).content();
|
ByteBuf data = (ByteBuf) ((AddressedEnvelope) message).content();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
out.add(readObject(serializationManager, context, data, data.writerIndex()));
|
||||||
Object object = serializationManager.read(data, data.writerIndex());
|
|
||||||
out.add(object);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
String msg = "Unable to deserialize object";
|
context.fireExceptionCaught(new IOException("Unable to deserialize object!", e));
|
||||||
LoggerFactory.getLogger(this.getClass())
|
|
||||||
.error(msg, e);
|
|
||||||
throw new IOException(msg, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,71 +15,24 @@
|
||||||
*/
|
*/
|
||||||
package dorkbox.network.pipeline.udp;
|
package dorkbox.network.pipeline.udp;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import dorkbox.network.connection.Connection_;
|
import dorkbox.network.connection.Connection_;
|
||||||
import dorkbox.network.serialization.NetworkSerializationManager;
|
import dorkbox.network.serialization.NetworkSerializationManager;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandler.Sharable;
|
import io.netty.channel.ChannelHandler.Sharable;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.socket.DatagramPacket;
|
|
||||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
|
||||||
import io.netty.handler.timeout.IdleState;
|
|
||||||
import io.netty.handler.timeout.IdleStateEvent;
|
|
||||||
|
|
||||||
@Sharable
|
@Sharable
|
||||||
public
|
public
|
||||||
class KryoDecoderUdpCrypto extends MessageToMessageDecoder<DatagramPacket> {
|
class KryoDecoderUdpCrypto extends KryoDecoderUdp {
|
||||||
|
|
||||||
private final NetworkSerializationManager serializationManager;
|
|
||||||
|
|
||||||
public
|
public
|
||||||
KryoDecoderUdpCrypto(NetworkSerializationManager serializationManager) {
|
KryoDecoderUdpCrypto(NetworkSerializationManager serializationManager) {
|
||||||
this.serializationManager = serializationManager;
|
super(serializationManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected
|
||||||
* Invoked when a {@link Channel} has been idle for a while.
|
Object readObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, ByteBuf in, int length) throws Exception {
|
||||||
*/
|
Connection_ connection = (Connection_) context.pipeline().last();
|
||||||
@Override
|
return serializationManager.readWithCrypto(connection, in, length);
|
||||||
public
|
|
||||||
void userEventTriggered(ChannelHandlerContext context, Object event) throws Exception {
|
|
||||||
// if (e.getState() == IdleState.READER_IDLE) {
|
|
||||||
// e.getChannel().close();
|
|
||||||
// } else if (e.getState() == IdleState.WRITER_IDLE) {
|
|
||||||
// e.getChannel().write(new Object());
|
|
||||||
// } else
|
|
||||||
if (event instanceof IdleStateEvent) {
|
|
||||||
if (((IdleStateEvent) event).state() == IdleState.ALL_IDLE) {
|
|
||||||
// will auto-flush if necessary
|
|
||||||
// TODO: if we have been idle TOO LONG, then we close this channel!
|
|
||||||
// if we are idle for a much smaller amount of time, then we pass the idle message up to the connection?
|
|
||||||
|
|
||||||
// this.sessionManager.onIdle(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.userEventTriggered(context, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public
|
|
||||||
void decode(ChannelHandlerContext context, DatagramPacket in, List<Object> out) throws Exception {
|
|
||||||
try {
|
|
||||||
Connection_ last = (Connection_) context.pipeline()
|
|
||||||
.last();
|
|
||||||
ByteBuf data = in.content();
|
|
||||||
Object object = serializationManager.readWithCrypto(last, data, data.readableBytes());
|
|
||||||
out.add(object);
|
|
||||||
} catch (IOException e) {
|
|
||||||
String message = "Unable to deserialize object";
|
|
||||||
LoggerFactory.getLogger(this.getClass())
|
|
||||||
.error(message, e);
|
|
||||||
throw new IOException(message, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,13 @@ class KryoEncoderUdp extends MessageToMessageEncoder<Object> {
|
||||||
this.serializationManager = serializationManager;
|
this.serializationManager = serializationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the crypto writer will override this
|
||||||
|
protected
|
||||||
|
void writeObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, Object msg, ByteBuf buffer) throws IOException {
|
||||||
|
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
||||||
|
serializationManager.write(buffer, msg);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected
|
protected
|
||||||
void encode(ChannelHandlerContext context, Object message, List<Object> out) throws Exception {
|
void encode(ChannelHandlerContext context, Object message, List<Object> out) throws Exception {
|
||||||
|
@ -70,18 +77,8 @@ class KryoEncoderUdp extends MessageToMessageEncoder<Object> {
|
||||||
.remoteAddress());
|
.remoteAddress());
|
||||||
out.add(packet);
|
out.add(packet);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String msg = "Unable to serialize object of type: " + message.getClass()
|
context.fireExceptionCaught(new IOException("Unable to serialize object of type: " + message.getClass().getName(), e));
|
||||||
.getName();
|
|
||||||
LoggerFactory.getLogger(this.getClass())
|
|
||||||
.error(msg, e);
|
|
||||||
throw new IOException(msg, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the crypto writer will override this
|
|
||||||
void writeObject(NetworkSerializationManager serializationManager, ChannelHandlerContext context, Object msg, ByteBuf buffer) throws IOException {
|
|
||||||
// no connection here because we haven't created one yet. When we do, we replace this handler with a new one.
|
|
||||||
serializationManager.write(buffer, msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,9 @@ class KryoEncoderUdpCrypto extends KryoEncoderUdp {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
protected
|
||||||
void writeObject(NetworkSerializationManager serializationManager, ChannelHandlerContext ctx, Object msg, ByteBuf buffer) throws IOException {
|
void writeObject(NetworkSerializationManager serializationManager, ChannelHandlerContext ctx, Object msg, ByteBuf buffer) throws IOException {
|
||||||
|
Connection_ last = (Connection_) ctx.pipeline().last();
|
||||||
Connection_ last = (Connection_) ctx.pipeline()
|
|
||||||
.last();
|
|
||||||
serializationManager.writeWithCrypto(last, buffer, msg);
|
serializationManager.writeWithCrypto(last, buffer, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user