This specifically seems to happen when my network extension is spawned by launchd
, but has not actually been connected. (That is my conclusion based on the evidence: ps
shows the process existing, but the logs show that main()
hasn't run yet, let alone the proxy provider's init()
. Without being able to debug launchd, I would say the situation is that launchd has said "yes this XPC port exists, when you try to connect to it I will send it on over to the extension, and thereafter you two will happily communicate directly," but the process hasn't gotten around to accepting XPC connections.) This seems to be most likely to happen when the extension crashes, or I kill -9
it to see how it handles respawning.
I have a little CLI tool that talks (over XPC, of course) to the extension, mainly to say "Hi are you alive?" If the extension is not loaded, the XPC connection fails, as expected, and my tool says "NOT YET." If it is loaded and running, the XPC connection succeeds, as expected, and I get back a response of true
.
So my first question is: is this expected behaviour?
My second question is: is there a way to do an XPC connection with a timeout?