Repository navigation
OMT Mini 0.8.2
Rebuilds the control panel's server around not being able to wedge. Required if you are on 0.8.0 or 0.8.1.
Why it still froze
The 0.8.1 fix stopped the socket thread walking the window list, but left the rest of the design in place, and the rest of the design was the problem.
- A thread per connection, detached. Nothing waited for them, so one could outlive the server and touch its lock afterwards. A browser opens several connections at once, plus speculative ones that send nothing at all.
- Thread creation throws. Nothing caught it, so failing to create one would have taken the process down outright.
- Accept blocked, and was interrupted by closing the socket underneath it.
- Nothing capped connections.
- The whole state document was rebuilt per request, per client.
What it is now
A single non-blocking loop. One thread total, no detached threads, so stopping is a flag and a join.
Everything is bounded: 24 connections, 64 KB per request, 128 queued commands, and a deadline on every connection, so nothing a client does can make it grow.
The state document is built once on the interface thread, however many browsers are watching, and the loop only copies a string. Neither the loop nor the responder can reach a window at all, which is checked rather than assumed.
Geometry arriving from a browser is clamped before anything is asked of a window. It must never be trusted to be sensible.
The page is steadier too
- It never redraws while you are dragging, so the layout cannot be rebuilt under your hand
- It skips the redraw entirely when nothing has changed, instead of rebuilding every frame
- Every request has a timeout, so a stalled one cannot wedge the page
- It backs off when the other end stops answering, rather than hammering it
- It does not send a move at all when nothing actually moved