• Denis Bilenko's avatar
    add server.DatagramServer; modify baseserver.BaseServer in such a way that... · 38197f23
    Denis Bilenko authored
    add server.DatagramServer; modify baseserver.BaseServer in such a way that makes it a good base class for both StreamServer and DatagramServer
    
    baseserver.py:
    - BaseServer no longer accepts 'backlog' parameter. It is now done by StreamServer.
    - BaseServer implements start_accepting() and stop_accepting() methods
    - BaseServer now implements "termporarily stop accepting" strategy
    - BaseServer now has _do_read method which does everything except for actually calling accept()/recvfrom()
    - pre_start() method is renamed to init_socket()
    - renamed _stopped_event to _stop_event
    - 'started' is now a read-only property (which actually reports state of _stop_event)
    - post_stop() method is removed
    - close() now sets _stop_event(), thus setting 'started' to False, thus causing serve_forever() to exit
    - _tcp_listener() function is moved from baseserver.py to server.py
    - added 'fatal_errors' class attribute which is a tuple of all errnos that should kill the server
    
    server.py:
    - StreamServer: 'ssl_enabled' is now a read-only property
    38197f23
test__server.py 11.2 KB