Hi all!

The last weeks I spent time on the following to be found ATM at
http://hg.petrovitsch.priv.at/olsrd-poll/ [0]. It is based on
http://gredler.at/hg/olsrd/rev/68455a7b4bfa:

Currently the inner loop works like:
- poll each file descriptor once and call a callback function to handle
  it.
- calculate the remaining time to the "pollrate" and nanosleep() that
  long.
But some of the work can be done immediately - mainly in the plugins,
but also in the core.

The main goal is to have a classic select() loop calling callbacks
immediately and - if necessary/useful/ - also call every "pollrate"
seconds similar to now - but without the polling-only select() before.
One obvious alternative is IMHO to let the various parts use simple
timers.

To achieve this we need a more flexible central event loop to allow
decoupling of long time actions (e.g. a slow browser over a slow
connection) from the rest.

The first step - the above patches do roughly:
We extend the central select() loop to get an additional select() for
file descriptors where the data will be handled immediately.
We do this via an additional callback function (as to not disturb the
current ones).
The caller must also specify, if he wants to be called on a possible
read and/or write on the "immediate" and/or the "pollrate" callback
function.
While we're at it, we add a "void *" which is passed back to the caller.
So the caller can actually register more than one instance on different
file descriptors and differentiate the instances via that pointer. E.g.
the httpinfo plugin is now able to really accept more than one client
connection at the same time.

The next steps:
- actually register a file descriptor for the new select() and make it
  work (as it hasn't been even tested yet).
  Some plugins like txtinfo or httpinfo are IMHO good candidates for
  this as they have no business with the "pollrate".
- look into the users in the core and see if it makes sense to move them
  in that direction.
- convert plugins

The relevant patches are from "Cleanup socket_parser.[ch]" to "Cleanup
net_olsr.[ch]". These have been (successfully) tested on Linux and
Win32.
So there may be problems in the BSD world but review, testing,
improvements, ... are always welcome, of course.

	Bernd

[0]: I didn't push it in Hannes' repo as I don't know ATM what's the
     release plans and the above is a somewhat larger change some will
     consider too risky ATM. Other than that I see no reason to not do
     it.
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services



