Changeset 269

Show
Ignore:
Timestamp:
11/10/04 21:49:11 (9 years ago)
Author:
alexcv
Message:

Fixed

Location:
trunk/wifidog
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog/ChangeLog

    r261 r269  
    11# $Header$ 
     2 
     32004-11-10 Alexandre Carmel-Veilleux <acv@acv.ca> 
     4        * libhttpd/protocol.c: select() based timeout. 
    25 
    362004-10-31 Alexandre Carmel-Veilleux <acv@acv.ca> 
  • trunk/wifidog/libhttpd/protocol.c

    r253 r269  
    3737#include "httpd_priv.h" 
    3838 
    39  
    4039int _httpd_net_read(sock, buf, len) 
    4140        int     sock; 
     
    4645        return( recv(sock, buf, len, 0)); 
    4746#else 
    48         return( read(sock, buf, len)); 
     47        /*return( read(sock, buf, len));*/ 
     48        /* XXX Select based IO */ 
     49 
     50        int             nfds; 
     51        fd_set          readfds; 
     52        struct timeval  timeout; 
     53         
     54        FD_ZERO(&readfds); 
     55        FD_SET(sock, &readfds); 
     56        timeout.tv_sec = 10; 
     57        timeout.tv_usec = 0; 
     58        nfds = sock + 1; 
     59 
     60        nfds = select(nfds, &readfds, NULL, NULL, &timeout); 
     61 
     62        if (nfds > 0) { 
     63                return(read(sock, buf, len)); 
     64        } else { 
     65                return(-1); 
     66        } 
    4967#endif 
    5068}