webrtc server creation waiting added, webrtc and app order changed, titles.json removed
This commit is contained in:
@@ -24,18 +24,18 @@ const run_session = async (req, res, next) => {
|
||||
return
|
||||
}
|
||||
|
||||
var webrtc_pid = await run_webrtc(webrtc_port, app_port)
|
||||
if (!webrtc_pid) {
|
||||
next(new server_error('can not run webrtc'))
|
||||
return
|
||||
}
|
||||
|
||||
var app_pid = await run_app(app_path, app_port)
|
||||
if (!app_pid) {
|
||||
next(new server_error('can not run app'))
|
||||
return
|
||||
}
|
||||
|
||||
var webrtc_pid = await run_webrtc(webrtc_port, app_port)
|
||||
if (!webrtc_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)
|
||||
|
||||
if(!add_runnning_session_result) {
|
||||
|
||||
@@ -5,6 +5,10 @@ const webrtc_server_path = config.webrtc_server_path
|
||||
const app_args_static = config.app_args.static
|
||||
const app_port_arg = config.app_args.runtime.port
|
||||
const fs = require('fs')
|
||||
const tcp_port_used = require('tcp-port-used')
|
||||
|
||||
const webrtc_timeout = 5000
|
||||
const webrtc_retry_time = 100
|
||||
|
||||
const is_proc_running = (pid) => {
|
||||
return is_running(pid)
|
||||
@@ -37,6 +41,7 @@ const run_webrtc = async (webrtc_port, app_port) => {
|
||||
webrtc_proc = fork(webrtc_server_path, [webrtc_proc_arg], {
|
||||
detached: true
|
||||
})
|
||||
await tcp_port_used.waitUntilUsed(webrtc_port, webrtc_retry_time, webrtc_timeout)
|
||||
} catch (err) {
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user