I had a case recently where a particular WinXP PC would almost always start
up the OpenSLPd service prior to bringing up the network interface
(presumably due to a slow DHCP server or something), which of course meant
that SLP queries on that network were not answered, since SLPD currently
only checks the interface list on startup.

So I fixed that.

The attached patch (against the OpenSLP 2.0 beta 2 release tarball) makes
the following changes to SLPD:
  * on the Linux side, sending SIGHUP to SLPD will result in it closing and
reopening the listening sockets (thereby adding or removing supported
interfaces as required), in addition to prior behaviour (reinitialising the
settings files and DA list).  Current outgoing connections and dynamic
registrations are unaffected, but there will be a brief period when the
server is unresponsive to new incoming queries from the network.
  * on the Windows side, it will interpret the SERVICE_CONTROL_PARAMCHANGE
command as an equivalent SIGHUP request.  (This provides a way to update the
config files semi-live, as on Linux.)
  * on the Windows side, it will also automatically ask Windows to notify it
of a change in the IP address table, and also treat that as a SIGHUP.
  * minor code tidy-ups and status reporting fixes.

Caveats:
  * this patch has only been tested on Windows (XP and 7); the changes
affecting the Linux side should be harmless (and beneficial) but I have not
verified that.
  * automatic detection of IPv6 address changes only works on Vista+, but
that should be ok as IPv6 generally doesn't work on XP anyway.
  * IPv6 detection has not been tested (all the networks I have access to
use only IPv4), but since the code is the same as for IPv4 it should work
fine.
  * the SIGHUP code may get triggered several times by one logical change
(presumably due to multiple internal changes); for example when a disabled
network interface is re-enabled it tends to run twice on XP and 3-4 times on
Win7 (note that different notification APIs are used on each).  While
inefficient this does not appear harmful, so I'm leaving it as is.  The
reinits are throttled by the main loop timeout, currently 1s.
  * the Linux side will not automatically detect IP address changes; code or
hook scripts to do the autodetection on Linux are left as an exercise for
some other intrepid soul.
  * this is my first foray into the OpenSLP codebase, so I may have missed
updating something necessary, or done something inefficiently -- but it
seems to be working ok so far.  I'm sure things could be improved though
(such as reinitialising only the listening sockets, not accepted sockets).

Attachment: openslp-hup.patch
Description: Binary data

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Openslp-devel mailing list
Openslp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-devel

Reply via email to