fix: reject unrouted messages without seq

This commit is contained in:
richjohnrambo
2026-09-24 18:33:09 +08:00
parent 1f35d4f786
commit 7f2df1dd4f
4 changed files with 83 additions and 4 deletions
+6 -3
View File
@@ -255,14 +255,17 @@ func (h *Hub) run() {
}
} else if msg.Note == nil {
// Topic is unknown or offline.
// Note is silently ignored, all other messages are reported as accepted to prevent
// clients from guessing valid topic names.
// Note is silently ignored. Other client messages cannot be accepted here
// because they are not routed to a live topic and therefore cannot reserve a
// message seq or be persisted.
// TODO(gene): validate topic name, discarding invalid topics.
logs.Info.Printf("Hub. Topic[%s] is unknown or offline", msg.RcptTo)
msg.sess.queueOut(NoErrAcceptedExplicitTs(msg.Id, msg.RcptTo, types.TimeNow(), msg.Timestamp))
if msg.sess != nil {
msg.sess.queueOut(ErrAttachFirst(msg, types.TimeNow()))
}
}
case msg := <-h.routeSrv:
// This is a server message from a connection not subscribed to topic