Skip to content
Snippets Groups Projects
Commit 719ef152 authored by deuce's avatar deuce
Browse files

Avoid calling msclock() from recv_byte.

parent f6d6256a
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment