Skip to content

Commit

Permalink
Merge pull request #185 from o4eredko/master
Browse files Browse the repository at this point in the history
Support multiple negotiate versions and handle backoff.Stop properly
  • Loading branch information
philippseith authored Nov 5, 2023
2 parents 586d67b + 0480e2d commit fcfe993
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func (c *client) Start() {
nextBackoff := boff.NextBackOff()
// Check for exceeded backoff
if nextBackoff == backoff.Stop {
c.setState(ClientClosed)
c.setErr(errors.New("backoff exceeded"))
return
}
Expand Down
8 changes: 7 additions & 1 deletion httpconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ func NewHTTPConnection(ctx context.Context, address string, options ...func(*htt
}

q := reqURL.Query()
q.Set("id", negotiateResponse.ConnectionID)
switch negotiateResponse.NegotiateVersion {
case 0:
q.Set("id", negotiateResponse.ConnectionID)
case 1:
q.Set("id", negotiateResponse.ConnectionToken)
}

reqURL.RawQuery = q.Encode()

// Select the best connection
Expand Down

0 comments on commit fcfe993

Please sign in to comment.