directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <>
Subject Re: [mina] Problem with BlacklistFilter
Date Mon, 07 Nov 2005 20:34:24 GMT

I'm afraid it's not enough to block sessionCreated() and
messageReceived(). I think all IoFilter methods except init() and
destroy(), filterWrite(), filterClose() and maybe exceptionCaught() will
have to be intercepted by BlacklistFilter and checked against the blacklist.

It would be nice if there are always consistency in what order the
IoHandler callbacks are called. E.g. sessionCreated is always called
first, then sessionOpened, then 0 or more messageReceived/messageSent
followed by sessionClosed. If only sessionCreated is blocked,
sessionOpened could be called first which could lead to strange bugs if
the Mina user uses sessionCreated to allocate resources etc.


Trustin Lee wrote:

> Ah I see.  I'll fix that now.
> 2005/11/3, Niklas Therning <
> <>>:
>     I think the BlacklistFilter should implement all of the upstream
>     IoFilter callbacks, not just sessionCreated(), to prevent those events
>     to be propagated to the IoHandler. I have a situation where
>     messageReceived() is called in my IoHandler even if
>     BlacklistFilter has
>     blocked the client. I guess it's because it takes some time for the
>     CloseRequest to be picked up by SocketIoProcessor.
>     If we don't want to call BlacklistFilter.isBlocked(IoSession) for
>     every
>     upstream event we could instead add an attribute to the session in
>     BlacklistFilter.sessionCreated() which tells whether the connection is
>     blocked or not and use that attribute in all the other events.
>     WDYT?
>     /Niklas
> -- 
> what we call human nature is actually human habit
> --

Med vänlig hälsning

Niklas Therning
Software Architect
Mobil: +46 739 75 05 73

Trillian - Software Design at its best

View raw message