summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libxrdp/libxrdp.c13
-rw-r--r--libxrdp/libxrdpinc.h2
-rw-r--r--libxrdp/xrdp_tcp.c28
3 files changed, 38 insertions, 5 deletions
diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c
index 091ff6a0..50029b45 100644
--- a/libxrdp/libxrdp.c
+++ b/libxrdp/libxrdp.c
@@ -74,11 +74,20 @@ libxrdp_process_data(struct xrdp_session* session)
int cont;
int rv;
int code;
+ int term;
+ term = 0;
cont = 1;
rv = 0;
- while ((cont || !session->up_and_running) && !session->term)
+ while ((cont || !session->up_and_running) && !term)
{
+ if (session->is_term != 0)
+ {
+ if (session->is_term())
+ {
+ term = 1;
+ }
+ }
code = 0;
if (xrdp_rdp_recv((struct xrdp_rdp*)session->rdp, session->s, &code) != 0)
{
@@ -104,7 +113,7 @@ libxrdp_process_data(struct xrdp_session* session)
{
DEBUG(("libxrdp_process_data returned non zero"));
cont = 0;
- session->term = 1;
+ term = 1;
}
break;
default:
diff --git a/libxrdp/libxrdpinc.h b/libxrdp/libxrdpinc.h
index 419f5dfe..e4087e8a 100644
--- a/libxrdp/libxrdpinc.h
+++ b/libxrdp/libxrdpinc.h
@@ -98,7 +98,6 @@ struct xrdp_session
{
long id;
int sck;
- int term; /* do we need this */
int (*callback)(long id, int msg, long param1, long param2, long param3,
long param4);
void* rdp;
@@ -106,6 +105,7 @@ struct xrdp_session
struct xrdp_client_info* client_info;
int up_and_running;
struct stream* s;
+ int (*is_term)(void);
};
struct xrdp_session* DEFAULT_CC
diff --git a/libxrdp/xrdp_tcp.c b/libxrdp/xrdp_tcp.c
index 98f5ac4e..6d7dbd63 100644
--- a/libxrdp/xrdp_tcp.c
+++ b/libxrdp/xrdp_tcp.c
@@ -57,6 +57,7 @@ int APP_CC
xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len)
{
int rcvd;
+ struct xrdp_session* session;
if (self->sck_closed)
{
@@ -64,6 +65,7 @@ xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len)
return 1;
}
DEBUG((" in xrdp_tcp_recv, gota get %d bytes", len));
+ session = self->iso_layer->mcs_layer->sec_layer->rdp_layer->session;
init_stream(s, len);
while (len > 0)
{
@@ -72,7 +74,17 @@ xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len)
{
if (g_tcp_last_error_would_block(self->sck))
{
- g_tcp_can_recv(self->sck, 10);
+ if (!g_tcp_can_recv(self->sck, 10))
+ {
+ if (session->is_term != 0)
+ {
+ if (session->is_term())
+ {
+ DEBUG((" out xrdp_tcp_recv, terminated"));
+ return 1;
+ }
+ }
+ }
}
else
{
@@ -105,6 +117,7 @@ xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s)
int len;
int total;
int sent;
+ struct xrdp_session* session;
if (self->sck_closed)
{
@@ -113,6 +126,7 @@ xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s)
}
len = s->end - s->data;
DEBUG((" in xrdp_tcp_send, gota send %d bytes", len));
+ session = self->iso_layer->mcs_layer->sec_layer->rdp_layer->session;
total = 0;
while (total < len)
{
@@ -121,7 +135,17 @@ xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s)
{
if (g_tcp_last_error_would_block(self->sck))
{
- g_tcp_can_send(self->sck, 10);
+ if (!g_tcp_can_send(self->sck, 10))
+ {
+ if (session->is_term != 0)
+ {
+ if (session->is_term())
+ {
+ DEBUG((" out xrdp_tcp_send, terminated"));
+ return 1;
+ }
+ }
+ }
}
else
{