Add master node session recovery support

master
Timothy Pearson 6 years ago
parent 315b8914c8
commit 6189a340b0

@ -82,7 +82,7 @@ scp_v0_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
s->bpp, s->type, s->client_ip);
// RAPTOR session management
pid_t serverpid = raptor_sm_get_pid_for_username(s->username);
pid_t serverpid = raptor_sm_get_pid_for_username(s->username, RAPTOR_SM_SERVER_PID_FIELD);
if (serverpid < 0) {
// Session NOT already running
if (s_item != 0) {

@ -112,7 +112,7 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s)
slist = session_get_byuser(s->username, &scount, SESMAN_SESSION_STATUS_DISCONNECTED);
// RAPTOR session management
pid_t serverpid = raptor_sm_get_pid_for_username(s->username);
pid_t serverpid = raptor_sm_get_pid_for_username(s->username, RAPTOR_SM_SERVER_PID_FIELD);
if (serverpid < 0) {
// Session NOT already running
scount = 0;

@ -681,9 +681,6 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
}
else if (window_manager_pid == 0)
{
if (session_was_already_running) {
g_exit(0);
}
char* remote_server = wait_for_remote_hostname(s->username);
wait_for_remote_xserver(remote_server, display);
env_set_user(s->username,
@ -696,8 +693,34 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
{
g_free(remote_server);
// RAPTOR session management
raptor_sm_run_remote_desktop(s->username, display, "/opt/trinity/bin/starttde");
// // RAPTOR session management
// raptor_sm_run_remote_desktop(s->username, display, "/opt/trinity/bin/starttde");
// g_exit(0);
struct list * wm_params = (struct list *)NULL;
char ** pp2 = (char **)NULL;
wm_params = list_create();
wm_params->auto_free = 1;
/* these are the must have parameters */
list_add_item(wm_params, (long)g_strdup("/opt/trinity/bin/starttde"));
/* make sure it ends with a zero */
list_add_item(wm_params, 0);
pp2 = (char**)wm_params->items;
pid_t wmpid;
wmpid = raptor_sm_run_remote_server(s->username, pp2, RAPTOR_SM_WM_PID_FIELD, display);
log_message(LOG_LEVEL_ALWAYS, "new window manager pid code was %d for user %s", wmpid, s->username);
if (wmpid >= 0) {
raptor_sm_wm_started(s->username, wmpid, RAPTOR_SM_WM_PID_FIELD);
// Wait for PID exit and remove information from the session database
raptor_sm_wait_for_pid_exit(s->username, wmpid);
raptor_sm_wm_terminated(s->username);
raptor_sm_terminate_server(s->username);
}
g_exit(0);
auth_set_env(data);
@ -872,14 +895,14 @@ session_start_fork(tbus data, tui8 type, struct SCP_CONNECTION *c,
/* fire up Xorg */
pid_t serverpid;
serverpid = raptor_sm_run_remote_server(s->username, pp1);
serverpid = raptor_sm_run_remote_server(s->username, pp1, RAPTOR_SM_SERVER_PID_FIELD, -1);
log_message(LOG_LEVEL_ALWAYS, "new server pid code was %d during login for user %s", serverpid, s->username);
if (serverpid >= 0) {
if (!session_was_already_running) {
char *friendlyscreen = g_strdup(screen);
friendlyscreen[0] = ' ';
raptor_sm_server_started(s->username, serverpid, atoi(friendlyscreen));
raptor_sm_server_started(s->username, serverpid, atoi(friendlyscreen), RAPTOR_SM_SERVER_PID_FIELD);
g_free(friendlyscreen);
// Wait for PID exit and remove information from the session database

Loading…
Cancel
Save