Ticket #2676: udp-dont-wait-too-long.patch
File udp-dont-wait-too-long.patch, 2.6 KB (added by , 8 months ago) |
---|
-
xpra/net/udp_protocol.py
128 128 super().__init__(*args) 129 129 self.mtu = 0 130 130 self.last_sequence = -1 #the most recent packet sequence we processed in full 131 self.last_sequence_time = 0 131 132 self.highest_sequence = -1 132 133 self.jitter = 20 #20ms 133 134 self.uuid = kwargs.get("uuid", 0) … … 179 180 if self._closed: 180 181 return False 181 182 missing = self._get_missing() 183 log.info("send_control() missing=%s", missing) 182 184 packet = ("udp-control", self.mtu, self.asynchronous_receive_enabled, 183 185 self.last_sequence, self.highest_sequence, missing, tuple(self.cancel)) 184 186 log("send_control() packet(%s)=%s", self.pending_packets, ellipsizer(packet)) … … 368 370 if synchronous: 369 371 #we have to wait for the missing chunks / packets 370 372 log("process_udp_data: queuing %i as we're still waiting for %i", seqno, self.last_sequence+1) 373 if self.last_sequence_time: 374 elapsed = self.last_sequence_time-monotonic_time() 375 if elapsed>10: 376 log.error("Error: UDP protocol error") 377 log.error(" sequence %i is taking far too long", self.last_sequence+1) 378 self.close() 371 379 return 372 380 missing = tuple(i for i, x in enumerate(ip.chunks) if x is None) 373 381 if missing: … … 394 402 seqno, len(data), chunk, synchronous!=0) 395 403 if seqno==self.last_sequence+1: 396 404 self.last_sequence = seqno 405 self.last_sequence_time = monotonic_time() 397 406 else: 398 407 assert not synchronous 399 408 self.can_skip.add(seqno) … … 419 428 pass 420 429 self.can_skip.remove(seqno) 421 430 self.last_sequence = seqno 431 self.last_sequence_time = monotonic_time() 422 432 continue 423 433 ip = self.pending_packets.get(seqno) 424 434 if not ip or not ip.chunks: … … 432 442 data = b"".join(ip.chunks) 433 443 log("process_pending: adding packet sequence %5i to read queue", seqno) 434 444 self.last_sequence = seqno 445 self.last_sequence_time = monotonic_time() 435 446 self._read_queue_put(data) 436 447 437 448 def raw_write(self, packet_type, items, start_cb=None, end_cb=None, fail_cb=None, synchronous=True, _more=False):