Skip to content

Commit ff2fe74

Browse files
committed
Add TODO for onFLightState13 callback
1 parent e750858 commit ff2fe74

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

conn.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,11 +1505,10 @@ func (c *Conn) handshake(
15051505
closed: make(chan struct{}),
15061506
}
15071507
c.handshakeConfig.onFlightState13 = func(_ flightVal13, s handshakeState) {
1508-
currentFlight := c.fsm.(*handshakeFSM13).currentFlight //nolint:forcetypeassert
1509-
shouldClose := currentFlight.isLastSendFlight() || currentFlight.isLastRecvFlight()
1510-
//nolint:godox
1508+
// The ACK for the last flights has been received and we are in a Finished state.
1509+
// nolint:godox
15111510
// TODO: should be moved to FSM.
1512-
if shouldClose && c.setHandshakeCompletedSuccessfully() {
1511+
if s == handshakeFinished && c.setHandshakeCompletedSuccessfully() {
15131512
close(done)
15141513
}
15151514
}

handshaker_13.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ func (s *handshakeFSM13) Run(ctx context.Context, conn flightConn, initialState
7676
}()
7777
for {
7878
s.cfg.log.Tracef("[handshake13:%s] %s: %s", srvCliStr(s.state.isClient), s.currentFlight.String(), state.String())
79+
// nolint:godox
80+
// TODO:: refactor callback, see discussion in https://github.com/pion/dtls/pull/738#discussion_r3131501159
7981
if s.cfg.onFlightState13 != nil {
8082
s.cfg.onFlightState13(s.currentFlight, state)
8183
}

0 commit comments

Comments
 (0)