Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
64a1ca3e
Commit
64a1ca3e
authored
Jul 22, 2003
by
rswindell
Browse files
Executs static JS services in a private "scope", to force GC of local objects
upon loop.
parent
4a099183
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/sbbs3/services.c
src/sbbs3/services.c
+8
-3
No files found.
src/sbbs3/services.c
View file @
64a1ca3e
...
...
@@ -972,6 +972,7 @@ static void js_static_service_thread(void* arg)
SOCKET
socket
;
/* JavaScript-specific */
JSObject
*
js_glob
;
JSObject
*
js_scope
;
JSScript
*
js_script
;
JSRuntime
*
js_runtime
;
JSContext
*
js_cx
;
...
...
@@ -1020,15 +1021,19 @@ static void js_static_service_thread(void* arg)
JS_ClearPendingException
(
js_cx
);
js_script
=
JS_CompileFile
(
js_cx
,
js_glob
,
spath
);
if
((
js_scope
=
JS_NewObject
(
js_cx
,
NULL
,
NULL
,
js_glob
))
==
NULL
)
{
lprintf
(
"%04d !JavaScript FAILED to create scope object"
,
service
->
socket
);
break
;
}
if
(
js_script
==
NULL
)
{
if
(
(
js_script
=
JS_CompileFile
(
js_cx
,
js_scope
,
spath
))
=
=
NULL
)
{
lprintf
(
"%04d !JavaScript FAILED to compile script (%s)"
,
service
->
socket
,
spath
);
break
;
}
JS_ExecuteScript
(
js_cx
,
js_
glob
,
js_script
,
&
rval
);
JS_ExecuteScript
(
js_cx
,
js_
scope
,
js_script
,
&
rval
);
JS_DestroyScript
(
js_cx
,
js_script
);
JS_ClearScope
(
js_cx
,
js_scope
);
JS_GC
(
js_cx
);
}
while
(
!
service
->
terminated
&&
service
->
options
&
SERVICE_OPT_STATIC_LOOP
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment