Skip to content

Commit

Permalink
Stop leaking jrpc2 details
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Jan 22, 2025
1 parent ac46c0a commit 5f6f878
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
)

type Client struct {
url string
cli *jrpc2.Client
opts *jrpc2.ClientOptions
url string
cli *jrpc2.Client
}

func NewClient(url string, opts *jrpc2.ClientOptions) *Client {
c := &Client{url: url, opts: opts}
func NewClient(url string) *Client {
c := &Client{url: url}
c.refreshClient()
return c
}
Expand All @@ -30,7 +29,7 @@ func (c *Client) refreshClient() {
c.cli.Close()
}
ch := jhttp.NewChannel(c.url, nil)
c.cli = jrpc2.NewClient(ch, c.opts)
c.cli = jrpc2.NewClient(ch, nil)
}

func (c *Client) callResult(ctx context.Context, method string, params, result any) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func NewTest(t *testing.T, cfg *TestConfig) *Test {
i.spawnRPCDaemon()
}

i.rpcClient = client.NewClient(i.GetSorobanRPCURL(), nil)
i.rpcClient = client.NewClient(i.GetSorobanRPCURL())
if shouldWaitForRPC {
i.waitForRPC()
}
Expand Down

0 comments on commit 5f6f878

Please sign in to comment.