diff options
Diffstat (limited to '')
-rw-r--r-- | main.go | 6 | ||||
-rw-r--r-- | ws.go | 17 |
2 files changed, 1 insertions, 22 deletions
@@ -60,12 +60,6 @@ func main() { log.Fatal(err) } - log.Println("Setting up WebSocket connection pool") - err = setupChanPool() - if err != nil { - log.Fatal(err) - } - log.Println("Setting up context cancellation connection pool") err = setupCancelPool() if err != nil { @@ -252,7 +252,7 @@ type errbytesT struct { } var ( - chanPool map[string](*chan string) + chanPool = make(map[string](*chan string)) /* * Normal Go maps are not thread safe, so we protect large chanPool * operations such as addition and deletion under a RWMutex. @@ -260,21 +260,6 @@ var ( chanPoolLock sync.RWMutex ) -func setupChanPool() error { - /* - * It would be unusual for this function to run concurrently with - * anything else that modifies chanPool, so we fail when the lock is - * unsuccessful. - */ - r := chanPoolLock.TryLock() - if !r { - return fmt.Errorf("cannot set up chanPool: %w", errUnexpectedRace) - } - defer chanPoolLock.Unlock() - chanPool = make(map[string](*chan string)) - return nil -} - var ( /* * Note that the key for cancelPool is a userID rather than a sessionID |