mirror of
https://github.com/Alexays/Waybar.git
synced 2026-08-18 11:07:06 +00:00
When sway's event-subscription send buffer overflows during an event flood, sway closes the client connection. The sway IPC event worker (SleeperThread running handleEvent -> recv) then threw on every iteration and the SleeperThread immediately re-invoked it, leaving the sway modules broken while busy-looping on a dead socket and pegging a CPU. Mirror the niri backend's reconnect loop: on a read/EOF/parse error from the event socket, close the old connection, back off for a couple of seconds (so we don't busy-spin), re-open the socket and replay the same subscriptions, then resume. A running_ flag set at the start of teardown makes the worker bail out cleanly instead of reconnecting to a socket that is being closed on purpose. The IPC message protocol and event parsing are unchanged. Fixes #3166.