Finally I found the time for an update on what I did in the past
full-immersion weekend on the jSPF branch.
I refactored most of the code and did most of the refactoring needed for
asynchronous support but I still have to integrate dnsjnio and to take
care of synchronizations/thread-safety issues.
SPF1Data now is SPFSession and contains the status of the current spf
lookup session.
A session has 2 stacks:
1) A stack of SPFChecker
2) A stack of SPFCheckerExceptionCatcher
The processing (SPFExecutor.execute) of an SPFSession is done this way:
a- take the last SPFChecker from the stack.
b- if found then execute it
c- if it returns a DNSLookupContinuation
c1- take care of the DNSLookup
c2- submit the result to the DNSLookupContinuation.getListener()
(SPFCheckerDNSResponseListener).
c3- if if returns a DNSLookupContinuation go to (c)
d- go to (a).
If during the execution of a checker (or a continuation) an exception is
thrown then the current exceptionCatcher is taken from the stack and
called to manage the exception. The catcher usually remove any checker
added to the stack after that specific recursion (catchers are used for
recursive calls like include/redirect) and decide how to handle the
exception.
A special mention goes to macro expansion: there is only one macro that
needs a dns lookup and it is used to retrieve the client hostname.
I managed with this pattern:
1) try to expand
2) if the result is null then it means that the client hostname was
needed in the expansion.
2b) return the DNSLookupContinuation for the client hostname
2c) try again to expand (this time it must work)
The whole thing is much more complicate than previously mainly because
of manual management of the stack and associated try/catch blocks to
"simulate" continuation support, but I tried to isolate as much as
possible the "complexity" by reusing the same pattern everywhere.
The only alternative I found to this complexity is the use of bytecode
manipulation is a similar way to continuation support in Jetty, but such
a solution was out of my available timeframe.
Next step: implement a dnsjnio based resolver and make it work for real ;-)
Stefano
Stefano Bagnara ha scritto:
Hi all,
I'm studying how to integrate dnsjnio [1] into jSPF to enable
asynchronous lookup for spf records.
I plan to start a branch in jSPF for this as soon as I'll have the time
to play with it a bit more.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]