|
@@ -35,7 +35,8 @@ const (
|
|
|
|
|
|
// An HubFullCommand is a Command, complete with arguments
|
|
|
type HubFullCommand struct {
|
|
|
- Command HubCommand
|
|
|
+ Command HubCommand
|
|
|
+ Response chan CommandResponse
|
|
|
}
|
|
|
type CommandResponse struct {
|
|
|
Value interface{}
|
|
@@ -46,7 +47,6 @@ type Hub struct {
|
|
|
Unregister chan Client
|
|
|
LogMessages chan format.LogParts
|
|
|
Commands chan HubFullCommand
|
|
|
- Responses chan CommandResponse
|
|
|
|
|
|
clients map[Client]bool
|
|
|
circbuf *ring.Ring
|
|
@@ -59,7 +59,6 @@ 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),
|
|
|
}
|
|
|
}
|
|
@@ -125,11 +124,11 @@ func (h *Hub) Run() {
|
|
|
case cmd := <-h.Commands:
|
|
|
if cmd.Command == CommandClear {
|
|
|
h.clear()
|
|
|
- h.Responses <- CommandResponse{Value: true}
|
|
|
+ cmd.Response <- CommandResponse{Value: true}
|
|
|
}
|
|
|
if cmd.Command == CommandPauseToggle {
|
|
|
active = !active
|
|
|
- h.Responses <- CommandResponse{Value: active}
|
|
|
+ cmd.Response <- CommandResponse{Value: active}
|
|
|
}
|
|
|
}
|
|
|
}
|