Tigthen access + javadocs on a few netty related classes.
This commit is contained in:
parent
e18fe49cf9
commit
9ad9003974
@ -4,19 +4,14 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.MultithreadEventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@ -44,8 +39,6 @@ import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import net.md_5.bungee.command.*;
|
||||
import net.md_5.bungee.config.YamlConfig;
|
||||
import net.md_5.bungee.netty.ChannelBootstrapper;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PacketDecoder;
|
||||
import net.md_5.bungee.packet.DefinedPacket;
|
||||
import net.md_5.bungee.packet.PacketFAPluginMessage;
|
||||
|
||||
|
@ -8,8 +8,10 @@ import javax.crypto.ShortBufferException;
|
||||
|
||||
/**
|
||||
* This class is a complete solution for encrypting and decoding bytes in a
|
||||
* Netty stream. It takes two {@link BufferedBlockCipher} instances, used for
|
||||
* encryption and decryption respectively.
|
||||
* Netty stream. It takes two {@link Cipher} instances, used for encryption and
|
||||
* decryption respectively. As newer Netty versions never use a heap
|
||||
* {@link ByteBuf} for writing to the channel, this class will always create one
|
||||
* for temporary usage.
|
||||
*/
|
||||
public class CipherCodec extends ByteToByteCodec
|
||||
{
|
||||
@ -69,6 +71,7 @@ public class CipherCodec extends ByteToByteCodec
|
||||
{
|
||||
out.capacity( outputSize );
|
||||
}
|
||||
// TODO: Try and make this use out.nioBuffer()
|
||||
int processed = cipher.update( in.array(), in.arrayOffset() + in.readerIndex(), available, out.array(), out.arrayOffset() + out.writerIndex() );
|
||||
in.readerIndex( in.readerIndex() + processed );
|
||||
out.writerIndex( out.writerIndex() + processed );
|
||||
|
@ -7,7 +7,12 @@ import io.netty.channel.ChannelInboundMessageHandlerAdapter;
|
||||
import net.md_5.bungee.packet.DefinedPacket;
|
||||
import net.md_5.bungee.packet.PacketHandler;
|
||||
|
||||
public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<ByteBuf>
|
||||
/**
|
||||
* This class is a primitive wrapper for {@link PacketHandler} instances tied to
|
||||
* channels to maintain simple states, and only call the required, adapted
|
||||
* methods when the channel is connected.
|
||||
*/
|
||||
class HandlerBoss extends ChannelInboundMessageHandlerAdapter<ByteBuf>
|
||||
{
|
||||
|
||||
private PacketHandler handler;
|
||||
|
@ -8,6 +8,14 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.md_5.bungee.protocol.netty.PacketReader;
|
||||
|
||||
/**
|
||||
* This class will attempt to read a packet from {@link PacketReader}, with the
|
||||
* specified {@link #protocol} before returning a new {@link ByteBuf} with the
|
||||
* copied contents of all bytes read in this frame.
|
||||
* <p/>
|
||||
* It is based on {@link ReplayingDecoder} so that packets will only be returned
|
||||
* when all needed data is present.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class PacketDecoder extends ReplayingDecoder<ByteBuf>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user