mod_posix: Move everything to util.startup
This allows greater control over the order of events.
Notably, the internal ordering between daemonization, initialization of
libunbound and setup of signal handling is sensitive.
libunbound starts a separate thread for processing DNS requests.
If this thread is started before signal handling has been set up, it
will not inherit the signal handlers and instead behave as it would have
before signal handlers were set up, i.e. cause the whole process to
immediately exit.
libunbound is usually initialized on the first DNS request, usually
triggered by an outgoing s2s connection attempt.
If daemonization happens before signals have been set up, signals may
not be processed at all.
# server supports contact subscription pre-approval (RFC 6121 3.4)
[Client] Alice
jid: preappove-a@localhost
password: password
[Client] Bob
jid: preapprove-b@localhost
password: password
---------
Alice connects
Alice sends:
<presence/>
Alice receives:
<presence/>
Alice sends:
<presence to="${Bob's JID}" type="subscribed"/>
Bob connects
Bob sends:
<iq type="get" id="roster1">
<query xmlns="jabber:iq:roster"/>
</iq>
Bob receives:
<iq type="result" id="roster1">
<query xmlns="jabber:iq:roster" ver="{scansion:any}">
</query>
</iq>
Bob sends:
<presence/>
Bob receives:
<presence from="${Bob's full JID}"/>
Bob sends:
<presence to="${Alice's JID}" type="subscribe" />
Bob receives:
<iq type='set' id='{scansion:any}'>
<query ver='1' xmlns='jabber:iq:roster'>
<item jid="${Alice's JID}" subscription='none' ask='subscribe' />
</query>
</iq>
Bob receives:
<presence from="${Alice's JID}" type="subscribed" />
Bob disconnects
Alice sends:
<iq type="get" id="roster1">
<query xmlns="jabber:iq:roster"/>
</iq>
Alice receives:
<iq type="result" id="roster1">
<query xmlns="jabber:iq:roster" ver="{scansion:any}">
<item jid="${Bob's JID}" subscription="from" />
</query>
</iq>
Alice disconnects
Bob disconnects