Skip to content

Commit

Permalink
feat(common.socket): return decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsStegman committed Oct 1, 2024
1 parent ee4addf commit af95ac7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/common/socket/datagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ func (l *packetListener) listenData(onData CallbackData, onError CallbackError)
d := make([]byte, n)
copy(d, buf[:n])
l.parsePool.Submit(func() {
body, err := l.decoders.Get().(internal.ContentDecoder).Decode(d)
decoder := l.decoders.Get().(internal.ContentDecoder)
defer l.decoders.Put(decoder)
body, err := decoder.Decode(d)
if err != nil && onError != nil {
onError(fmt.Errorf("unable to decode incoming packet: %w", err))
}
Expand Down

0 comments on commit af95ac7

Please sign in to comment.