Skip to content

Commit

Permalink
review feedback: don't need separate trailerWritten flag; can use lat…
Browse files Browse the repository at this point in the history
…estEnvelope.trailer flag instead

Signed-off-by: Josh Humphries <[email protected]>
  • Loading branch information
jhump committed Nov 4, 2024
1 parent 7973f77 commit 69690b0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,6 @@ type transformingWriter struct {
expectingBytes int
writingEnvelope bool
latestEnvelope envelope
trailerWritten bool
}

func (w *transformingWriter) Write(data []byte) (n int, err error) {
Expand Down Expand Up @@ -1615,7 +1614,7 @@ func (w *transformingWriter) Write(data []byte) (n int, err error) {
w.rw.reportError(err)
return written, err
}
if w.trailerWritten && len(data) == 0 {
if w.latestEnvelope.trailer && len(data) == 0 {
// All done.
return written, nil
}
Expand Down Expand Up @@ -1664,7 +1663,6 @@ func (w *transformingWriter) flushMessage() error {
end.wasCompressed = w.latestEnvelope.compressed
w.rw.reportEnd(&end)
w.err = errFinalDataAlreadyWritten
w.trailerWritten = true
return nil
}

Expand Down

0 comments on commit 69690b0

Please sign in to comment.