summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2013-08-17 13:32:53 -0700
committerJay Sorg <jay.sorg@gmail.com>2013-08-17 13:32:53 -0700
commite602a28d5c7548ec0a6f5a7a3b217ecd43c29eac (patch)
treebe8220ba7c782bccf22755ecea38e2a2197edb9d /common
parentee98f1cdd4baf69f5c3620b1dfe1d59256ca443a (diff)
downloadxrdp-proprietary-e602a28d5c7548ec0a6f5a7a3b217ecd43c29eac.tar.gz
xrdp-proprietary-e602a28d5c7548ec0a6f5a7a3b217ecd43c29eac.zip
common: transport aware when app is terminating
Diffstat (limited to 'common')
-rw-r--r--common/trans.c23
-rw-r--r--common/trans.h2
2 files changed, 23 insertions, 2 deletions
diff --git a/common/trans.c b/common/trans.c
index e862249e..0b672168 100644
--- a/common/trans.c
+++ b/common/trans.c
@@ -142,6 +142,7 @@ trans_check_wait_objs(struct trans *self)
in_trans->sck = in_sck;
in_trans->type1 = TRANS_TYPE_SERVER;
in_trans->status = TRANS_STATUS_UP;
+ in_trans->is_term = self->is_term;
if (self->trans_conn_in(self, in_trans) != 0)
{
@@ -226,9 +227,18 @@ trans_force_read_s(struct trans *self, struct stream *in_s, int size)
{
if (g_tcp_last_error_would_block(self->sck))
{
- if (!g_tcp_can_recv(self->sck, 10))
+ if (!g_tcp_can_recv(self->sck, 100))
{
/* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
else
@@ -285,9 +295,18 @@ trans_force_write_s(struct trans *self, struct stream *out_s)
{
if (g_tcp_last_error_would_block(self->sck))
{
- if (!g_tcp_can_send(self->sck, 10))
+ if (!g_tcp_can_send(self->sck, 100))
{
/* check for term here */
+ if (self->is_term != 0)
+ {
+ if (self->is_term())
+ {
+ /* term */
+ self->status = TRANS_STATUS_DOWN;
+ return 1;
+ }
+ }
}
}
else
diff --git a/common/trans.h b/common/trans.h
index 8daa980a..4b8e3b42 100644
--- a/common/trans.h
+++ b/common/trans.h
@@ -38,6 +38,7 @@ struct trans; /* forward declaration */
typedef int (*ttrans_data_in)(struct trans* self);
typedef int (*ttrans_conn_in)(struct trans* self, struct trans* new_self);
+typedef int (*tis_term)(void);
struct trans
{
@@ -52,6 +53,7 @@ struct trans
struct stream* in_s;
struct stream* out_s;
char* listen_filename;
+ tis_term is_term; /* used to test for exit */
};
struct trans* APP_CC