session destroy fixed
This commit is contained in:
@@ -7,36 +7,36 @@ const http_client = require('../../lib/http_client.js')
|
||||
|
||||
const app_port_begin = config.session_ports.app_begin
|
||||
const http_port_begin = config.session_ports.http_begin
|
||||
const ports_count = config.session_ports.count
|
||||
|
||||
const app_args_static = config.app_args_static
|
||||
const app_args_ip = config.app_args_runtime.ip
|
||||
const server_ip = config.external_ip
|
||||
const server_port = config.external_port
|
||||
const server_ip = '127.0.0.1'//config.ip
|
||||
const external_domain = config.external_domain
|
||||
const app_args_port = config.app_args_runtime.port
|
||||
const start_nginx = config.start_nginx
|
||||
const server_id = config.server_id
|
||||
|
||||
const webrtc_cirrus_path = config.webrtc_args_static.cirrus_path
|
||||
|
||||
const coordinator_port = config.coordinator.port
|
||||
const coordinator_ip = config.coordinator.ip
|
||||
const coordinator_domain = config.coordinator_domain
|
||||
|
||||
// const http_client = require('../lib/http_client.js')
|
||||
|
||||
// SHALL FIX IT IN FUTURE BECAUSE IT IS NOT THE REST API
|
||||
const ports_count = 50
|
||||
var app_port_alloc = new port_alloc(app_port_begin, ports_count)
|
||||
var http_port_alloc = new port_alloc(http_port_begin, ports_count)
|
||||
|
||||
// close all own sessions on session server if emergency shutdown
|
||||
http_client.get({
|
||||
host: coordinator_ip,
|
||||
port: coordinator_port,
|
||||
path: `/session_server/emergency_shutdown?ip=${server_ip}&port=${server_port}`
|
||||
http_client.gets({
|
||||
host: coordinator_domain,
|
||||
path: `/session_server/emergency_shutdown?id=${server_id}`
|
||||
}, async function(answer) {
|
||||
}, function(err) {
|
||||
//next(Error('session server not working'))
|
||||
})
|
||||
|
||||
module.exports.create_session = async (req, res, next) => {
|
||||
const create_session = async (req, res, next) => {
|
||||
//create?title=name&next_var=0
|
||||
try {
|
||||
var app_info
|
||||
@@ -54,6 +54,7 @@ module.exports.create_session = async (req, res, next) => {
|
||||
app_port = app_port_alloc.get()
|
||||
http_port = http_port_alloc.get()
|
||||
} catch(e) {
|
||||
//console.log('count error')
|
||||
throw new Error(e)
|
||||
}
|
||||
|
||||
@@ -85,9 +86,9 @@ module.exports.create_session = async (req, res, next) => {
|
||||
else {
|
||||
app_proc.kill('SIGINT')
|
||||
}
|
||||
http_client.get({
|
||||
host: coordinator_ip,
|
||||
port: coordinator_port,
|
||||
|
||||
http_client.gets({
|
||||
host: coordinator_domain,
|
||||
path: `/session/close?session_id=${req.query.session_id}`
|
||||
}, async function(answer) {
|
||||
}, function(err) {
|
||||
@@ -95,14 +96,22 @@ module.exports.create_session = async (req, res, next) => {
|
||||
})
|
||||
|
||||
})
|
||||
res.json({msg:'SESSION_CREATED', link:`http://${server_ip+':'+http_port}`})
|
||||
setTimeout(() => {
|
||||
res.json({msg:'SESSION_CREATED', link:`https://${external_domain}/${start_nginx}${http_port}/`})
|
||||
}, 1000)
|
||||
} catch (e) {
|
||||
next(e)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.connect_session = async (req, res, next) => {
|
||||
const connect_session = async (req, res, next) => {
|
||||
}
|
||||
|
||||
module.exports.close_session = async (req, res, next) => {
|
||||
const close_session = async (req, res, next) => {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
create_session,
|
||||
connect_session,
|
||||
close_session
|
||||
}
|
||||
Reference in New Issue
Block a user