Skip to content

Commit cc72abb

Browse files
authored
Fix socketcand erroneously discarding frames (#1700)
The __receive_buffer is always truncated by [chars_processed_successfully + 1:]. When a partial socketcand frame is received, chars_processed_successfully is 0, and this results in 1 character being discarded. This will be the '<' character, and thus when the rest of the frame is received, it will be treated as a bad frame, and discarded.
1 parent 2e58a21 commit cc72abb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

can/interfaces/socketcand/socketcand.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ def _recv_internal(self, timeout):
191191
self.__message_buffer.append(parsed_can_message)
192192
buffer_view = buffer_view[end + 1 :]
193193

194-
self.__receive_buffer = self.__receive_buffer[
195-
chars_processed_successfully + 1 :
196-
]
194+
self.__receive_buffer = self.__receive_buffer[chars_processed_successfully:]
197195
can_message = (
198196
None
199197
if len(self.__message_buffer) == 0

0 commit comments

Comments
 (0)