Skip to content

Commit

Permalink
Add missing lock when looping over all proxies
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumerose committed Sep 16, 2021
1 parent 169b109 commit bdd6b09
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/services/forwarder/ports.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"net"
"net/http"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -132,6 +133,8 @@ func (f *PortsForwarder) Unexpose(protocol types.TransportProtocol, local string
func (f *PortsForwarder) Mux() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/all", func(w http.ResponseWriter, r *http.Request) {
f.proxiesLock.Lock()
defer f.proxiesLock.Unlock()
ret := make([]proxy, 0)
for _, proxy := range f.proxies {
ret = append(ret, proxy)
Expand Down

0 comments on commit bdd6b09

Please sign in to comment.