Atomic write to fix error

This commit is contained in:
Xiaomao Chen 2014-09-30 19:12:55 -04:00
parent e4593d51fc
commit 3d4b5ed8b1

View File

@ -147,8 +147,7 @@ class JudgeHandler(SocketServer.StreamRequestHandler):
def _send(self, data):
data = json.dumps(data, separators=(',', ':'))
compress = data.encode('zlib')
self.wfile.write(size_pack.pack(len(compress)))
self.wfile.write(compress)
self.wfile.write(size_pack.pack(len(compress)) + compress)
def _packet(self, data):
try: