Skip to content

Commit 55d35cd

Browse files
kielbarrykimmyeonghun
authored andcommitted
rpc: golint error with context as last parameter (ethereum#16657)
* rpc/*: golint error with context as last parameter * Update json.go
1 parent 337dc2c commit 55d35cd

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

rpc/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
191191
defer codec.Close()
192192

193193
w.Header().Set("content-type", contentType)
194-
srv.ServeSingleRequest(codec, OptionMethodInvocation, ctx)
194+
srv.ServeSingleRequest(ctx, codec, OptionMethodInvocation)
195195
}
196196

197197
// validateRequest returns a non-zero response code and error message if the

rpc/inproc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"net"
2222
)
2323

24-
// NewInProcClient attaches an in-process connection to the given RPC server.
24+
// DialInProc attaches an in-process connection to the given RPC server.
2525
func DialInProc(handler *Server) *Client {
2626
initctx := context.Background()
2727
c, _ := newClient(initctx, func(context.Context) (net.Conn, error) {

rpc/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (s *Server) RegisterName(name string, rcvr interface{}) error {
125125
// If singleShot is true it will process a single request, otherwise it will handle
126126
// requests until the codec returns an error when reading a request (in most cases
127127
// an EOF). It executes requests in parallel when singleShot is false.
128-
func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecOption, ctx context.Context) error {
128+
func (s *Server) serveRequest(ctx context.Context, codec ServerCodec, singleShot bool, options CodecOption) error {
129129
var pend sync.WaitGroup
130130

131131
defer func() {
@@ -216,14 +216,14 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
216216
// stopped. In either case the codec is closed.
217217
func (s *Server) ServeCodec(codec ServerCodec, options CodecOption) {
218218
defer codec.Close()
219-
s.serveRequest(codec, false, options, context.Background())
219+
s.serveRequest(context.Background(), codec, false, options)
220220
}
221221

222222
// ServeSingleRequest reads and processes a single RPC request from the given codec. It will not
223223
// close the codec unless a non-recoverable error has occurred. Note, this method will return after
224224
// a single request has been processed!
225-
func (s *Server) ServeSingleRequest(codec ServerCodec, options CodecOption, ctx context.Context) {
226-
s.serveRequest(codec, true, options, ctx)
225+
func (s *Server) ServeSingleRequest(ctx context.Context, codec ServerCodec, options CodecOption) {
226+
s.serveRequest(ctx, codec, true, options)
227227
}
228228

229229
// Stop will stop reading new requests, wait for stopPendingRequestTimeout to allow pending requests to finish,

0 commit comments

Comments
 (0)