Merge branch 'master' of github.com:FreeRDP/FreeRDP-1.0
This commit is contained in:
commit
efe7d34d06
@ -90,9 +90,13 @@ transport_connect_nla(rdpTransport * transport)
|
|||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
transport_recv(rdpTransport * transport);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
transport_delay(rdpTransport * transport)
|
transport_delay(rdpTransport * transport)
|
||||||
{
|
{
|
||||||
|
transport_recv(transport);
|
||||||
nanosleep(&transport->ts, NULL);
|
nanosleep(&transport->ts, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -139,10 +143,17 @@ transport_send_tcp(rdpTransport * transport, STREAM * stream)
|
|||||||
int
|
int
|
||||||
transport_send(rdpTransport * transport, STREAM * stream)
|
transport_send(rdpTransport * transport, STREAM * stream)
|
||||||
{
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
if (transport->state == TRANSPORT_STATE_TLS)
|
if (transport->state == TRANSPORT_STATE_TLS)
|
||||||
return transport_send_tls(transport, stream);
|
r = transport_send_tls(transport, stream);
|
||||||
else
|
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
|
static int
|
||||||
@ -174,6 +185,15 @@ transport_recv_tcp(rdpTransport * transport)
|
|||||||
return bytes;
|
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
|
int
|
||||||
transport_check_fds(rdpTransport * transport)
|
transport_check_fds(rdpTransport * transport)
|
||||||
{
|
{
|
||||||
@ -182,16 +202,13 @@ transport_check_fds(rdpTransport * transport)
|
|||||||
uint16 length;
|
uint16 length;
|
||||||
STREAM * received;
|
STREAM * received;
|
||||||
|
|
||||||
if (transport->state == TRANSPORT_STATE_TLS)
|
bytes = transport_recv(transport);
|
||||||
bytes = transport_recv_tls(transport);
|
|
||||||
else
|
|
||||||
bytes = transport_recv_tcp(transport);
|
|
||||||
|
|
||||||
if (bytes <= 0)
|
if (bytes <= 0)
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|
||||||
pos = stream_get_pos(transport->recv_buffer);
|
while ((pos = stream_get_pos(transport->recv_buffer)) > 0)
|
||||||
|
{
|
||||||
/* Ensure the TPKT header is available. */
|
/* Ensure the TPKT header is available. */
|
||||||
if (pos <= 4)
|
if (pos <= 4)
|
||||||
return 0;
|
return 0;
|
||||||
@ -206,7 +223,10 @@ transport_check_fds(rdpTransport * transport)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pos < length)
|
if (pos < length)
|
||||||
|
{
|
||||||
|
stream_set_pos(transport->recv_buffer, pos);
|
||||||
return 0; /* Packet is not yet completely received. */
|
return 0; /* Packet is not yet completely received. */
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A complete packet has been received. In case there are trailing data
|
* 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);
|
bytes = transport->recv_callback(transport, received, transport->recv_extra);
|
||||||
stream_free(received);
|
stream_free(received);
|
||||||
|
|
||||||
|
if (bytes < 0)
|
||||||
return bytes;
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user