Great info! Please see in advance my comments / questions ...

Niklas Therning wrote:

Michael Bauroth wrote:

I would very interested in an explanation too (especially the
trafficmask and attachment handling). Hope you have the time to do so.


One problem with a tunneling proxy is that when a new client connects to
the proxy you want to prevent the client from sending any data until the
proxy has established a connection to the server. Otherwise you would
have to buffer up messages in ClientToProxyIoHandler.messageReceived()
until the proxy has conected to the server and then deliver the buffered
messages.

The session.setTrafficMask(TrafficMask.NONE) prevents any data to be
read from the underlying socket. Since the example does this immediately
as the session is created no buffering will be necessary (the OS will do
the buffering so we don't have to). Once the proxy has established a
connection to the server the traffic mask will be changed to allow for
any waiting data to be delivered.

I guess that this happens in overloaded sessionOpened method for the server side? So it is at the end an alternative approach for the methods pauseRead / resumeRead? Or can the Trafficmask handle more things?

Sessions can have an attachment. This is just something you can use to
associate an object with a session. MINA will never read or care about
the attachment. It's only there as a convenience for the developer using
MINA. In the example the attachment is used to associate the
client-to-proxy session with the proxy-to-server session and vice versa.

Just let me know if you have any further questions!

Regards,
Niklas

Last question: Yesterday I've written a request to the mailing list (topic "Implementation details"). Do you have eventually some more time to explain these topics too?

Best Regards
Michael

Reply via email to