core: Get rid of the httpd JS object. Potential progress on #108.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 30m37s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 30m37s
This commit is contained in:
11
src/task.c
11
src/task.c
@ -128,6 +128,7 @@ typedef struct _tf_task_t
|
||||
sqlite3* _db;
|
||||
|
||||
tf_ssb_t* _ssb;
|
||||
tf_http_t* _http;
|
||||
|
||||
tf_trace_t* _trace;
|
||||
|
||||
@ -1756,6 +1757,7 @@ void tf_task_activate(tf_task_t* task)
|
||||
JS_SetPropertyStr(context, global, "getStats", JS_NewCFunction(context, _tf_task_getStats, "getStats", 0));
|
||||
|
||||
tf_httpd_register(context);
|
||||
task->_http = tf_httpd_create(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1868,13 +1870,10 @@ void tf_task_destroy(tf_task_t* task)
|
||||
{
|
||||
tf_ssb_destroy(task->_ssb);
|
||||
}
|
||||
|
||||
/* This ensures the HTTP handlers get cleaned up. */
|
||||
if (task->_trusted)
|
||||
if (task->_http)
|
||||
{
|
||||
JSValue global = JS_GetGlobalObject(task->_context);
|
||||
JS_SetPropertyStr(task->_context, global, "httpd", JS_UNDEFINED);
|
||||
JS_FreeValue(task->_context, global);
|
||||
tf_httpd_destroy(task->_http);
|
||||
task->_http = NULL;
|
||||
}
|
||||
|
||||
JS_FreeContext(task->_context);
|
||||
|
Reference in New Issue
Block a user