Naga 3.0

31 views
Skip to first unread message

Nuoji

unread,
Mar 7, 2011, 8:35:40 AM3/7/11
to Naga Users
Hi everyone,

Just letting you know that I'm hard at work on a 3.0 release. It's
going to break the existing interfaces somewhat:

1. The PacketReader and PacketWriter interfaces have been vastly
simplified down to one method each:
PacketReader#nextPacket(ByteBuffer) and
PacketWriter#write(ByteBuffer[])

- The packet reader method should take the contents of the ByteBuffer
and create a byte[]. If there isn't enough data, the ByteBuffer needs
to be returned in the same state it originally was in.

- The packet writer method takes an array of ByteBuffer and transforms
them into another array of ByteBuffer.

You can looks at the source for the basic packets and also the
CipherPacketReader/CipherPacketWriter pair which wraps decryption/
encryption for a stream.

I considered making these work with InputStream/OutputStream, but it
turned out to be just as complicated and a lot less efficient than the
solution I ended up with.


2. SocketObserver will gain the method "packetWritten(NIOSocket,
Object)" which can be used to monitor when a packet is completely
sent. An additional method NIOSocket#write(byte[], Object) has been
added to set the "tag" returned in packetWritten.


Other than that, NIOService is slightly redesigned and keeps an IO
buffer which limits the largest possible packet that can be read. This
value defaults to 64kb.


Finally, I've also added SSL support. Consider it alpha
functionality.

Everything is in SVN already so you can check it out and build it. I'm
very grateful for any bug reports.

I'm going to play around with the lib for a while until I feed fairly
confident it is stable. I won't post a ready-to-use jar until then.


/Christoffer
Reply all
Reply to author
Forward
0 new messages