rpc: fix typos (#1011)

This commit is contained in:
Daniel Liu 2025-04-29 17:07:10 +08:00 committed by GitHub
parent 35a202675d
commit a4aebd5d88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 9 additions and 9 deletions

View file

@ -70,7 +70,7 @@ type BatchElem struct {
// discarded. // discarded.
Result interface{} Result interface{}
// Error is set if the server returns an error for this request, or if // Error is set if the server returns an error for this request, or if
// unmarshaling into Result fails. It is not set for I/O errors. // unmarshalling into Result fails. It is not set for I/O errors.
Error error Error error
} }

View file

@ -324,7 +324,7 @@ func (h *handler) addRequestOp(op *requestOp) {
} }
} }
// removeRequestOps stops waiting for the given request IDs. // removeRequestOp stops waiting for the given request IDs.
func (h *handler) removeRequestOp(op *requestOp) { func (h *handler) removeRequestOp(op *requestOp) {
for _, id := range op.ids { for _, id := range op.ids {
delete(h.respWait, string(id)) delete(h.respWait, string(id))
@ -388,7 +388,7 @@ func (h *handler) startCallProc(fn func(*callProc)) {
}() }()
} }
// handleResponse processes method call responses. // handleResponses processes method call responses.
func (h *handler) handleResponses(batch []*jsonrpcMessage, handleCall func(*jsonrpcMessage)) { func (h *handler) handleResponses(batch []*jsonrpcMessage, handleCall func(*jsonrpcMessage)) {
var resolvedops []*requestOp var resolvedops []*requestOp
handleResp := func(msg *jsonrpcMessage) { handleResp := func(msg *jsonrpcMessage) {

View file

@ -266,7 +266,7 @@ func (c *jsonCodec) close() {
}) })
} }
// Closed returns a channel which will be closed when Close is called // closed returns a channel which will be closed when Close is called
func (c *jsonCodec) closed() <-chan interface{} { func (c *jsonCodec) closed() <-chan interface{} {
return c.closeCh return c.closeCh
} }

View file

@ -88,7 +88,7 @@ func (s *Server) SetHTTPBodyLimit(limit int) {
} }
// RegisterName creates a service for the given receiver type under the given name. When no // RegisterName creates a service for the given receiver type under the given name. When no
// methods on the given receiver match the criteria to be either a RPC method or a // methods on the given receiver match the criteria to be either an RPC method or a
// subscription an error is returned. Otherwise a new service is created and added to the // subscription an error is returned. Otherwise a new service is created and added to the
// service collection this server provides to clients. // service collection this server provides to clients.
func (s *Server) RegisterName(name string, receiver interface{}) error { func (s *Server) RegisterName(name string, receiver interface{}) error {

View file

@ -110,7 +110,7 @@ func (r *serviceRegistry) subscription(service, name string) *callback {
} }
// suitableCallbacks iterates over the methods of the given type. It determines if a method // suitableCallbacks iterates over the methods of the given type. It determines if a method
// satisfies the criteria for a RPC callback or a subscription callback and adds it to the // satisfies the criteria for an RPC callback or a subscription callback and adds it to the
// collection of callbacks. See server documentation for a summary of these criteria. // collection of callbacks. See server documentation for a summary of these criteria.
func suitableCallbacks(receiver reflect.Value) map[string]*callback { func suitableCallbacks(receiver reflect.Value) map[string]*callback {
typ := receiver.Type() typ := receiver.Type()
@ -227,7 +227,7 @@ func isSubscriptionType(t reflect.Type) bool {
return t == subscriptionType return t == subscriptionType
} }
// isPubSub tests whether the given method has as as first argument a context.Context and // isPubSub tests whether the given method's first argument is a context.Context and
// returns the pair (Subscription, error). // returns the pair (Subscription, error).
func isPubSub(methodType reflect.Type) bool { func isPubSub(methodType reflect.Type) bool {
// numIn(0) is the receiver type // numIn(0) is the receiver type

View file

@ -97,7 +97,7 @@ func NotifierFromContext(ctx context.Context) (*Notifier, bool) {
return n, ok return n, ok
} }
// Notifier is tied to a RPC connection that supports subscriptions. // Notifier is tied to an RPC connection that supports subscriptions.
// Server callbacks use the notifier to send notifications. // Server callbacks use the notifier to send notifications.
type Notifier struct { type Notifier struct {
h *handler h *handler

View file

@ -38,7 +38,7 @@ type API struct {
} }
// ServerCodec implements reading, parsing and writing RPC messages for the server side of // ServerCodec implements reading, parsing and writing RPC messages for the server side of
// a RPC session. Implementations must be go-routine safe since the codec can be called in // an RPC session. Implementations must be go-routine safe since the codec can be called in
// multiple go-routines concurrently. // multiple go-routines concurrently.
type ServerCodec interface { type ServerCodec interface {
peerInfo() PeerInfo peerInfo() PeerInfo