From 2fe107aca92809901cfe4532a57acdad2d4deb60 Mon Sep 17 00:00:00 2001 From: Nicholas Blasgen Date: Sun, 12 Mar 2017 18:20:11 +0000 Subject: [PATCH] FS-10084 [mod_v8] If the value passed is negative, block until event is received --- src/mod/languages/mod_v8/src/fseventhandler.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/languages/mod_v8/src/fseventhandler.cpp b/src/mod/languages/mod_v8/src/fseventhandler.cpp index b56d4faaf5..bff9f1db1b 100644 --- a/src/mod/languages/mod_v8/src/fseventhandler.cpp +++ b/src/mod/languages/mod_v8/src/fseventhandler.cpp @@ -336,6 +336,10 @@ JS_EVENTHANDLER_FUNCTION_IMPL(GetEvent) if (switch_queue_pop_timeout(_event_queue, &pop, (switch_interval_time_t) timeout * 1000) == SWITCH_STATUS_SUCCESS && pop) { pevent = (switch_event_t *) pop; } + } else if (timeout < 0) { + if (switch_queue_pop(_event_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { + prevent = (switch_event_t *) pop; + } } else { if (switch_queue_trypop(_event_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { pevent = (switch_event_t *) pop;