Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server: Don't lock up if network connection drops
Regression introduced by 94d4718 Referring to the discussions at https://groups.google.com/g/turbovnc-users/c/NzoZq_mIuP0/m/znjQm-3uAQAJ and TigerVNC/tigervnc@a99d14d#r57748408 the overhauled congestion control algorithms (a0f5670, ffdb526, 9f31536) caused a regression whereby large framebuffer updates were sometimes not delivered in a timely manner over high-latency connections. My attempt to fix the regression (94d4718) caused another issue (#359) whereby Xvnc froze if the network connection dropped and a connected VNC viewer exited or disconnected before the network connection was restored (thus causing the TCP connection to become orphaned at the server end.) More specifically, the TigerVNC v1.9+ implementation of the congestion control algorithms treats an uncongested ETA of 0 and -1 as congested, but it only sets a deferred update timer if the ETA is >= 0. If congestion control is reset, due to an idle connection, before the deferred update can be sent, then the update is effectively dropped (spoiled.) 94d4718 modified the algorithms so that an uncongested ETA of 0 or -1 was treated as uncongested, but when the network connection dropped, that caused the dropped connection to be treated as uncongested rather than congested. Thus, the TurboVNC Server attempted to send framebuffer updates through the dropped connection, which quickly filled the TCP buffers and caused write()/SSL_write() to block. When the VNC viewer disconnected or exited, the TCP connection became orphaned at the server end, so write()/SSL_write() continued to block when the network connection was restored. The orphaned TCP connection was eventually disconnected, usually after many minutes, but Xvnc could not do anything else in the meantime. Fixes #359
- Loading branch information