removed sleep calls from xrdp_tcp
This commit is contained in:
parent
ea3f8ba0b7
commit
f9e6578ed9
@ -459,6 +459,31 @@ g_tcp_can_send(int sck, int millis)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* wait 'millis' milliseconds for the socket to be able to receive */
|
||||
/* returns boolean */
|
||||
int
|
||||
g_tcp_can_recv(int sck, int millis)
|
||||
{
|
||||
fd_set rfds;
|
||||
struct timeval time;
|
||||
int rv;
|
||||
|
||||
time.tv_sec = millis / 1000;
|
||||
time.tv_usec = (millis * 1000) % 1000000;
|
||||
FD_ZERO(&rfds);
|
||||
if (sck > 0)
|
||||
{
|
||||
FD_SET(((unsigned int)sck), &rfds);
|
||||
rv = select(sck + 1, &rfds, 0, 0, &time);
|
||||
if (rv > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
g_tcp_select(int sck1, int sck2)
|
||||
|
@ -76,6 +76,10 @@ g_tcp_send(int sck, const void* ptr, int len, int flags);
|
||||
int
|
||||
g_tcp_last_error_would_block(int sck);
|
||||
int
|
||||
g_tcp_can_send(int sck, int millis);
|
||||
int
|
||||
g_tcp_can_recv(int sck, int millis);
|
||||
int
|
||||
g_tcp_select(int sck1, int sck2);
|
||||
void
|
||||
g_sleep(int msecs);
|
||||
|
@ -72,7 +72,7 @@ xrdp_tcp_recv(struct xrdp_tcp* self, struct stream* s, int len)
|
||||
{
|
||||
if (g_tcp_last_error_would_block(self->sck))
|
||||
{
|
||||
g_sleep(1);
|
||||
g_tcp_can_recv(self->sck, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -121,7 +121,7 @@ xrdp_tcp_send(struct xrdp_tcp* self, struct stream* s)
|
||||
{
|
||||
if (g_tcp_last_error_would_block(self->sck))
|
||||
{
|
||||
g_sleep(1);
|
||||
g_tcp_can_send(self->sck, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user