summaryrefslogtreecommitdiffstats
path: root/sesman/chansrv/chansrv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sesman/chansrv/chansrv.c')
-rw-r--r--sesman/chansrv/chansrv.c44
1 files changed, 18 insertions, 26 deletions
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c
index 01c6a43d..a89957ba 100644
--- a/sesman/chansrv/chansrv.c
+++ b/sesman/chansrv/chansrv.c
@@ -46,7 +46,6 @@ static int g_rdpsnd_index = -1;
static int g_rdpdr_index = -1;
static int g_rail_index = -1;
static int g_drdynvc_index = -1;
-static int g_sent = 0; /* if sent data to xrdp, waiting response */
/* state info for dynamic virtual channels */
static struct xrdp_api_data *g_dvc_channels[MAX_DVC_CHANNELS];
@@ -95,7 +94,7 @@ add_timeout(int msoffset, void (*callback)(void *data), void *data)
{
struct timeout_obj *tobj;
tui32 now;
-
+
LOG(10, ("add_timeout:"));
now = g_time3();
tobj = g_malloc(sizeof(struct timeout_obj), 1);
@@ -297,7 +296,6 @@ send_data_from_chan_item(struct chan_item *chan_item)
s_mark_end(s);
LOGM((LOG_LEVEL_DEBUG, "chansrv::send_data_from_chan_item: -- "
"size %d chan_flags 0x%8.8x", size, chan_flags));
- g_sent = 1;
error = trans_write_copy(g_con_trans);
if (error != 0)
@@ -363,10 +361,7 @@ send_channel_data(int chan_id, char *data, int size)
if (g_chan_items[index].id == chan_id)
{
add_data_to_chan_item(g_chan_items + index, data, size);
- if (g_sent == 0)
- {
- check_chan_items();
- }
+ check_chan_items();
return 0;
}
}
@@ -380,10 +375,10 @@ int APP_CC
send_rail_drawing_orders(char* data, int size)
{
LOGM((LOG_LEVEL_DEBUG, "chansrv::send_rail_drawing_orders: size %d", size));
-
+
struct stream* s;
int error;
-
+
s = trans_get_out_s(g_con_trans, 8192);
out_uint32_le(s, 0); /* version */
out_uint32_le(s, 8 + 8 + size); /* size */
@@ -551,6 +546,7 @@ process_message_channel_setup(struct stream *s)
g_rdpdr_index = g_num_chan_items;
g_rdpdr_chan_id = ci->id;
}
+ /* disabled for now */
else if (g_strcasecmp(ci->name, "rail") == 0)
{
g_rail_index = g_num_chan_items;
@@ -579,8 +575,6 @@ process_message_channel_setup(struct stream *s)
if (g_rdpsnd_index >= 0)
{
- /* gets reset to 1 by next send_data_from_chan_item */
- g_sent = 0; /* wait for response! */
sound_init();
}
@@ -647,8 +641,9 @@ process_message_channel_data(struct stream *s)
{
rv = drdynvc_data_in(s, chan_id, chan_flags, length, total_length);
}
- else if (chan_id == ((struct xrdp_api_data *)
- (g_api_con_trans->callback_data))->chan_id)
+ else if ((g_api_con_trans != 0) &&
+ (chan_id == ((struct xrdp_api_data *)
+ (g_api_con_trans->callback_data))->chan_id))
{
LOG(10, ("process_message_channel_data length %d total_length %d "
"chan_flags 0x%8.8x", length, total_length, chan_flags));
@@ -664,7 +659,7 @@ process_message_channel_data(struct stream *s)
if (chan_flags & 2) /* last */
{
s_mark_end(ls);
- trans_write_copy(g_api_con_trans);
+ rv = trans_force_write(g_api_con_trans);
}
}
}
@@ -678,7 +673,6 @@ static int APP_CC
process_message_channel_data_response(struct stream *s)
{
LOG(10, ("process_message_channel_data_response:"));
- g_sent = 0;
check_chan_items();
return 0;
}
@@ -1213,25 +1207,23 @@ nil_signal_handler(int sig)
void DEFAULT_CC
child_signal_handler(int sig)
{
- int i1;
+ int pid;
LOG(0, ("child_signal_handler:"));
-
do
{
- i1 = g_waitchild();
-
- if (i1 == g_exec_pid)
+ pid = g_waitchild();
+ LOG(0, ("child_signal_handler: child pid %d", pid));
+ if ((pid == g_exec_pid) && (pid > 0))
{
- LOG(0, ("child_signal_handler: found pid %d", i1));
+ LOG(0, ("child_signal_handler: found pid %d", pid));
//shutdownx();
}
-
- LOG(10, (" %d", i1));
}
- while (i1 >= 0);
+ while (pid >= 0);
}
+/*****************************************************************************/
void DEFAULT_CC
segfault_signal_handler(int sig)
{
@@ -1378,7 +1370,7 @@ get_log_level(const char* level_str, unsigned int default_level)
"LOG_LEVEL_DEBUG"
};
unsigned int i;
-
+
if (level_str == NULL || level_str[0] == 0)
{
return default_level;
@@ -1448,7 +1440,7 @@ main(int argc, char **argv)
pid = g_getpid();
log_level = get_log_level(g_getenv("CHANSRV_LOG_LEVEL"), LOG_LEVEL_ERROR);
-
+
/* starting logging subsystem */
g_memset(&logconfig, 0, sizeof(struct log_config));
logconfig.program_name = "XRDP-Chansrv";