assaabloy-ppi / salt-channel

The specification and the reference implementation of Salt Channel - a simple, light-weight secure channel protocol based on TweetNaCl by Bernstein.
MIT License
14 stars 11 forks source link

To consider: ByteChannel.available() #10

Closed franslundberg closed 6 years ago

franslundberg commented 7 years ago

Current ByteChannel interface does not allow a peer to determine whether there are multiple application messages available. Could be useful, for example, if the server wants to handle a set of request from the client in a batch fashion and return the result from multiple request in a single MultiAppPacket.

We could add this method to ByteChannel:

public int available();   
// returns number of buffered application message that are available.
// Use 0 if not know.

We could also change the read() method to return an array of byte array (or List).

Yet another approach is add a multiRead() method along the read() method. It would return multiple application messages.

franslundberg commented 6 years ago

Done! See ApplicationChannel.