Skip to content

Commit

Permalink
make context first parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
haimrubinstein committed Jul 2, 2023
1 parent b86140a commit c4c6788
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/stanza/operator/input/udp/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (u *Input) goHandleMessages(ctx context.Context) {

if u.OneLogPerPacket {
log := truncateMaxLog(message)
handleMessage(u, ctx, remoteAddr, log)
handleMessage(ctx, u, remoteAddr, log)
continue
}

Expand All @@ -175,7 +175,7 @@ func (u *Input) goHandleMessages(ctx context.Context) {
scanner.Split(u.splitFunc)

for scanner.Scan() {
handleMessage(u, ctx, remoteAddr, scanner.Bytes())
handleMessage(ctx, u, remoteAddr, scanner.Bytes())
}
if err := scanner.Err(); err != nil {
u.Errorw("Scanner error", zap.Error(err))
Expand All @@ -197,7 +197,7 @@ func truncateMaxLog(data []byte) (token []byte) {
return data
}

func handleMessage(u *Input, ctx context.Context, remoteAddr net.Addr, log []byte) {
func handleMessage(ctx context.Context, u *Input, remoteAddr net.Addr, log []byte) {
decoded, err := u.encoding.Decode(log)
if err != nil {
u.Errorw("Failed to decode data", zap.Error(err))
Expand Down

0 comments on commit c4c6788

Please sign in to comment.