Skip to content

Commit

Permalink
minor optimizations: data and buf are already an array of bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Jul 30, 2021
1 parent 9c7d3f8 commit dfcc14e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bufferflow_timedbinary.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func (b *BufferflowTimedBinary) Init() {
for {
select {
case data := <-b.Input:
bufferedOutputBinary = append(bufferedOutputBinary, []byte(data)...)
bufferedOutputBinary = append(bufferedOutputBinary, data...)
sPortBinary = b.Port
case <-b.ticker.C:
if bufferedOutputBinary != nil {
m := SpPortMessageRaw{sPortBinary, bufferedOutputBinary}
buf, _ := json.Marshal(m)
b.Output <- []byte(buf)
b.Output <- buf
bufferedOutputBinary = nil
sPortBinary = ""
}
Expand Down

0 comments on commit dfcc14e

Please sign in to comment.