summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_mcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libxrdp/xrdp_mcs.c')
-rw-r--r--libxrdp/xrdp_mcs.c72
1 files changed, 27 insertions, 45 deletions
diff --git a/libxrdp/xrdp_mcs.c b/libxrdp/xrdp_mcs.c
index 1828b28b..81e8b758 100644
--- a/libxrdp/xrdp_mcs.c
+++ b/libxrdp/xrdp_mcs.c
@@ -122,18 +122,25 @@ xrdp_mcs_recv(struct xrdp_mcs *self, struct stream *s, int *chan)
int len;
int userid;
int chanid;
-
+ int iso_msg;
DEBUG((" in xrdp_mcs_recv"));
while (1)
{
- if (xrdp_iso_recv(self->iso_layer, s) != 0)
+ iso_msg = xrdp_iso_recv(self->iso_layer, s);
+
+ if (iso_msg == 2) // non-TPKT header
{
- free_stream(s);
- return 1;
+ DEBUG((" out xrdp_mcs_recv, non-TPKT header detected, we try fastpath"));
+ return iso_msg;
}
+ if (iso_msg == 1) // error
+ {
+ DEBUG((" out xrdp_mcs_recv, xrdp_iso_recv return non zero"));
+ return 1;
+ }
if (!s_check_rem(s, 1))
{
@@ -322,16 +329,10 @@ xrdp_mcs_recv_connect_initial(struct xrdp_mcs *self)
make_stream(s);
init_stream(s, 16 * 1024);
- if (xrdp_iso_detect_tpkt(self->iso_layer, s) == 0) {
- if (xrdp_iso_recv(self->iso_layer, s) != 0)
- {
- free_stream(s);
- return 1;
- }
- } else {
- g_writeln("xrdp_mcs_recv_connect_initial: TPKT not detected");
- free_stream(s);
- return 1;
+ if (xrdp_iso_recv(self->iso_layer, s) != 0)
+ {
+ free_stream(s);
+ return 1;
}
if (xrdp_mcs_ber_parse_header(self, s, MCS_CONNECT_INITIAL, &len) != 0)
@@ -449,16 +450,10 @@ xrdp_mcs_recv_edrq(struct xrdp_mcs *self)
make_stream(s);
init_stream(s, 8192);
- if (xrdp_iso_detect_tpkt(self->iso_layer, s) == 0) {
- if (xrdp_iso_recv(self->iso_layer, s) != 0)
- {
- free_stream(s);
- return 1;
- }
- } else {
- g_writeln("xrdp_mcs_recv_edrq: TPKT not detected");
- free_stream(s);
- return 1;
+ if (xrdp_iso_recv(self->iso_layer, s) != 0)
+ {
+ free_stream(s);
+ return 1;
}
if (!s_check_rem(s, 1))
@@ -517,19 +512,12 @@ xrdp_mcs_recv_aurq(struct xrdp_mcs *self)
make_stream(s);
init_stream(s, 8192);
- if (xrdp_iso_detect_tpkt(self->iso_layer, s) == 0) {
- if (xrdp_iso_recv(self->iso_layer, s) != 0)
- {
- free_stream(s);
- return 1;
- }
- } else {
- g_writeln("xrdp_mcs_recv_aurq: TPKT not detected");
- free_stream(s);
- return 1;
+ if (xrdp_iso_recv(self->iso_layer, s) != 0)
+ {
+ free_stream(s);
+ return 1;
}
-
if (!s_check_rem(s, 1))
{
free_stream(s);
@@ -611,16 +599,10 @@ xrdp_mcs_recv_cjrq(struct xrdp_mcs *self)
make_stream(s);
init_stream(s, 8192);
- if (xrdp_iso_detect_tpkt(self->iso_layer, s) == 0) {
- if (xrdp_iso_recv(self->iso_layer, s) != 0)
- {
- free_stream(s);
- return 1;
- }
- } else {
- g_writeln("xrdp_mcs_recv_cjrq: TPKT not detected");
- free_stream(s);
- return 1;
+ if (xrdp_iso_recv(self->iso_layer, s) != 0)
+ {
+ free_stream(s);
+ return 1;
}
if (!s_check_rem(s, 1))