On 5/12/11 12:18 PM, Muhammad Ichsan wrote:
Hi
I use the following chain
1. text-delimiting-codec
2. XMessage-filter (converter byte-XMessage)
2. sign-in filter
3. high-level-filter 1
4. high-level-filter 2
Sign-in filter will not open session to higher filters unless it has
done sign-in with remote peer.
SignInFilter.sessionOpened(NextFilter nextFilter, IoSession session) {
// Since sign-in is required, do not call this:
nextFilter.sessionOpened(session);
sendSignInFirst();
}
SignInFilter.messageReceived {
// if sign in reply is received
if (signInReplyIsReceived())
nextFilter.sessionOpened(session);
}
The problem is this:
Remote peer never receive sign in message. Why this happens?
The session will be opened anyway. What you should do is to store a
state in the session, and send a message to the client when the sign-in
has not been done. Calling sessionOpened() in the messageReceived hs no
effect and does not send anything to the client. Do a session.write(
"You first have to sign it" ) instead (kind of)
--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com