From 58e153c3512612557076688be071b69bba86b734 Mon Sep 17 00:00:00 2001 From: Eric Daniels Date: Wed, 28 Feb 2024 11:24:26 -0500 Subject: [PATCH] Go to COOKIE_WAIT after T1-init start --- association.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/association.go b/association.go index aba18ea8..3b928820 100644 --- a/association.go +++ b/association.go @@ -378,7 +378,6 @@ func (a *Association) init(isClient bool) { go a.writeLoop() if isClient { - a.setState(cookieWait) init := &chunkInit{} init.initialTSN = a.myNextTSN init.numOutboundStreams = a.myMaxNumOutboundStreams @@ -398,6 +397,11 @@ func (a *Association) init(isClient bool) { a.log.Errorf("[%s] failed to send init: %s", a.name, err.Error()) } + // After sending the INIT chunk, "A" starts the T1-init timer and enters the COOKIE-WAIT state. + // Note: ideally we would set state after the timer starts but since we don't do this in an atomic + // set + timer-start, it's safer to just set the state first so that we don't have a timer expiration + // race. + a.setState(cookieWait) a.t1Init.start(a.rtoMgr.getRTO()) } } @@ -1175,6 +1179,7 @@ func (a *Association) handleInit(p *packet, i *chunkInit) ([]*packet, error) { outbound.destinationPort = a.destinationPort initAck := &chunkInitAck{} + a.log.Debug("sending INIT ACK") initAck.initialTSN = a.myNextTSN initAck.numOutboundStreams = a.myMaxNumOutboundStreams