summaryrefslogtreecommitdiff
path: root/ws.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ws.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/ws.go b/ws.go
index 83087fc..6cc809a 100644
--- a/ws.go
+++ b/ws.go
@@ -233,6 +233,16 @@ func setupChanPool() error {
return nil
}
+func propagate(msg string) {
+ chanPoolLock.RLock()
+ defer chanPoolLock.RUnlock()
+ for _, v := range chanPool {
+ *v <- msg
+ /* TODO: This may block */
+ }
+ /* TODO: Any possible errors? */
+}
+
/*
* The actual logic in handling the connection, after authentication has been
* completed.
@@ -315,7 +325,7 @@ func handleConn(
defer course.SelectedLock.Unlock()
if course.Selected < course.Max {
course.Selected++
- /* TODO: Propagate it! */
+ propagate(fmt.Sprintf("N %d %d", courseID, course.Selected))
ok = true
return
}