server won't exit when a streaming connection is active

Dereck <[email protected]> Sat, 17 Feb 2018 12:18:28 -0800 (PST)
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hi all, I am pretty new to cherrypy and have been playing around with it 
and ran into an issue. I have my server serving up a streaming response for 
mjpeg. It work wonderfully until I want to stop the server. It will not 
exit if there is an active connection. The output gets stuck at "Stopping 
Engine Bus". Is there a way to force the server to shutdown even if there 
are active connections. My code is as follows:


class HelloWorld(object):
    @cherrypy.expose
    def index(self):
        
cherrypy.response.headers['Content-Type']='multipart/x-mixed-replace; 
boundary=frame'
        def content():
            while True:
                yield (b'--frame\r\n'
                       b'Content-Type: image/jpeg\r\n\r\n'+ frame + b'\r\n')
        return content()
    index._cp_config = {'response.stream': True}


def Start():
    cherrypy.config.update({'server.socket_host': '0.0.0.0', 
'server.socket_port': 9090})
    cherrypy.tree.mount(HelloWorld(),"/")
    cherrypy.engine.start()


def Stop():
    cherrypy.engine.stop()
    cherrypy.engine.exit()




-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.