Skip to content

Commit

Permalink
maximum idiomaticness change to reset* methods
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed Nov 12, 2023
1 parent 72fe8d5 commit e6cab32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions control.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (tcb *ControlBlock) rcvListen(seg Segment) (err error) {
}
// Initialize all connection state:
tcb.resetSnd(tcb.snd.ISS, seg.WND)
tcb.resetRcv(seg.SEQ, tcb.rcv.WND)
tcb.resetRcv(tcb.rcv.WND, seg.SEQ)

// We must respond with SYN|ACK frame after receiving SYN in listen state (three way handshake).
tcb.pending = synack
Expand All @@ -196,14 +196,15 @@ func (tcb *ControlBlock) rcvSynSent(seg Segment) (err error) {
}

if hasAck {
tcb.resetRcv(seg.SEQ, tcb.rcv.WND)
tcb.state = StateEstablished
tcb.pending = FlagACK
tcb.resetRcv(tcb.rcv.WND, seg.SEQ)
} else {
// Simultaneous connection sync edge case.
tcb.pending = synack
tcb.state = StateSynRcvd
tcb.resetSnd(tcb.snd.ISS, seg.WND)
tcb.resetRcv(tcb.rcv.WND, seg.SEQ)
}
return nil
}
Expand Down Expand Up @@ -233,7 +234,7 @@ func (tcb *ControlBlock) resetSnd(localISS Value, remoteWND Size) {
}
}

func (tcb *ControlBlock) resetRcv(remoteISS Value, localWND Size) {
func (tcb *ControlBlock) resetRcv(localWND Size, remoteISS Value) {
tcb.rcv = recvSpace{
IRS: remoteISS,
NXT: remoteISS,
Expand Down

0 comments on commit e6cab32

Please sign in to comment.