Check to see if a timeout is expected
authorBill Lash <william.lash@gmail.com>
Thu, 29 Aug 2019 02:10:16 +0000 (21:10 -0500)
committerBill Lash <william.lash@gmail.com>
Thu, 29 Aug 2019 02:10:16 +0000 (21:10 -0500)
When a timeout keycode is received, make sure that it is expected,
otherwise a non-existent timeout routine may be called.

src/common/stream.c

index ce2ed5ca56f51e8958118c599092cd061fbcfd70..7bfffe123aff059fb8031d4a40ceb119b40a59f0 100644 (file)
@@ -255,9 +255,18 @@ continue_input:
 
     /* Handle timeouts */
 
-    if (key == ZC_TIME_OUT)
-       if (direct_call (routine) == 0)
-           goto continue_input;
+    /*
+     * Make sure that this is a real timeout, by checking
+     * that the requested timeout is not zero.  For the case
+     * of a recorded stream, it is possible that a timeout
+     * keystroke might be replayed.
+     */
+    if (timeout != 0)
+    {
+       if (key == ZC_TIME_OUT)
+           if (direct_call (routine) == 0)
+               goto continue_input;
+    }
 
     /* Handle hot keys */
 
@@ -327,9 +336,18 @@ continue_input:
 
     /* Handle timeouts */
 
-    if (key == ZC_TIME_OUT)
-       if (direct_call (routine) == 0)
-           goto continue_input;
+    /*
+     * Make sure that this is a real timeout, by checking
+     * that the requested timeout is not zero.  For the case
+     * of a recorded stream, it is possible that a timeout
+     * keystroke might be replayed.
+     */
+    if (timeout != 0)
+    {
+       if (key == ZC_TIME_OUT)
+           if (direct_call (routine) == 0)
+               goto continue_input;
+    }
 
     /* Handle hot keys */