diff options
Diffstat (limited to 'xorg/server/module/rdpMisc.c')
-rw-r--r-- | xorg/server/module/rdpMisc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xorg/server/module/rdpMisc.c b/xorg/server/module/rdpMisc.c index 1f0c4c51..653342fe 100644 --- a/xorg/server/module/rdpMisc.c +++ b/xorg/server/module/rdpMisc.c @@ -66,6 +66,34 @@ rdpBitsPerPixel(int depth) /* the g_ functions from os_calls.c */ /*****************************************************************************/ +/* wait 'millis' milliseconds for the socket to be able to receive */ +/* returns boolean */ +int +g_sck_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_sck_recv(int sck, void *ptr, int len, int flags) { |