Hi Niklas, On 4/11/06, Niklas Therning <[EMAIL PROTECTED]> 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 think we can set a traffic mask in sessionCreated() because sessionCreated() runs in the same thread with the I/O processor. Trustin -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP key fingerprints: * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
