xrdp: add fork option to xrdp.ini

This commit is contained in:
Jay Sorg 2012-05-26 19:00:14 -07:00
parent 5e72f90bba
commit 0566da74eb
3 changed files with 15 additions and 10 deletions

View File

@ -25,7 +25,6 @@
static struct xrdp_listen* g_listen = 0; static struct xrdp_listen* g_listen = 0;
static long g_threadid = 0; /* main threadid */ static long g_threadid = 0; /* main threadid */
static int g_fork_not_thread = 0;
static long g_sync_mutex = 0; static long g_sync_mutex = 0;
static long g_sync1_mutex = 0; static long g_sync1_mutex = 0;
static tbus g_term_event = 0; static tbus g_term_event = 0;
@ -45,14 +44,10 @@ g_xrdp_sync(long (*sync_func)(long param1, long param2), long sync_param1,
long sync_result; long sync_result;
int sync_command; int sync_command;
if (g_fork_not_thread) if (tc_threadid_equal(tc_get_threadid(), g_threadid))
{
/* always main thread, fork mode */
sync_result = sync_func(sync_param1, sync_param2);
}
else if (tc_threadid_equal(tc_get_threadid(), g_threadid))
{ {
/* this is the main thread, call the function directly */ /* this is the main thread, call the function directly */
/* in fork mode, this always happens too */
sync_result = sync_func(sync_param1, sync_param2); sync_result = sync_func(sync_param1, sync_param2);
} }
else else
@ -98,7 +93,6 @@ xrdp_shutdown(int sig)
void DEFAULT_CC void DEFAULT_CC
xrdp_child(int sig) xrdp_child(int sig)
{ {
g_writeln("xrdp_child");
g_waitchild(); g_waitchild();
} }
@ -250,8 +244,7 @@ xrdp_process_params(int argc, char** argv,
(g_strncasecmp(option, "--fork", 255) == 0)) (g_strncasecmp(option, "--fork", 255) == 0))
{ {
startup_params->fork = 1; startup_params->fork = 1;
g_fork_not_thread = 1; g_writeln("--fork parameter found, ini override");
g_writeln("running in fork mode");
} }
else else
{ {

View File

@ -6,6 +6,7 @@ port=3389
crypt_level=low crypt_level=low
channel_code=1 channel_code=1
max_bpp=24 max_bpp=24
fork=yes
#black=000000 #black=000000
#grey=d6d3ce #grey=d6d3ce
#dark_grey=808080 #dark_grey=808080

View File

@ -174,6 +174,17 @@ xrdp_listen_get_port_address(char* port, int port_bytes,
val = (char*)list_get_item(values, index); val = (char*)list_get_item(values, index);
g_strncpy(address, val, address_bytes - 1); g_strncpy(address, val, address_bytes - 1);
} }
if (g_strcasecmp(val, "fork") == 0)
{
val = (char*)list_get_item(values, index);
if ((g_strcasecmp(val, "yes") == 0) ||
(g_strcasecmp(val, "on") == 0) ||
(g_strcasecmp(val, "true") == 0) ||
(g_atoi(val) != 0))
{
startup_param->fork = 1;
}
}
} }
} }
} }