Update client.go

This commit is contained in:
sashass1315 2026-02-03 14:46:43 +02:00 committed by GitHub
parent 111b97bbb2
commit 224692eac6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,6 +29,7 @@ import (
"time" "time"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"go.opentelemetry.io/otel/trace"
) )
var ( var (
@ -88,6 +89,7 @@ type Client struct {
// config fields // config fields
batchItemLimit int batchItemLimit int
batchResponseMaxSize int batchResponseMaxSize int
tracerProvider trace.TracerProvider
// writeConn is used for writing to the connection on the caller's goroutine. It should // writeConn is used for writing to the connection on the caller's goroutine. It should
// only be accessed outside of dispatch, with the write lock held. The write lock is // only be accessed outside of dispatch, with the write lock held. The write lock is
@ -119,7 +121,7 @@ func (c *Client) newClientConn(conn ServerCodec) *clientConn {
ctx := context.Background() ctx := context.Background()
ctx = context.WithValue(ctx, clientContextKey{}, c) ctx = context.WithValue(ctx, clientContextKey{}, c)
ctx = context.WithValue(ctx, peerInfoContextKey{}, conn.peerInfo()) ctx = context.WithValue(ctx, peerInfoContextKey{}, conn.peerInfo())
handler := newHandler(ctx, conn, c.idgen, c.services, c.batchItemLimit, c.batchResponseMaxSize, nil) handler := newHandler(ctx, conn, c.idgen, c.services, c.batchItemLimit, c.batchResponseMaxSize, c.tracerProvider)
return &clientConn{conn, handler} return &clientConn{conn, handler}
} }
@ -247,6 +249,7 @@ func initClient(conn ServerCodec, services *serviceRegistry, cfg *clientConfig)
idgen: cfg.idgen, idgen: cfg.idgen,
batchItemLimit: cfg.batchItemLimit, batchItemLimit: cfg.batchItemLimit,
batchResponseMaxSize: cfg.batchResponseLimit, batchResponseMaxSize: cfg.batchResponseLimit,
tracerProvider: cfg.tracerProvider,
writeConn: conn, writeConn: conn,
close: make(chan struct{}), close: make(chan struct{}),
closing: make(chan struct{}), closing: make(chan struct{}),