summaryrefslogtreecommitdiffstats
path: root/sesman
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2013-09-23 18:08:22 -0700
committerJay Sorg <jay.sorg@gmail.com>2013-09-23 18:08:22 -0700
commit3b743f64ebf4c857a5784add1da72ba41fcf7025 (patch)
treedef73202e7a37d0f719d66d43daf8efa67d36a8d /sesman
parentdfd78c722b738e8db4c096393b6ecf0e26435f40 (diff)
downloadxrdp-proprietary-3b743f64ebf4c857a5784add1da72ba41fcf7025.tar.gz
xrdp-proprietary-3b743f64ebf4c857a5784add1da72ba41fcf7025.zip
chansrv: deadlock, add trans copy func
Diffstat (limited to 'sesman')
-rw-r--r--sesman/chansrv/chansrv.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c
index 56626c77..86c50960 100644
--- a/sesman/chansrv/chansrv.c
+++ b/sesman/chansrv/chansrv.c
@@ -296,18 +296,8 @@ send_data_from_chan_item(struct chan_item *chan_item)
LOGM((LOG_LEVEL_DEBUG, "chansrv::send_data_from_chan_item: -- "
"size %d chan_flags 0x%8.8x", size, chan_flags));
g_sent = 1;
- if (g_con_trans->in_write)
- {
- g_writeln("chansrv::send_data_from_chan_item: error, "
- "write while in_write");
- error = 1;
- }
- else
- {
- /* write but check for read if blocked */
- error = trans_write_check(g_con_trans, -1);
- }
+ error = trans_write_copy(g_con_trans);
if (error != 0)
{
return 1;
@@ -402,7 +392,7 @@ send_init_response_message(void)
out_uint32_le(s, 2); /* msg id */
out_uint32_le(s, 8); /* size */
s_mark_end(s);
- return trans_force_write(g_con_trans);
+ return trans_write_copy(g_con_trans);
}
/*****************************************************************************/
@@ -425,7 +415,7 @@ send_channel_setup_response_message(void)
out_uint32_le(s, 4); /* msg id */
out_uint32_le(s, 8); /* size */
s_mark_end(s);
- return trans_force_write(g_con_trans);
+ return trans_write_copy(g_con_trans);
}
/*****************************************************************************/
@@ -448,7 +438,7 @@ send_channel_data_response_message(void)
out_uint32_le(s, 6); /* msg id */
out_uint32_le(s, 8); /* size */
s_mark_end(s);
- return trans_force_write(g_con_trans);
+ return trans_write_copy(g_con_trans);
}
/*****************************************************************************/
@@ -647,7 +637,7 @@ process_message_channel_data(struct stream *s)
if (chan_flags & 2) /* last */
{
s_mark_end(ls);
- trans_force_write(g_api_con_trans);
+ trans_write_copy(g_api_con_trans);
}
}
}
@@ -1051,7 +1041,9 @@ THREAD_RV THREAD_CC
channel_thread_loop(void *in_val)
{
tbus objs[32];
+ tbus wobjs[32];
int num_objs;
+ int num_wobjs;
int timeout;
int error;
THREAD_RV rv;
@@ -1065,12 +1057,13 @@ channel_thread_loop(void *in_val)
{
timeout = -1;
num_objs = 0;
+ num_wobjs = 0;
objs[num_objs] = g_term_event;
num_objs++;
trans_get_wait_objs(g_lis_trans, objs, &num_objs);
trans_get_wait_objs(g_api_lis_trans, objs, &num_objs);
- while (g_obj_wait(objs, num_objs, 0, 0, timeout) == 0)
+ while (g_obj_wait(objs, num_objs, wobjs, num_wobjs, timeout) == 0)
{
check_timeout();
if (g_is_wait_obj_set(g_term_event))
@@ -1145,10 +1138,12 @@ channel_thread_loop(void *in_val)
xfuse_check_wait_objs();
timeout = -1;
num_objs = 0;
+ num_wobjs = 0;
objs[num_objs] = g_term_event;
num_objs++;
trans_get_wait_objs(g_lis_trans, objs, &num_objs);
- trans_get_wait_objs(g_con_trans, objs, &num_objs);
+ trans_get_wait_objs_rw(g_con_trans, objs, &num_objs,
+ wobjs, &num_wobjs);
trans_get_wait_objs(g_api_lis_trans, objs, &num_objs);
trans_get_wait_objs(g_api_con_trans, objs, &num_objs);
xcommon_get_wait_objs(objs, &num_objs, &timeout);