summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go6
-rw-r--r--ws.go17
2 files changed, 1 insertions, 22 deletions
diff --git a/main.go b/main.go
index 1648cd5..fafeda9 100644
--- a/main.go
+++ b/main.go
@@ -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 {
diff --git a/ws.go b/ws.go
index 9a0139d..ec626a3 100644
--- a/ws.go
+++ b/ws.go
@@ -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