diff options
-rw-r--r-- | config.go | 3 | ||||
-rw-r--r-- | docs/cca.scfg.example | 4 | ||||
-rw-r--r-- | ws.go | 52 |
3 files changed, 0 insertions, 59 deletions
@@ -68,7 +68,6 @@ var configWithPointers struct { Expr *int `scfg:"expr"` } `scfg:"auth"` Perf struct { - SendQ *int `scfg:"sendq"` MessageArgumentsCap *int `scfg:"msg_args_cap"` MessageBytesCap *int `scfg:"msg_bytes_cap"` ReadHeaderTimeout *int `scfg:"read_header_timeout"` @@ -105,7 +104,6 @@ var config struct { Expr int } Perf struct { - SendQ int MessageArgumentsCap int MessageBytesCap int ReadHeaderTimeout int @@ -165,7 +163,6 @@ func fetchConfig(path string) error { config.Auth.Token = *(configWithPointers.Auth.Token) config.Auth.Secret = *(configWithPointers.Auth.Secret) config.Auth.Expr = *(configWithPointers.Auth.Expr) - config.Perf.SendQ = *(configWithPointers.Perf.SendQ) config.Perf.MessageArgumentsCap = *(configWithPointers.Perf.MessageArgumentsCap) config.Perf.MessageBytesCap = *(configWithPointers.Perf.MessageBytesCap) config.Perf.ReadHeaderTimeout = *(configWithPointers.Perf.ReadHeaderTimeout) diff --git a/docs/cca.scfg.example b/docs/cca.scfg.example index 0eed02c..5785d06 100644 --- a/docs/cca.scfg.example +++ b/docs/cca.scfg.example @@ -84,10 +84,6 @@ auth { # The following block contains some tweaks for performance. perf { - # How long should the send queue be? This is implemented as the - # buffer number for a Go channel. - sendq 10 - # How many arguments' space should we initially allocate for each # message? msg_args_cap 4 @@ -252,15 +252,6 @@ type errbytesT struct { } var ( - 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. - */ - chanPoolLock sync.RWMutex -) - -var ( cancelPool = make(map[string](*context.CancelFunc)) /* * Normal Go maps are not thread safe, so we protect large cancelPool @@ -269,31 +260,6 @@ var ( cancelPoolLock sync.RWMutex ) -/* - * Only call this when it is okay for propagation to fail, such as in course - * number updates. Failures are currently ignored. - */ -func propagateIgnoreFailures(msg string) { - /* - * It is not a mistake that we acquire a read lock instead of a write - * lock here. Channels provide synchronization, and other than using - * the channels, we are simply iterating through chanPoolLock. This is - * unsafe when chanPoolLock's structure is being modified, such as - * when a channel is being added or deleted from the pool; but it's - * fine if other goroutines are simply indexing it and using the - * channels. - */ - chanPoolLock.RLock() - defer chanPoolLock.RUnlock() - for k, v := range chanPool { - select { - case *v <- msg: - default: - log.Println("WARNING: SendQ exceeded for " + k) - } - } -} - func propagateSelectedUpdate(courseID int) { course := courses[courseID] course.UsemsLock.RLock() @@ -342,18 +308,6 @@ func handleConn( } }() - send := make(chan string, config.Perf.SendQ) - func() { - chanPoolLock.Lock() - defer chanPoolLock.Unlock() - chanPool[userID] = &send - }() - defer func() { - chanPoolLock.Lock() - defer chanPoolLock.Unlock() - delete(chanPool, userID) - }() - /* TODO: Tell the user their current choices here. Deprecate HELLO. */ usems := make(map[int]*usemT) @@ -502,12 +456,6 @@ func handleConn( return fmt.Errorf("error sending to websocket for course selected update: %w", err) } continue - case gonnasend := <-send: - err := writeText(newCtx, c, gonnasend) - if err != nil { - return fmt.Errorf("error sending to websocket from send channel: %w", err) - } - continue case errbytes := <-recv: if errbytes.err != nil { return fmt.Errorf("error fetching message from recv channel: %w", errbytes.err) |