net_server: Run DHCP negotiation on a separate thread to fix hangs.

Previously we ran DHCP negotiation on the looper thread. This meant
that we just blocked it for long periods of time, which stopped
configuration settings changes from working properly, and causing
the Network preferences panel to hang when net_server failed to
respond to its messages.

Now, we spawn a separate thread to do the real work on, and unlock
the looper around the recvfrom() with long timeouts. There's now a
kMsgAutoConfigureFailed that is sent when auto-configuration fails,
so that the AutoconfigLooper can fallback as before. Additionally,
the main NetServer class quits loopers for devices on any configuration
change, rather than deferring it unecessarily (and possibly wrongly, in
some cases.)

Fixes #18037. Probably fixes #17300 and may help with others.
This commit is contained in:
Augustin Cavalier
2025-11-27 14:30:54 -05:00
parent 2f598715f1
commit 39c7c29e69
8 changed files with 84 additions and 31 deletions
+1
View File
@@ -12,6 +12,7 @@
#define kNetServerSignature "application/x-vnd.haiku-net_server"
#define kMsgConfigureInterface 'COif'
#define kMsgAutoConfigureFailed 'COaf'
#define kMsgConfigureResolver 'COrs'
#define kMsgCountPersistentNetworks 'CPnw'
#define kMsgGetPersistentNetwork 'GPnw'