From 49552f5ebf5cd3e86a02ba1659a3d1972ec66ded Mon Sep 17 00:00:00 2001 From: jsorg71 Date: Tue, 30 Dec 2008 08:58:31 +0000 Subject: [PATCH] add a var if chan_trans connected --- xrdp/xrdp_mm.c | 24 +++++++++++++++++------- xrdp/xrdp_types.h | 1 + xrdp/xrdp_wm.c | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c index 6d251d0c..34ff69b1 100644 --- a/xrdp/xrdp_mm.c +++ b/xrdp/xrdp_mm.c @@ -713,7 +713,8 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s) if (ok) { self->display = display; - g_snprintf(text, 255, "login successful for display %d", display); + g_snprintf(text, 255, "xrdp_mm_process_login_response: login successful " + "for display %d", display); xrdp_wm_log_msg(self->wm, text); if (xrdp_mm_setup_mod1(self) == 0) { @@ -727,20 +728,29 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s) self->chan_trans->header_size = 8; self->chan_trans->callback_data = self; g_snprintf(text, 255, "%d", 7200 + display); - if (trans_connect(self->chan_trans, "127.0.0.1", text, 3) != 0) + if (trans_connect(self->chan_trans, "127.0.0.1", text, 3) == 0) { - g_writeln("error in trans_connect"); + self->chan_trans_up = 1; } - if (xrdp_mm_chan_send_init(self) != 0) + else { - g_writeln("error in xrdp_mm_chan_send_init"); + g_writeln("xrdp_mm_process_login_response: error in trans_connect " + "chan"); + } + if (self->chan_trans_up) + { + if (xrdp_mm_chan_send_init(self) != 0) + { + g_writeln("xrdp_mm_process_login_response: error in " + "xrdp_mm_chan_send_init"); + } } } } } else { - xrdp_wm_log_msg(self->wm, "login failed"); + xrdp_wm_log_msg(self->wm, "xrdp_mm_process_login_response: login failed"); } /* close socket */ g_delete_wait_obj_from_socket(self->sck_obj); @@ -932,7 +942,7 @@ xrdp_mm_process_channel_data(struct xrdp_mm* self, tbus param1, tbus param2, g_writeln("in xrdp_mm_process_channel_data %d %d %d %d", param1, param2, param3, param4); rv = 0; - if (self->chan_trans != 0) + if ((self->chan_trans != 0) && self->chan_trans_up) { s = trans_get_out_s(self->chan_trans, 8192); if (s != 0) diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 16fe9a5b..1d37bb34 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -188,6 +188,7 @@ struct xrdp_mm int code; int sesman_controlled; struct trans* chan_trans; + int chan_trans_up; }; struct xrdp_keymap diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c index cc479cd1..c0e903b6 100644 --- a/xrdp/xrdp_wm.c +++ b/xrdp/xrdp_wm.c @@ -1490,7 +1490,7 @@ xrdp_wm_mod_get_wait_objs(struct xrdp_wm* self, { if (self->mm != 0) { - if (self->mm->chan_trans != 0) + if ((self->mm->chan_trans != 0) && self->mm->chan_trans_up) { trans_get_wait_objs(self->mm->chan_trans, read_objs, rcount, timeout); } @@ -1513,7 +1513,7 @@ xrdp_wm_mod_check_wait_objs(struct xrdp_wm* self) { if (self->mm != 0) { - if (self->mm->chan_trans != 0) + if ((self->mm->chan_trans != 0) && self->mm->chan_trans_up) { trans_check_wait_objs(self->mm->chan_trans); }