We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0fc6f1d commit 9ae0471Copy full SHA for 9ae0471
1 file changed
scapy/contrib/isotp/isotp_soft_socket.py
@@ -611,7 +611,14 @@ def can_recv(self):
611
log_isotp.warning("Error in can_recv: %s",
612
traceback.format_exc())
613
if not self.closed and not self.can_socket.closed:
614
- if self.can_socket.select([self.can_socket], 0):
+ # Determine poll_time from ISOTP state only.
615
+ # Avoid calling select() here — on slow serial interfaces
616
+ # (slcan), each select() triggers a mux() call that reads
617
+ # N frames at ~2.5ms each, wasting time that could be spent
618
+ # processing frames already in the rx_queue.
619
+ if self.rx_state == ISOTP_WAIT_DATA or \
620
+ self.tx_state == ISOTP_WAIT_FC or \
621
+ self.tx_state == ISOTP_WAIT_FIRST_FC:
622
poll_time = 0.0
623
else:
624
poll_time = self.rx_tx_poll_rate
0 commit comments