Skip to content

Commit

Permalink
fix concurrent map access
Browse files Browse the repository at this point in the history
  • Loading branch information
arriven committed Apr 5, 2022
1 parent 6b9d2a8 commit 1ff9954
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/job/rawnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ func parseRawNetJobArgs(ctx context.Context, logger *zap.Logger, globalConfig *G
return nil, fmt.Errorf("error decoding rawnet job config: %w", err)
}

args["connection"] = map[string]any{
packetgenArgs := make(map[string]any)
for k, v := range args {
packetgenArgs[k] = v
}

packetgenArgs["connection"] = map[string]any{
"type": "net",
"args": map[string]any{
"protocol": protocol,
Expand All @@ -81,7 +86,7 @@ func parseRawNetJobArgs(ctx context.Context, logger *zap.Logger, globalConfig *G
"proxy_urls": jobConfig.ProxyURLs,
},
}
args["packet"] = map[string]any{
packetgenArgs["packet"] = map[string]any{
"payload": map[string]any{
"type": "raw",
"data": map[string]any{
Expand All @@ -90,5 +95,5 @@ func parseRawNetJobArgs(ctx context.Context, logger *zap.Logger, globalConfig *G
},
}

return args, nil
return packetgenArgs, nil
}

0 comments on commit 1ff9954

Please sign in to comment.