turn compression on
This commit is contained in:
@@ -11,7 +11,6 @@ import string
|
||||
import select
|
||||
import errno
|
||||
import traceback
|
||||
import urllib2
|
||||
import md5
|
||||
import shutil
|
||||
import zlib
|
||||
@@ -94,10 +93,9 @@ class Conn:
|
||||
msg['id'] = self.conId
|
||||
msg['ver'] = VER
|
||||
msg['time'] = time.time()
|
||||
m = dicttos(ID, msg)
|
||||
mz = zlib.compress(m,9)
|
||||
m = dicttos(ID, msg, True) # always compress
|
||||
if verbose:
|
||||
log("conn.send('%s', (%s:%s) %s>%s)" % (msg, self.addr, self.port, len(m), len(mz)))
|
||||
log("conn.send('%s', (%s:%s) %s)" % (msg, self.addr, self.port, len(m)))
|
||||
try:
|
||||
self.sock.sendto(m, (self.addr, self.port))
|
||||
except socket.error as e:
|
||||
@@ -131,7 +129,7 @@ def shortname(name):
|
||||
|
||||
def dicttos(ID, d, compress=False):
|
||||
s = []
|
||||
for k in d:
|
||||
for k in d:
|
||||
if type(d[k]) == type(1.2):
|
||||
s.append("%s=%0.5f" % (k, d[k]))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user