Skip to content

Commit

Permalink
simplify: KeyError should be rare
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@23550 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 21, 2019
1 parent 7910ccd commit 8cb8124
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/xpra/server/window/window_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,15 +2138,15 @@ def damage_packet_acked(self, damage_packet_sequence, width, height, decode_time
self.statistics.client_decode_time.append((monotonic_time(), width*height, decode_time))
elif decode_time<0:
self.client_decode_error(decode_time, message)
pending = self.statistics.damage_ack_pending.get(damage_packet_sequence)
if pending is None:
try:
pending = self.statistics.damage_ack_pending.pop(damage_packet_sequence)
except KeyError:
log("cannot find sent time for sequence %s", damage_packet_sequence)
return
del self.statistics.damage_ack_pending[damage_packet_sequence]
gs = self.global_statistics
start_send_at, _, start_bytes, end_send_at, end_bytes, pixels, client_options, damage_time = pending
bytecount = end_bytes-start_bytes
#it is possible
#it is possible though unlikely
#that we get the ack before we've had a chance to call
#damage_packet_sent, so we must validate the data:
if bytecount>0 and end_send_at>0:
Expand Down

0 comments on commit 8cb8124

Please sign in to comment.