|
@@ -37,12 +37,16 @@ const (
|
|
|
type HubFullCommand struct {
|
|
|
Command HubCommand
|
|
|
}
|
|
|
+type CommandResponse struct {
|
|
|
+ Value interface{}
|
|
|
+}
|
|
|
|
|
|
type Hub struct {
|
|
|
Register chan Client
|
|
|
Unregister chan Client
|
|
|
LogMessages chan format.LogParts
|
|
|
Commands chan HubFullCommand
|
|
|
+ Responses chan CommandResponse
|
|
|
|
|
|
clients map[Client]bool
|
|
|
circbuf *ring.Ring
|
|
@@ -55,6 +59,7 @@ func NewHub(ringBufSize int) Hub {
|
|
|
Unregister: make(chan Client),
|
|
|
LogMessages: make(chan format.LogParts),
|
|
|
Commands: make(chan HubFullCommand),
|
|
|
+ Responses: make(chan CommandResponse),
|
|
|
circbuf: ring.New(ringBufSize),
|
|
|
}
|
|
|
}
|
|
@@ -120,9 +125,11 @@ func (h *Hub) Run() {
|
|
|
case cmd := <-h.Commands:
|
|
|
if cmd.Command == CommandClear {
|
|
|
h.clear()
|
|
|
+ h.Responses <- CommandResponse{Value: true}
|
|
|
}
|
|
|
if cmd.Command == CommandPauseToggle {
|
|
|
active = !active
|
|
|
+ h.Responses <- CommandResponse{Value: active}
|
|
|
}
|
|
|
}
|
|
|
}
|