From 719ef1529de11d76dbe2df69ea8f0f6267c8497b Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 25 Feb 2010 04:07:35 +0000 Subject: [PATCH] Avoid calling msclock() from recv_byte. --- src/sbbs3/sexyz.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/sbbs3/sexyz.c b/src/sbbs3/sexyz.c index d51fb8a572..3625d62f61 100644 --- a/src/sbbs3/sexyz.c +++ b/src/sbbs3/sexyz.c @@ -345,15 +345,12 @@ void send_telnet_cmd(SOCKET sock, uchar cmd, uchar opt) int recv_byte(void* unused, unsigned timeout) { int i; - long t; uchar ch; fd_set socket_set; - time_t end; struct timeval tv; static uchar telnet_cmd; static int telnet_cmdlen; - end=msclock()+(timeout*MSCLOCKS_PER_SEC); while(!terminate) { FD_ZERO(&socket_set); @@ -363,9 +360,8 @@ int recv_byte(void* unused, unsigned timeout) else #endif FD_SET(sock,&socket_set); - if((t=end-msclock())<0) t=0; - tv.tv_sec=t/((unsigned)MSCLOCKS_PER_SEC); - tv.tv_usec=(t%((unsigned)MSCLOCKS_PER_SEC))*1000; + tv.tv_sec=timeout; + tv.tv_usec=0; if((i=select(sock+1,&socket_set,NULL,NULL,&tv))<1) { if(i==SOCKET_ERROR) { -- GitLab