I don't remember if the current message headers have a byte which designates which session they belong to. If they do, we should not worry about parsing messages that do not have trailing fields: on the sending side we make sure we send them atomically, and on the receiving side we just parse them and put on the ticker as usual, no other changes required.

when it comes to trailing fields however, we need to add the same designator byte to every chunk that we send (atomically) accross the network, otherwise there's no way to match the incoming packets with their sessions. On the receiving side we just keep a map that maps session_id -> CHIS. When a packet arrives and we see that it has a designator byte, we check whether there is such session id in the map. If not, we try to parse a message, if yes, we call the process() method of that respective CHIS. These CHISes will not need to internal buffers, because we're guaranteed atomicity of the arriving chunks; its the job of the CHIS consumer to then put those chunks together when reconstructing the trailing field. I don't think we need to worry about chunks arriving out of order either.

The only changes to CHIS that I can think of is making sure that its locking is not on the CH's accumulator but on an object that is different for each session. Also, we'll need to move the processing of trailing fields out of innerProcess() and into CHIS.process(), so that each chis will process the chunks that belong to it.

Issues for further thought: closing the session without closing the link, etc.

_______________________________________________
devl mailing list
[EMAIL PROTECTED]
http://hawk.freenetproject.org:8080/cgi-bin/mailman/listinfo/devl

Reply via email to