Skip to content

Fix multi orgin failure case#65

Draft
namikmesic wants to merge 2 commits intomainfrom
fix-multi-orgin-failure-case
Draft

Fix multi orgin failure case#65
namikmesic wants to merge 2 commits intomainfrom
fix-multi-orgin-failure-case

Conversation

@namikmesic
Copy link

No description provided.

streamCtxCancel context.CancelFunc
closeError atomic.Value
connStatusCallback func(isConneccted bool, host string, origin string)
connMu sync.Mutex
Copy link
Collaborator

@akuzni2 akuzni2 Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add this could we remove closingMutex?

closingMutex also guards the connection and we can likely just reuse connMu in it's place

cancel()
// `Add(^uint64(0))` will decrement activeConnections
s.stats.activeConnections.Add(^uint64(0))
if s.connStatusCallback != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why move this one? Its nice to have 1 call site. In the replacing changes we have 1 call that's synchronous and another one that's also async.

c.config.logInfo("client: failed to connect to origin %s: %s", origins[x], err)
errs = append(errs, fmt.Errorf("origin %s: %w", origins[x], err))
// Retry connecting to the origin in the background
go func() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also make this use named parameters?

go func(s *stream, origin string)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants