Skip to content

Commit

Permalink
Fix incorrect client retransmissions
Browse files Browse the repository at this point in the history
introduced by ec76652. If Client has gone to finished we know that
server sent Finished. No reason to ever re-send messages.

Resolves pion/webrtc#2909
  • Loading branch information
Sean-Der committed Oct 6, 2024
1 parent d7f5fee commit 98a05d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion handshaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ func (s *handshakeFSM) finish(ctx context.Context, c flightConn) (handshakeState
select {
case state := <-c.recvHandshake():
close(state.done)
return handshakeSending, nil
if s.state.isClient {
return handshakeFinished, nil
} else {
return handshakeSending, nil
}
case <-ctx.Done():
return handshakeErrored, ctx.Err()
}
Expand Down
4 changes: 2 additions & 2 deletions handshaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ func TestHandshaker(t *testing.T) {
t.Errorf("Client is not finished")
}
// there should be no `Finished` last retransmit from client
if cntClientFinishedLastRetransmit != 4 {
t.Errorf("Number of client finished last retransmit is wrong, expected: %d times, got: %d times", 4, cntClientFinishedLastRetransmit)
if cntClientFinishedLastRetransmit != 0 {
t.Errorf("Number of client finished last retransmit is wrong, expected: %d times, got: %d times", 0, cntClientFinishedLastRetransmit)
}
if cntServerFinished < 1 {
t.Errorf("Number of server finished is wrong, expected: at least %d times, got: %d times", 1, cntServerFinished)
Expand Down

0 comments on commit 98a05d6

Please sign in to comment.