Add a que for multimessages#64
Open
kellergoech wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a send-queue mechanism to the J1939-21 transport-protocol path so multi-packet messages triggered while another transfer is active can be buffered and sent later, reducing the need for application-side flow control.
Changes:
- Introduced a new
_snd_questructure to buffer pending multi-packet sends. - Refactored multi-packet send initialization into a new helper (
_put_multi_msg). - Added queue-draining logic to
async_job_threadto start a queued transfer once sending becomes idle.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "num_packages": num_packets, | ||
| "data": data, | ||
| "state": self.SendBufferState.SENDING_BM, | ||
| "deadline": time.time() + self._minimum_tp_bam_dt_interval, |
| "num_packages": num_packets, | ||
| "data": data, | ||
| "state": self.SendBufferState.WAITING_CTS, | ||
| "deadline": time.time() + self.Timeout.T3, |
Comment on lines
+213
to
+217
| if not bool(self._snd_buffer): | ||
| for key, value in self._snd_que.items(): | ||
| self._put_multi_msg(**value) | ||
| self._snd_que.pop(key) | ||
| break |
Comment on lines
+177
to
+184
| self._snd_que[pgn.value] = {'buffer_hash': buffer_hash, | ||
| 'pdu_specific': pdu_specific, | ||
| 'priority': priority, | ||
| 'src_address':src_address, | ||
| 'pgn': pgn, | ||
| 'data': data, | ||
| 'dest_address': dest_address} | ||
| return False |
khauersp
reviewed
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The que will buffer messages when these are triggered while sending of another message is still active. The que will be overwritten by new messages when sending is not active.
-> Therefore the application which uses this function does not need to care about the state of the send buffer.