Skip to content

Commit

Permalink
Switch to switch statement for readability
Browse files Browse the repository at this point in the history
Relates to pion/webrtc#1270
  • Loading branch information
enobufs committed Jul 15, 2020
1 parent b910e4a commit e9599dc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions association.go
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,12 @@ func (a *Association) handleHeartbeat(c *chunkHeartbeat) []*packet {
func (a *Association) handleCookieEcho(c *chunkCookieEcho) []*packet {
state := a.getState()
a.log.Debugf("[%s] COOKIE-ECHO received in state '%s'", a.name, getAssociationStateString(state))
if state != established {
if state != closed && state != cookieWait && state != cookieEchoed {
return nil
}
switch state {
default:
return nil
case established:
break
case closed, cookieWait, cookieEchoed:
if !bytes.Equal(a.myCookie.cookie, c.cookie) {
return nil
}
Expand Down

0 comments on commit e9599dc

Please sign in to comment.