From e7b323893f73c06742f79116a4b0f4c992faf2f3 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Mon, 21 Mar 2016 16:40:29 -0700 Subject: [PATCH] Change to new style of single-reader channel --- daphne/http_protocol.py | 6 +++--- daphne/ws_protocol.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index 3070fda..0dd8fe9 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -45,7 +45,7 @@ class WebRequest(http.Request): # Easy factory link self.factory = self.channel.factory # Make a name for our reply channel - self.reply_channel = self.factory.channel_layer.new_channel("!http.response.?") + self.reply_channel = self.factory.channel_layer.new_channel("http.response!") # Tell factory we're that channel's client self.last_keepalive = time.time() self.factory.reply_protocols[self.reply_channel] = self @@ -235,9 +235,9 @@ class HTTPFactory(http.HTTPFactory): return self.reply_protocols.keys() def dispatch_reply(self, channel, message): - if channel.startswith("!http") and isinstance(self.reply_protocols[channel], WebRequest): + if channel.startswith("http") and isinstance(self.reply_protocols[channel], WebRequest): self.reply_protocols[channel].serverResponse(message) - elif channel.startswith("!websocket") and isinstance(self.reply_protocols[channel], WebSocketProtocol): + elif channel.startswith("websocket") and isinstance(self.reply_protocols[channel], WebSocketProtocol): if message.get("bytes", None): self.reply_protocols[channel].serverSend(message["bytes"], True) if message.get("text", None): diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index ec30799..6dc2d00 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -35,7 +35,7 @@ class WebSocketProtocol(WebSocketServerProtocol): # TODO: get autobahn to provide it raw query_string = urlencode(request.params, doseq=True).encode("ascii") # Make sending channel - self.reply_channel = self.channel_layer.new_channel("!websocket.send.?") + self.reply_channel = self.channel_layer.new_channel("websocket.send!") # Tell main factory about it self.main_factory.reply_protocols[self.reply_channel] = self # Make initial request info dict from request (we only have it here)