Skip to content

why not notify cluster when conn close? #341

@shushenghong

Description

@shushenghong

I see notify cluster when conn connected

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.

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()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions