Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 845

Show
Ignore:
Timestamp:
11/28/05 11:47:21
Author:
fumanchu
Message:

Changed the raw tuple of "socket errors to ignore" to a global socket_errors_to_ignore list.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpwsgiserver.py

    r843 r845  
    1212monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 
    1313                   'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] 
     14 
     15import errno 
     16socket_errors_to_ignore = [] 
     17# Not all of these names will be defined for every platform. 
     18for _ in ("EPIPE", "ETIMEDOUT", "ECONNREFUSED", "ECONNRESET", 
     19          "EHOSTDOWN", "EHOSTUNREACH", 
     20          "WSAECONNABORTED", "WSAECONNREFUSED", "WSAECONNRESET", 
     21          "WSAENETRESET", "WSAETIMEDOUT"): 
     22    if _ in dir(errno): 
     23        socket_errors_to_ignore.append(getattr(errno, _)) 
     24# de-dupe the list 
     25socket_errors_to_ignore = dict.fromkeys(socket_errors_to_ignore).keys() 
    1426 
    1527 
     
    158170                    except socket.error, e: 
    159171                        errno = e.args[0] 
    160                         if errno in (32, 104, 113, 10053, 10054): 
    161                             # Client probably closed the connection before the 
    162                             # response was sent. 
     172                        if errno in socket_errors_to_ignore: 
    163173                            pass 
    164174                        else: 

Hosted by WebFaction

Log in as guest/cpguest to create tickets