From 8dfd8e52f202ccf41389d87f8ad8df47f8d7430e Mon Sep 17 00:00:00 2001 From: singhharsh1708 Date: Wed, 18 Nov 2026 23:43:45 +0530 Subject: [PATCH] fix: wait half a second, not half a millisecond, for a vnc update --- src/zm_libvnc_camera.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/zm_libvnc_camera.cpp b/src/zm_libvnc_camera.cpp index 856a3443b5..a37fe1bdd7 100644 --- a/src/zm_libvnc_camera.cpp +++ b/src/zm_libvnc_camera.cpp @@ -1,6 +1,7 @@ #include "zm_libvnc_camera.h" #include "zm_packet.h" +#include "zm_signal.h" #include #if HAVE_LIBVNC @@ -203,9 +204,13 @@ int VncCamera::PrimeCapture() { } int VncCamera::PreCapture() { - int rc = (*WaitForMessage_f)(mRfb, 500); + // The timeout is in microseconds: wait up to half a second for an update. + int rc = (*WaitForMessage_f)(mRfb, 500000); + // Any handled signal (stop, reload, or the logger's WINCH/USR1/USR2) interrupts + // the wait; poll once more so only a real socket error is a failure. + if (rc < 0 and !zm_terminate and !zm_reload) rc = (*WaitForMessage_f)(mRfb, 0); if (rc < 0) { - return -1; + return (zm_terminate or zm_reload) ? 0 : -1; } else if (!rc) { return rc; }