Project

General

Profile

« Previous | Next » 

Revision 89312c37

Added by Hamish Coleman about 16 years ago

  • ID 89312c3752e4d2b2efee71ca2c5653a40093f4a0

Convert run_menu to not busy wait
It took me a while to notice, but the run_menu is written using
blocking file metaphor, but the socket it is working on is a non
blocking socket. This manifests itself with the run_menu loop
consuming most of the available CPU time

View differences:

wconsd.c
WORD i;
unsigned long zero=0;
fd_set set_read;
/* IAC WILL ECHO */
/* IAC WILL suppress go ahead */
......
send_help(conn);
netprintf(conn,"> ");
FD_ZERO(&set_read);
while (conn->menuactive) {
FD_SET(conn->net,&set_read);
select(conn->net+1,&set_read,NULL,NULL,NULL);
size=recv(conn->net,(void*)&buf,BUFSIZE,0);
if (size==0) {

Also available in: Unified diff