process kill updated to invisible, webrtc_timeout increased, port allocation changed for high concurrency, port information added to database, app process kill added if webrtc not started

This commit is contained in:
C
2023-02-07 18:22:10 +05:00
parent a0ecb483a1
commit f00d3a447d
5 changed files with 176 additions and 37 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ const {get_webrtc_port, get_app_port} = require('../modules/port_alloc')
const {get_app_path} = require('../modules/titles')
const not_found_error = require('../../lib/src/http/errors/not_found_error')
const server_error = require('../../lib/src/http/errors/server_error')
const {run_webrtc, run_app} = require('../modules/run_process')
const {run_webrtc, run_app, kill_proc} = require('../modules/run_process')
const {create_websocket_url} = require('../modules/links')
@@ -32,17 +32,17 @@ const run_session = async (req, res, next) => {
var webrtc_pid = await run_webrtc(webrtc_port, app_port)
if (!webrtc_pid) {
kill_proc(app_pid)
next(new server_error('can not run webrtc'))
return
}
var add_runnning_session_result = await database.add_running_session(session_id, app_pid, webrtc_pid)
var add_runnning_session_result = await database.add_running_session(session_id, app_pid, webrtc_pid, app_port, webrtc_port)
if(!add_runnning_session_result) {
next(new server_error('can not add session to database'))
return
}
res.json({websocket_url:create_websocket_url(webrtc_port)})
}