Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
fix: no return value
Browse files Browse the repository at this point in the history
  • Loading branch information
jon4hz committed Aug 12, 2022
1 parent 849524c commit 45f7423
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions internal/stratum/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ func New(url string, opts ...Opts) *Client {

func (c *Client) CloseAndReconnect() {
c.Close(false)
go func() {
if err := c.reconnect(); err != nil {
c.LogFn.Error(err, "connection error")
}
}()
go c.reconnect()
}

func (c *Client) Close(forever bool) {
Expand Down Expand Up @@ -183,9 +179,9 @@ func (c *Client) dial() error {
return nil
}

func (c *Client) reconnect() error {
func (c *Client) reconnect() {
if !c.setStateIfNot(connectingState, connectingState|connectedState|closedForeverState) {
return nil
return
}

b := c.makeBackoff()
Expand All @@ -194,7 +190,7 @@ func (c *Client) reconnect() error {
for {
err := c.dial()
if err == nil {
return nil
return
}

waitDuration := b.Duration()
Expand Down

0 comments on commit 45f7423

Please sign in to comment.