From e1f6f5f411534759608932f5de7bdb6c8c3c9989 Mon Sep 17 00:00:00 2001 From: jyxjjj <773933146@qq.com> Date: Tue, 25 Nov 2025 12:48:05 +0800 Subject: [PATCH] fix(caller): Use pointer receivers for Call methods Changed the Call methods in httpCaller and websocketCaller to use pointer receivers instead of value receivers. This ensures that any modifications to the receiver's state within the method are preserved and aligns with Go best practices for methods that may modify receiver state. --- pkg/aria2/rpc/call.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/aria2/rpc/call.go b/pkg/aria2/rpc/call.go index a2af84617..d7857bfd3 100644 --- a/pkg/aria2/rpc/call.go +++ b/pkg/aria2/rpc/call.go @@ -120,7 +120,7 @@ func (h *httpCaller) setNotifier(ctx context.Context, u url.URL, notifier Notifi return } -func (h httpCaller) Call(method string, params, reply interface{}) (err error) { +func (h *httpCaller) Call(method string, params, reply interface{}) (err error) { payload, err := EncodeClientRequest(method, params) if err != nil { return @@ -236,7 +236,7 @@ func (w *websocketCaller) Close() (err error) { return } -func (w websocketCaller) Call(method string, params, reply interface{}) (err error) { +func (w *websocketCaller) Call(method string, params, reply interface{}) (err error) { ctx, cancel := context.WithTimeout(context.Background(), w.timeout) defer cancel() select {