Commit 4a099183 authored by rswindell's avatar rswindell
Browse files

Recompiles and destroys script for each static JS service loop.

parent 78ade3c1
...@@ -1014,22 +1014,25 @@ static void js_static_service_thread(void* arg) ...@@ -1014,22 +1014,25 @@ static void js_static_service_thread(void* arg)
JS_SetProperty(js_cx, js_glob, "logged_in", &val); JS_SetProperty(js_cx, js_glob, "logged_in", &val);
JS_SetBranchCallback(js_cx, js_BranchCallback);
do {
JS_ClearPendingException(js_cx); JS_ClearPendingException(js_cx);
js_script=JS_CompileFile(js_cx, js_glob, spath); js_script=JS_CompileFile(js_cx, js_glob, spath);
if(js_script==NULL) if(js_script==NULL) {
lprintf("%04d !JavaScript FAILED to compile script (%s)",service->socket,spath); lprintf("%04d !JavaScript FAILED to compile script (%s)",service->socket,spath);
else { break;
JS_SetBranchCallback(js_cx, js_BranchCallback); }
do {
JS_ExecuteScript(js_cx, js_glob, js_script, &rval); JS_ExecuteScript(js_cx, js_glob, js_script, &rval);
JS_DestroyScript(js_cx, js_script);
JS_GC(js_cx); JS_GC(js_cx);
} while(!service->terminated && service->options&SERVICE_OPT_STATIC_LOOP); } while(!service->terminated && service->options&SERVICE_OPT_STATIC_LOOP);
JS_DestroyScript(js_cx, js_script);
JS_DestroyContext(js_cx); /* Free Context */ JS_DestroyContext(js_cx); /* Free Context */
JS_DestroyRuntime(js_runtime); JS_DestroyRuntime(js_runtime);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment