Skip to content

Commit

Permalink
for smallish packets, queue the size and data together
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@246 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Oct 24, 2011
1 parent 091c854 commit 47dd1a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/xpra/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ def _flush_one_packet_into_buffer(self):
if packet is not None:
log("writing %s", dump_packet(packet), type="raw.write")
data = bencode(packet)
if self._send_size:
self._queue_write("PS%014d" % len(data))
self._queue_write(data, True)
l = len(data)
if l<=1024:
#send size and data together (low copy overhead):
self._queue_write("PS%014d%s" % (l, data), True)
else:
if self._send_size:
self._queue_write("PS%014d" % l)
self._queue_write(data, True)

def _write_thread_loop(self):
try:
Expand Down

0 comments on commit 47dd1a2

Please sign in to comment.