Rework the start session method in SCP
The start session method is reworked to pass a response back to the client. If the method was successful, a session list entry is created. This is different to the provious behaviour, where we created the session list entry unconditionally. This new arrangement means that we need a different way to avoid a race condition where two users may try to create a session at the same time, and end up with the same display. We do this by keeping track of newly allocated displays as part of the SCP connections. When we allocate a display, the SCP connection displays are also taken into account.
This commit is contained in:
+15
-12
@@ -1086,20 +1086,23 @@ session_send_term(struct session_data *sd, int wait_for_all)
|
||||
g_sigterm(sd->win_mgr);
|
||||
}
|
||||
|
||||
while (session_active(sd))
|
||||
if (wait_for_all)
|
||||
{
|
||||
/* Don't check SIGTERM - we shouldn't be here long */
|
||||
if (g_obj_wait(&g_sigchld_event, 1, NULL, 0, -1) != 0)
|
||||
while (session_active(sd))
|
||||
{
|
||||
/* should not get here */
|
||||
LOG(LOG_LEVEL_WARNING, "session_send_term: "
|
||||
"Unexpected error from g_obj_wait()");
|
||||
g_sleep(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_reset_wait_obj(g_sigchld_event);
|
||||
session_process_sigchld_event(sd);
|
||||
/* Don't check SIGTERM - we shouldn't be here long */
|
||||
if (g_obj_wait(&g_sigchld_event, 1, NULL, 0, -1) != 0)
|
||||
{
|
||||
/* should not get here */
|
||||
LOG(LOG_LEVEL_WARNING, "session_send_term: "
|
||||
"Unexpected error from g_obj_wait()");
|
||||
g_sleep(100);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_reset_wait_obj(g_sigchld_event);
|
||||
session_process_sigchld_event(sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user