Skip to content

Commit

Permalink
re-compress window-icon packet data to avoid large packet warnings, a…
Browse files Browse the repository at this point in the history
…nd generalize the code already used for cursors

git-svn-id: https://xpra.org/svn/Xpra/trunk@9163 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 27, 2015
1 parent 54f7858 commit 8f45add
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/xpra/server/proxy_instance_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,23 @@ def get_server_packet(self):
log("sending to server: %s", p[0])
return p, None, None, self.server_packets.qsize()>0


def _packet_recompress(self, packet, index, name):
if len(packet)>index:
data = packet[index]
if len(data)<512:
packet[8] = str(data)
return
#FIXME: this is ugly and not generic!
zlib = compression.use_zlib and self.caps.get("zlib", True)
lz4 = compression.use_lz4 and self.caps.get("lz4", False)
lzo = compression.use_lzo and self.caps.get("lzo", False)
if zlib or lz4 or lzo:
packet[index] = compressed_wrapper(name, data, zlib=zlib, lz4=lz4, lzo=lzo, can_inline=False)
else:
#prevent warnings about large uncompressed data
packet[index] = Compressed("raw %s" % name, data, can_inline=True)

def process_server_packet(self, proto, packet):
packet_type = packet[0]
log("process_server_packet: %s", packet_type)
Expand Down Expand Up @@ -515,20 +532,9 @@ def process_server_packet(self, proto, packet):
#packet = ["cursor", x, y, width, height, xhot, yhot, serial, pixels, name]
#or:
#packet = ["cursor", ""]
if len(packet)>=9:
pixels = packet[8]
if len(pixels)<512:
packet[8] = str(pixels)
else:
#FIXME: this is ugly and not generic!
zlib = compression.use_zlib and self.caps.get("zlib", True)
lz4 = compression.use_lz4 and self.caps.get("lz4", False)
lzo = compression.use_lzo and self.caps.get("lzo", False)
if zlib or lz4 or lzo:
packet[8] = compressed_wrapper("cursor", pixels, zlib=zlib, lz4=lz4, lzo=lzo, can_inline=False)
else:
#prevent warnings about large uncompressed data
packet[8] = Compressed("raw cursor", pixels, can_inline=True)
self._packet_recompress(packet, 8, "cursor")
elif packet_type=="window-icon":
self._packet_recompress(packet, 5, "icon")
self.queue_client_packet(packet)


Expand Down

0 comments on commit 8f45add

Please sign in to comment.