Commit f77aa11e by Sheng

Changed string formatting

parent c3542a5e
...@@ -73,12 +73,12 @@ class Worker(object): ...@@ -73,12 +73,12 @@ class Worker(object):
if errno_from_exception(e) in _ERRNO_CONNRESET: if errno_from_exception(e) in _ERRNO_CONNRESET:
self.close() self.close()
else: else:
logging.debug('"{}" from {}:{}'.format(data, *self.dst_addr)) logging.debug('{!r} from {}:{}'.format(data, *self.dst_addr))
if not data: if not data:
self.close() self.close()
return return
logging.debug('"{}" to {}:{}'.format(data, *self.handler.src_addr)) logging.debug('{!r} to {}:{}'.format(data, *self.handler.src_addr))
try: try:
self.handler.write_message(data) self.handler.write_message(data)
except tornado.websocket.WebSocketClosedError: except tornado.websocket.WebSocketClosedError:
...@@ -90,7 +90,7 @@ class Worker(object): ...@@ -90,7 +90,7 @@ class Worker(object):
return return
data = ''.join(self.data_to_dst) data = ''.join(self.data_to_dst)
logging.debug('"{}" to {}:{}'.format(data, *self.dst_addr)) logging.debug('{!r} to {}:{}'.format(data, *self.dst_addr))
try: try:
sent = self.chan.send(data) sent = self.chan.send(data)
...@@ -288,7 +288,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler): ...@@ -288,7 +288,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
self.close() self.close()
def on_message(self, message): def on_message(self, message):
logging.debug('"{}" from {}:{}'.format(message, *self.src_addr)) logging.debug('{!r} from {}:{}'.format(message, *self.src_addr))
worker = self.worker_ref() worker = self.worker_ref()
worker.data_to_dst.append(message) worker.data_to_dst.append(message)
worker.on_write() worker.on_write()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment