Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
e98225fe
Commit
e98225fe
authored
19 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
If ONE_JS_RUNTIME is defined in CFLAGS, use a single runtime shared by all
sessions.
parent
81b6bf48
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sbbs3/websrvr.c
+33
-0
33 additions, 0 deletions
src/sbbs3/websrvr.c
with
33 additions
and
0 deletions
src/sbbs3/websrvr.c
+
33
−
0
View file @
e98225fe
...
...
@@ -3291,6 +3291,7 @@ static BOOL js_setup(http_session_t* session)
{
JSObject
*
argv
;
#ifndef ONE_JS_RUNTIME
if
(
session
->
js_runtime
==
NULL
)
{
lprintf
(
LOG_INFO
,
"%04d JavaScript: Creating runtime: %lu bytes"
,
session
->
socket
,
startup
->
js
.
max_bytes
);
...
...
@@ -3300,6 +3301,7 @@ static BOOL js_setup(http_session_t* session)
return
(
FALSE
);
}
}
#endif
if
(
session
->
js_cx
==
NULL
)
{
/* Context not yet created, create it now */
if
(((
session
->
js_cx
=
js_initcx
(
session
))
==
NULL
))
{
...
...
@@ -3804,11 +3806,13 @@ void http_session_thread(void* arg)
session
.
js_cx
=
NULL
;
}
#ifndef ONE_JS_RUNTIME
if
(
session
.
js_runtime
!=
NULL
)
{
lprintf
(
LOG_INFO
,
"%04d JavaScript: Destroying runtime"
,
socket
);
JS_DestroyRuntime
(
session
.
js_runtime
);
session
.
js_runtime
=
NULL
;
}
#endif
FREE_AND_NULL
(
session
.
subscan
);
...
...
@@ -4015,6 +4019,9 @@ void DLLCALL web_server(void* arg)
http_session_t
*
session
;
struct
timeval
tv
;
startup
=
(
web_startup_t
*
)
arg
;
#ifdef ONE_JS_RUNTIME
JSRuntime
*
js_runtime
;
#endif
web_ver
();
/* get CVS revision */
...
...
@@ -4223,6 +4230,21 @@ void DLLCALL web_server(void* arg)
_beginthread
(
http_logging_thread
,
0
,
startup
->
logfile_base
);
}
#ifdef ONE_JS_RUNTIME
if
(
js_runtime
==
NULL
)
{
lprintf
(
LOG_INFO
,
"%04d JavaScript: Creating runtime: %lu bytes"
,
server_socket
,
startup
->
js
.
max_bytes
);
if
((
js_runtime
=
JS_NewRuntime
(
startup
->
js
.
max_bytes
))
==
NULL
)
{
lprintf
(
LOG_ERR
,
"%04d !ERROR creating JavaScript runtime"
,
server_socket
);
/* Sleep 15 seconds then try again */
/* ToDo: Something better should be used here. */
SLEEP
(
15000
);
continue
;
}
}
#endif
/* Setup recycle/shutdown semaphore file lists */
shutdown_semfiles
=
semfile_list_init
(
scfg
.
ctrl_dir
,
"shutdown"
,
"web"
);
recycle_semfiles
=
semfile_list_init
(
scfg
.
ctrl_dir
,
"recycle"
,
"web"
);
...
...
@@ -4356,6 +4378,9 @@ void DLLCALL web_server(void* arg)
session
->
js_branch
.
limit
=
startup
->
js
.
branch_limit
;
session
->
js_branch
.
gc_interval
=
startup
->
js
.
gc_interval
;
session
->
js_branch
.
yield_interval
=
startup
->
js
.
yield_interval
;
#ifdef ONE_JS_RUNTIME
session
->
js_runtime
=
js_runtime
;
#endif
_beginthread
(
http_session_thread
,
0
,
session
);
served
++
;
...
...
@@ -4395,6 +4420,14 @@ void DLLCALL web_server(void* arg)
}
}
#ifdef ONE_JS_RUNTIME
if
(
session
.
js_runtime
!=
NULL
)
{
lprintf
(
LOG_INFO
,
"%04d JavaScript: Destroying runtime"
,
server_socket
);
JS_DestroyRuntime
(
js_runtime
);
js_runtime
=
NULL
;
}
#endif
cleanup
(
0
);
if
(
!
terminate_server
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment