Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why not notify cluster when conn close? #341

Open
shushenghong opened this issue Dec 10, 2020 · 1 comment
Open

why not notify cluster when conn close? #341

shushenghong opened this issue Dec 10, 2020 · 1 comment
Labels

Comments

@shushenghong
Copy link

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

@kelindar
Copy link
Contributor

Marking this as a bug for now, need to investigate properly as I don't recall right now why exactly.

@kelindar kelindar added the bug label Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants