Merge branch 'master' of github.com:FreeRDP/FreeRDP-1.0

This commit is contained in:
Marc-André Moreau 2011-07-03 22:47:46 -04:00
commit efe7d34d06

View File

@ -90,9 +90,13 @@ transport_connect_nla(rdpTransport * transport)
return True;
}
static int
transport_recv(rdpTransport * transport);
static int
transport_delay(rdpTransport * transport)
{
transport_recv(transport);
nanosleep(&transport->ts, NULL);
return 0;
}
@ -139,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
@ -174,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)
{
@ -182,16 +202,13 @@ 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;
pos = stream_get_pos(transport->recv_buffer);
while ((pos = stream_get_pos(transport->recv_buffer)) > 0)
{
/* Ensure the TPKT header is available. */
if (pos <= 4)
return 0;
@ -206,7 +223,10 @@ transport_check_fds(rdpTransport * transport)
}
if (pos < length)
{
stream_set_pos(transport->recv_buffer, pos);
return 0; /* Packet is not yet completely received. */
}
/*
* A complete packet has been received. In case there are trailing data
@ -226,7 +246,11 @@ transport_check_fds(rdpTransport * transport)
bytes = transport->recv_callback(transport, received, transport->recv_extra);
stream_free(received);
if (bytes < 0)
return bytes;
}
return 0;
}
void