Describe The Bug:
When removing the advertisement for a ciao service immediately after advertising it, it may result in a race condition.
It seems like the Prober isn't properly canceled (or rather started after the service advertisement has already been ended).
Therefore the Prober accesses an already closed MDNSServer.
To Reproduce:
- Create a CiaoService
service.
- Call
service.advertise()
- Call
service.destroy() or service()
Expected behavior:
The Responder should not start a probing step when the service was already unannounced.
Logs:
The reported error is as follows:
Cannot send packets on a closed mdns server!
ERR_SERVER_CLOSED: Cannot send packets on a closed mdns server!
at MDNSServer.assertBeforeSend (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:403:13)
at MDNSServer.sendOnAllNetworksForService (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:302:10)
at MDNSServer.sendQueryBroadcast (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/MDNSServer.ts:263:26)
at Prober.sendProbeRequest (/Users/andi/Documents/WebstormProjects/HAP-NodeJS/node_modules/@homebridge/ciao/src/responder/Prober.ts:165:17)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
Environment:
- Node.js Version: v17.0.1
- NPM Version: 8.1.0
- Ciao Version: 1.1.3
- Operating System: macOS
Describe The Bug:
When removing the advertisement for a ciao service immediately after advertising it, it may result in a race condition.
It seems like the Prober isn't properly canceled (or rather started after the service advertisement has already been ended).
Therefore the Prober accesses an already closed
MDNSServer.To Reproduce:
service.service.advertise()service.destroy()orservice()Expected behavior:
The Responder should not start a probing step when the service was already unannounced.
Logs:
The reported error is as follows:
Environment: