@@ -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.
217217func (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