summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_iso.c
diff options
context:
space:
mode:
authorspeidy <speidy@gmail.com>2014-02-08 20:55:41 +0200
committerspeidy <speidy@gmail.com>2014-02-08 20:55:41 +0200
commit9a98299e2b3bb0c3e4f047efa4ad8f8450656dda (patch)
tree974bd50a67eb278da4f438c3f3fd4b27b920cad2 /libxrdp/xrdp_iso.c
parent113f2696fe4103474cb2703e3d2f8848304fdd3d (diff)
downloadxrdp-proprietary-9a98299e2b3bb0c3e4f047efa4ad8f8450656dda.tar.gz
xrdp-proprietary-9a98299e2b3bb0c3e4f047efa4ad8f8450656dda.zip
libxrdp: work on fastpath
Diffstat (limited to 'libxrdp/xrdp_iso.c')
-rw-r--r--libxrdp/xrdp_iso.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/libxrdp/xrdp_iso.c b/libxrdp/xrdp_iso.c
index 09c08f94..82a76e5f 100644
--- a/libxrdp/xrdp_iso.c
+++ b/libxrdp/xrdp_iso.c
@@ -95,9 +95,14 @@ xrdp_iso_recv_msg(struct xrdp_iso *self, struct stream *s, int *code, int *len)
*len = 0; // X.224 Length Indicator
plen = xrdp_iso_recv_tpkt_header(self, s);
- if (plen == 1)
+
+ if (plen == 2)
{
- DEBUG((" xrdp_iso_recv_msg: error in tpkt header reading"));
+ DEBUG((" xrdp_iso_recv_msg: non-TPKT header detected, we try fastpath"));
+ return plen;
+ }
+
+ if (plen == 1) {
return 1;
}
@@ -118,10 +123,19 @@ xrdp_iso_recv(struct xrdp_iso *self, struct stream *s)
{
int code;
int len;
+ int iso_msg;
DEBUG((" in xrdp_iso_recv"));
- if (xrdp_iso_recv_msg(self, s, &code, &len) != 0)
+ iso_msg = xrdp_iso_recv_msg(self, s, &code, &len);
+
+ if (iso_msg == 2) // non-TPKT header
+ {
+ DEBUG((" out xrdp_iso_recv xrdp_iso_recv_msg return 2, non-TPKT header detected"));
+ return iso_msg;
+ }
+
+ if (iso_msg == 1) // error
{
DEBUG((" out xrdp_iso_recv xrdp_iso_recv_msg return non zero"));
return 1;
@@ -137,38 +151,32 @@ xrdp_iso_recv(struct xrdp_iso *self, struct stream *s)
return 0;
}
/*****************************************************************************/
-/* returns error */
+/* returns packet length or error (1) */
int APP_CC
-xrdp_iso_detect_tpkt(struct xrdp_iso *self, struct stream *s)
+xrdp_iso_recv_tpkt_header(struct xrdp_iso *self, struct stream *s)
{
+ int plen;
int ver;
- DEBUG((" in xrdp_iso_detect_tpkt"));
+ DEBUG((" in xrdp_iso_recv_tpkt_header"));
+
if (xrdp_tcp_recv(self->tcp_layer, s, 1) != 0)
{
return 1;
}
in_uint8_peek(s, ver);
- g_writeln("tpkt version: %x", ver);
+ g_writeln(" tpkt version: %x", ver);
if (ver != 3)
{
- return 1;
+ /*
+ * special error code that means we got non-TPKT header,
+ * so we gonna try fastpath input.
+ */
+ return 2;
}
- DEBUG((" out xrdp_iso_detect_tpkt"));
- return 0;
-}
-/*****************************************************************************/
-/* returns packet length or error (1) */
-int APP_CC
-xrdp_iso_recv_tpkt_header(struct xrdp_iso *self, struct stream *s)
-{
- int plen;
-
- DEBUG((" in xrdp_iso_recv_tpkt_header"));
-
if (xrdp_tcp_recv(self->tcp_layer, s, 3) != 0)
{
return 1;
@@ -374,13 +382,6 @@ xrdp_iso_incoming(struct xrdp_iso *self)
init_stream(s, 8192);
DEBUG((" in xrdp_iso_incoming"));
- if (xrdp_iso_detect_tpkt(self, s) != 0)
- {
- g_writeln("xrdp_iso_incoming: TPKT not detected");
- free_stream(s);
- return 1;
- }
-
if (xrdp_iso_recv_msg(self, s, &code, &len) != 0)
{
DEBUG((" in xrdp_iso_recv_msg error!!"));