mirror of
https://github.com/nonoo/kappanhang.git
synced 2026-04-05 06:25:18 +00:00
Decrease latency of RX seqbuf
This commit is contained in:
parent
44f5b15994
commit
bed7d95f7c
5 changed files with 220 additions and 116 deletions
|
|
@ -106,15 +106,7 @@ func (s *serialStream) handleRxSeqBufEntry(e seqBufEntry) {
|
|||
|
||||
func (s *serialStream) handleSerialPacket(r []byte) error {
|
||||
gotSeq := binary.LittleEndian.Uint16(r[6:8])
|
||||
addedToFront, _ := s.rxSeqBuf.add(seqNum(gotSeq), r)
|
||||
|
||||
// If the packet is not added to the front of the seqbuf, then it means that it was an answer for a
|
||||
// retransmit request (or it was an out of order packet which we don't want start a retransmit).
|
||||
if !addedToFront {
|
||||
return nil
|
||||
}
|
||||
|
||||
return s.common.requestRetransmitIfNeeded(gotSeq)
|
||||
return s.rxSeqBuf.add(seqNum(gotSeq), r)
|
||||
}
|
||||
|
||||
func (s *serialStream) handleRead(r []byte) error {
|
||||
|
|
@ -246,7 +238,7 @@ func (s *serialStream) init(devName string) error {
|
|||
log.Print("stream started")
|
||||
|
||||
s.rxSeqBufEntryChan = make(chan seqBufEntry)
|
||||
s.rxSeqBuf.init(serialRxSeqBufLength, 0xffff, 0, s.rxSeqBufEntryChan)
|
||||
s.rxSeqBuf.init(serialRxSeqBufLength, 0xffff, 0, s.rxSeqBufEntryChan, s.common.requestRetransmit)
|
||||
|
||||
s.deinitNeededChan = make(chan bool)
|
||||
s.deinitFinishedChan = make(chan bool)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue