From e602a28d5c7548ec0a6f5a7a3b217ecd43c29eac Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 17 Aug 2013 13:32:53 -0700 Subject: common: transport aware when app is terminating --- sesman/chansrv/chansrv.c | 14 ++++++++++++-- sesman/chansrv/chansrv.h | 3 +++ sesman/chansrv/smartcard_pcsc.c | 4 +++- sesman/chansrv/sound.c | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'sesman/chansrv') diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index 388d0273..26d4182e 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -76,6 +76,13 @@ int g_exec_pid = 0; /* this variable gets bumped up once per DVC we create */ tui32 g_dvc_chan_id = 100; +/*****************************************************************************/ +int DEFAULT_CC +g_is_term(void) +{ + return g_is_wait_obj_set(g_term_event); +} + /*****************************************************************************/ /* add data to chan_item, on its way to the client */ /* returns error */ @@ -844,13 +851,15 @@ setup_listen(void) if (g_use_unix_socket) { - g_lis_trans = trans_create(2, 8192, 8192); + g_lis_trans = trans_create(TRANS_MODE_UNIX, 8192, 8192); + g_lis_trans->is_term = g_is_term; g_snprintf(port, 255, "/tmp/.xrdp/xrdp_chansrv_socket_%d", 7200 + g_display_num); } else { - g_lis_trans = trans_create(1, 8192, 8192); + g_lis_trans = trans_create(TRANS_MODE_TCP, 8192, 8192); + g_lis_trans->is_term = g_is_term; g_snprintf(port, 255, "%d", 7200 + g_display_num); } @@ -875,6 +884,7 @@ setup_api_listen(void) int error = 0; g_api_lis_trans = trans_create(TRANS_MODE_UNIX, 8192 * 4, 8192 * 4); + g_api_lis_trans->is_term = g_is_term; g_snprintf(port, 255, "/tmp/.xrdp/xrdpapi_%d", g_display_num); g_api_lis_trans->trans_conn_in = my_api_trans_conn_in; error = trans_listen(g_api_lis_trans, port); diff --git a/sesman/chansrv/chansrv.h b/sesman/chansrv/chansrv.h index bca30ca4..12162dd1 100644 --- a/sesman/chansrv/chansrv.h +++ b/sesman/chansrv/chansrv.h @@ -54,6 +54,9 @@ struct xrdp_api_data int is_connected; }; +int DEFAULT_CC +g_is_term(void); + int APP_CC send_channel_data(int chan_id, char *data, int size); int APP_CC main_cleanup(void); int APP_CC find_empty_slot_in_dvc_channels(); diff --git a/sesman/chansrv/smartcard_pcsc.c b/sesman/chansrv/smartcard_pcsc.c index a3a269d7..909c7df3 100644 --- a/sesman/chansrv/smartcard_pcsc.c +++ b/sesman/chansrv/smartcard_pcsc.c @@ -24,6 +24,7 @@ #define PCSC_STANDIN 1 +#include "chansrv.h" #include "os_calls.h" #include "smartcard.h" #include "log.h" @@ -258,7 +259,8 @@ scard_pcsc_init(void) if (g_lis == 0) { - g_lis = trans_create(2, 8192, 8192); + g_lis = trans_create(TRANS_MODE_UNIX, 8192, 8192); + g_lis->is_term = g_is_term; g_snprintf(g_pcsc_directory, 255, "/tmp/.xrdp/pcsc%d", g_display_num); if (g_directory_exist(g_pcsc_directory)) { diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index 9ee3c8c3..2e85f1f2 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -551,7 +551,8 @@ sound_init(void) LOG(0, ("sound_init:")); sound_send_server_formats(); - g_audio_l_trans = trans_create(2, 128 * 1024, 8192); + g_audio_l_trans = trans_create(TRANS_MODE_UNIX, 128 * 1024, 8192); + g_audio_l_trans->is_term = g_is_term; g_snprintf(port, 255, CHANSRV_PORT_STR, g_display_num); g_audio_l_trans->trans_conn_in = sound_trans_audio_conn_in; error = trans_listen(g_audio_l_trans, port); -- cgit v1.2.1