mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
This prevents a race condition: 1. Try to connect a websocket 2. DNS lookup starts 3. JS causes the websocket to no longer be alive, and it is GCed 4. websocket_close() is called, but it doesn't find a websocket with that websocket_id, so nothing happens 5. DNS lookup completes, and opens the websocket 6. This websocket never gets closed By separately tracking which websockets we are trying to connect, we can record the fact we tried to close it, and then the DNS lookup callback can skip creating the now-unwanted websocket.