Skip to content

Commit

Permalink
#3679 we may get memoryviews from compressors
Browse files Browse the repository at this point in the history
backport of 8fef1da
  • Loading branch information
totaam committed Nov 4, 2022
1 parent 91fdd9b commit c8aea5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions xpra/net/protocol.py
Expand Up @@ -590,10 +590,6 @@ def encode(self, packet_in):
ti = type(item)
if ti in (int, bool, dict, list, tuple):
continue
if ti==memoryview:
if self.encoder!="rencodeplus":
packet[i] = packet[i].tobytes()
continue
try:
l = len(item)
except TypeError as e:
Expand All @@ -605,6 +601,10 @@ def encode(self, packet_in):
packet[i] = item
ti = type(item)
#(it may now be a "Compressed" item and be processed further)
if ti==memoryview:
if self.encoder!="rencodeplus":
packet[i] = packet[i].tobytes()
continue
if issubclass(ti, LargeStructure):
packet[i] = item.data
continue
Expand All @@ -622,6 +622,8 @@ def encode(self, packet_in):
else:
#data is small enough, inline it:
packet[i] = item.data
if isinstance(item.data, memoryview) and self.encoder!="rencodeplus":
packet[i] = item.data.tobytes()
min_comp_size += l
size_check += l
elif ti==bytes and level>0 and l>LARGE_PACKET_SIZE:
Expand Down

0 comments on commit c8aea5a

Please sign in to comment.