rewrite: add mDNS registration
fix potential deadlock while shutting down