-
-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Labels
Description
I see notify cluster when conn connected
emitter/internal/broker/conn.go
Lines 343 to 345 in ad96b72
if c.service.cluster != nil { | |
c.service.cluster.Notify(c.connect, true) | |
} |
but when conn closed didn't notify the cluster, is there any reason? I read the code, sub/keyban events all have notify true/false pairs.
emitter/internal/broker/conn.go
Lines 350 to 373 in ad96b72
func (c *Conn) Close() error { | |
atomic.AddInt64(&c.service.connections, -1) | |
if r := recover(); r != nil { | |
logging.LogAction("closing", fmt.Sprintf("panic recovered: %s \n %s", r, debug.Stack())) | |
} | |
// Unsubscribe from everything, no need to lock since each Unsubscribe is | |
// already locked. Locking the 'Close()' would result in a deadlock. | |
for _, counter := range c.subs.All() { | |
c.service.pubsub.Unsubscribe(c, &event.Subscription{ | |
Peer: c.service.ID(), | |
Conn: c.luid, | |
User: nocopy.String(c.Username()), | |
Ssid: counter.Ssid, | |
Channel: counter.Channel, | |
}) | |
} | |
// Publish last will | |
c.service.pubsub.OnLastWill(c, c.connect) | |
//logging.LogTarget("conn", "closed", c.guid) | |
return c.socket.Close() | |
} |