From e552ad7e1d6ffd6c9de2291049f2627c0e837d0c Mon Sep 17 00:00:00 2001 From: yuqing Date: Thu, 8 Sep 2016 15:43:24 +0800 Subject: [PATCH] fixbug for select --- src/sockopt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sockopt.c b/src/sockopt.c index 671f71f..1cfe02f 100644 --- a/src/sockopt.c +++ b/src/sockopt.c @@ -339,13 +339,13 @@ int tcprecvdata_nb_ms(int sock, void *data, const int size, \ } #ifdef USE_SELECT - if (timeout <= 0) + if (timeout_ms <= 0) { res = select(sock+1, &read_set, NULL, NULL, NULL); } else { - t.tv_usec = timeout_ms * 1000; + t.tv_usec = (timeout_ms % 1000) * 1000; t.tv_sec = timeout_ms / 1000; res = select(sock+1, &read_set, NULL, NULL, &t); }