security: check for channel closures to prevent busy-loops.

Move notice observer before channel send.
This commit is contained in:
Jay
2026-08-09 18:56:36 -04:00
parent 3d20e9c512
commit 8ed9efa433
3 changed files with 24 additions and 9 deletions
+8 -2
View File
@@ -170,7 +170,10 @@ func (p *EventPublisher) routeInbox() {
select {
case <-p.ctx.Done():
return
case msg := <-p.inbox:
case msg, ok := <-p.inbox:
if !ok {
return
}
eventID, accepted, message, err := envelope.FindOK(msg.Data)
if err != nil {
continue
@@ -204,7 +207,10 @@ func (p *EventPublisher) handleEvents() {
select {
case <-p.ctx.Done():
return
case ev := <-p.events:
case ev, ok := <-p.events:
if !ok {
return
}
switch ev.Kind {
case EventConnected:
p.mu.Lock()