Fix WebSockets to work with Twisted 17.1

Underlying PR that broke things: https://github.com/twisted/twisted/pull/591
We're relying on a private API so this is not really Twisted's fault.
This commit is contained in:
Andrew Godwin 2017-02-12 18:25:32 -08:00
parent 9853bf1740
commit b65140b158

View File

@ -121,7 +121,11 @@ class WebRequest(http.Request):
del self.factory.reply_protocols[self.reply_channel] del self.factory.reply_protocols[self.reply_channel]
self.reply_channel = None self.reply_channel = None
# Resume the producer so we keep getting data, if it's available as a method # Resume the producer so we keep getting data, if it's available as a method
if hasattr(self.channel, "resumeProducing"): # 17.1 version
if hasattr(self.channel, "_networkProducer"):
self.channel._networkProducer.resumeProducing()
# 16.x version
elif hasattr(self.channel, "resumeProducing"):
self.channel.resumeProducing() self.channel.resumeProducing()
# Boring old HTTP. # Boring old HTTP.