Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
myleshorton committed Dec 6, 2024
1 parent b9307b7 commit 67fc744
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion connecting_fronts.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ func newConnectingFronts(size int) *connecting {
}
}

// AddFront adds a new front to the list of fronts.
// onConnected adds a working front to the channel of working fronts.
func (cf *connecting) onConnected(m Front) {
cf.frontsCh <- m
}

func (cf *connecting) connectingFront(ctx context.Context) (Front, error) {
for {
select {
// This is typically the context of the HTTP request. If the context is done, return an error.
case <-ctx.Done():
return nil, ctx.Err()
case m := <-cf.frontsCh:
Expand Down
1 change: 1 addition & 0 deletions fronted.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func loadFronts(providers map[string]*Provider) sortedFronts {

fronts := make(sortedFronts, size)

// Note that map iteration order is random, so the order of the providers is automatically randomized.
index := 0
for key, p := range providers {
arr := p.Masquerades
Expand Down

0 comments on commit 67fc744

Please sign in to comment.