Ticket #6325: 6325.patch

File 6325.patch, 2.2 KB (added by eddie, 9 years ago)

Directly invoke internet.StreamServerEndpointService

  • twisted/web/tap.py

     
    99
    1010# Twisted Imports
    1111from twisted.web import server, static, twcgi, script, demo, distrib, wsgi
    12 from twisted.internet import interfaces, reactor
     12from twisted.internet import interfaces, reactor, endpoints
    1313from twisted.python import usage, reflect, threadpool
    1414from twisted.spread import pb
    15 from twisted.application import internet, service, strports
     15from twisted.application import internet, service
    1616
    1717
    1818class Options(usage.Options):
     
    2121    """
    2222    synopsis = "[web options]"
    2323
    24     optParameters = [["port", "p", None, "strports description of the port to "
    25                       "start the server on."],
     24    optParameters = [["port", "p", None, "The port to start the server on."],
    2625                     ["logfile", "l", None, "Path to web CLF (Combined Log Format) log file."],
    2726                     ["https", None, None, "Port to listen on for Secure HTTP."],
    2827                     ["certificate", "c", "server.pem", "SSL certificate to use for HTTPS. "],
     
    217216    site.displayTracebacks = not config["notracebacks"]
    218217
    219218    if config['personal']:
    220         personal = strports.service(
    221             config['port'], makePersonalServerFactory(site))
     219        personal = internet.StreamServerEndpointService(
     220            endpoints._serverFromStringLegacy(reactor, config['port'], None),
     221            makePersonalServerFactory(site))
     222        personal._raiseSynchronously = True
    222223        personal.setServiceParent(s)
    223224    else:
    224225        if config['https']:
     
    227228                          DefaultOpenSSLContextFactory(config['privkey'],
    228229                                                       config['certificate']))
    229230            i.setServiceParent(s)
    230         strports.service(config['port'], site).setServiceParent(s)
     231        svc = internet.StreamServerEndpointService(
     232                endpoints._serverFromStringLegacy(reactor, config['port'], None),
     233                site)
     234        svc._raiseSynchronously = True
     235        svc.setServiceParent(s)
    231236
    232237    return s