Skip to content

Commit c8dcb95

Browse files
ryanschneiderfjl
authored andcommitted
rpc: use HTTP request context as top-level context (#16861)
1 parent af28d12 commit c8dcb95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rpc/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
181181
// All checks passed, create a codec that reads direct from the request body
182182
// untilEOF and writes the response to w and order the server to process a
183183
// single request.
184-
ctx := context.Background()
184+
ctx := r.Context()
185185
ctx = context.WithValue(ctx, "remote", r.RemoteAddr)
186186
ctx = context.WithValue(ctx, "scheme", r.Proto)
187187
ctx = context.WithValue(ctx, "local", r.Host)

0 commit comments

Comments
 (0)