Skip to content

Commit

Permalink
Sipmlify check if checksum is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
mengelbart committed Nov 9, 2023
1 parent 2bf7c61 commit 1a0c73c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions association.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,10 @@ func needsCorrectChecksum(cc []chunk) bool {
}

func (a *Association) marshalPacket(p *packet) ([]byte, error) {
if needsCorrectChecksum(p.chunks) {
if !a.useZeroChecksum || needsCorrectChecksum(p.chunks) {
return p.marshal()
}
if a.useZeroChecksum {
return p.marshalWithoutChecksum()
}
return p.marshal()
return p.marshalWithoutChecksum()

Check warning on line 638 in association.go

View check run for this annotation

Codecov / codecov/patch

association.go#L638

Added line #L638 was not covered by tests
}

func (a *Association) unmarshalPacket(raw []byte) (*packet, error) {
Expand Down

0 comments on commit 1a0c73c

Please sign in to comment.