Skip to content

Commit b65c4a6

Browse files
committed
grpcproxy: use metadata instead of context withvalue in with client auth token
Signed-off-by: Kristoffer Johansson <[email protected]>
1 parent 854bdd6 commit b65c4a6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/proxy/grpcproxy/util.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ func getAuthTokenFromClient(ctx context.Context) string {
3737
func withClientAuthToken(ctx, ctxWithToken context.Context) context.Context {
3838
token := getAuthTokenFromClient(ctxWithToken)
3939
if token != "" {
40-
ctx = context.WithValue(ctx, rpctypes.TokenFieldNameGRPCKey{}, token)
40+
md := metadata.Pairs(rpctypes.TokenFieldNameGRPC, token)
41+
return metadata.NewOutgoingContext(ctx, md)
4142
}
4243
return ctx
4344
}

server/proxy/grpcproxy/watch_broadcasts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func (wbs *watchBroadcasts) coalesce(wb *watchBroadcast) {
7070
wbs.watchers[w] = wbswb
7171
}
7272
wb.receivers = nil
73+
watchersCoalescing.Inc()
7374
}
7475
wbswb.mu.Unlock()
7576
wb.mu.Unlock()

0 commit comments

Comments
 (0)