aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/server.go
diff options
context:
space:
mode:
authorkiel barry <kiel.j.barry@gmail.com>2018-05-03 16:41:22 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-05-03 16:41:22 +0800
commit2ad511ce0912194e9f30010f01fc338c585f8634 (patch)
treea3f20b6850a40c6b8b1229f8c5ac239153475dc0 /rpc/server.go
parent541f299fbbf3c4f4f0ee49c5ecb832f08cc22656 (diff)
downloadgo-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar.gz
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar.bz2
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar.lz
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar.xz
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.tar.zst
go-tangerine-2ad511ce0912194e9f30010f01fc338c585f8634.zip
rpc: golint error with context as last parameter (#16657)
* rpc/*: golint error with context as last parameter * Update json.go
Diffstat (limited to 'rpc/server.go')
-rw-r--r--rpc/server.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/rpc/server.go b/rpc/server.go
index 0f29035ed..7f304d8d9 100644
--- a/rpc/server.go
+++ b/rpc/server.go
@@ -125,7 +125,7 @@ func (s *Server) RegisterName(name string, rcvr interface{}) error {
// If singleShot is true it will process a single request, otherwise it will handle
// requests until the codec returns an error when reading a request (in most cases
// an EOF). It executes requests in parallel when singleShot is false.
-func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecOption, ctx context.Context) error {
+func (s *Server) serveRequest(ctx context.Context, codec ServerCodec, singleShot bool, options CodecOption) error {
var pend sync.WaitGroup
defer func() {
@@ -216,14 +216,14 @@ func (s *Server) serveRequest(codec ServerCodec, singleShot bool, options CodecO
// stopped. In either case the codec is closed.
func (s *Server) ServeCodec(codec ServerCodec, options CodecOption) {
defer codec.Close()
- s.serveRequest(codec, false, options, context.Background())
+ s.serveRequest(context.Background(), codec, false, options)
}
// ServeSingleRequest reads and processes a single RPC request from the given codec. It will not
// close the codec unless a non-recoverable error has occurred. Note, this method will return after
// a single request has been processed!
-func (s *Server) ServeSingleRequest(codec ServerCodec, options CodecOption, ctx context.Context) {
- s.serveRequest(codec, true, options, ctx)
+func (s *Server) ServeSingleRequest(ctx context.Context, codec ServerCodec, options CodecOption) {
+ s.serveRequest(ctx, codec, true, options)
}
// Stop will stop reading new requests, wait for stopPendingRequestTimeout to allow pending requests to finish,