libfreerdp-core/transport: process PDU (if any) only after sending has completed.

This commit is contained in:
Vic Lee 2011-07-04 10:11:14 +08:00
parent 2fe93a9799
commit 8afa7cf227

View File

@ -90,10 +90,13 @@ transport_connect_nla(rdpTransport * transport)
return True;
}
static int
transport_recv(rdpTransport * transport);
static int
transport_delay(rdpTransport * transport)
{
transport_check_fds(transport);
transport_recv(transport);
nanosleep(&transport->ts, NULL);
return 0;
}
@ -140,10 +143,17 @@ transport_send_tcp(rdpTransport * transport, STREAM * stream)
int
transport_send(rdpTransport * transport, STREAM * stream)
{
int r;
if (transport->state == TRANSPORT_STATE_TLS)
return transport_send_tls(transport, stream);
r = transport_send_tls(transport, stream);
else
return transport_send_tcp(transport, stream);
r = transport_send_tcp(transport, stream);
if (r == 0)
r = transport_check_fds(transport);
return r;
}
static int
@ -175,6 +185,15 @@ transport_recv_tcp(rdpTransport * transport)
return bytes;
}
static int
transport_recv(rdpTransport * transport)
{
if (transport->state == TRANSPORT_STATE_TLS)
return transport_recv_tls(transport);
else
return transport_recv_tcp(transport);
}
int
transport_check_fds(rdpTransport * transport)
{
@ -183,10 +202,7 @@ transport_check_fds(rdpTransport * transport)
uint16 length;
STREAM * received;
if (transport->state == TRANSPORT_STATE_TLS)
bytes = transport_recv_tls(transport);
else
bytes = transport_recv_tcp(transport);
bytes = transport_recv(transport);
if (bytes <= 0)
return bytes;