-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Clean up namespaces after client is rejected in middleware #4773
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -758,9 +758,6 @@ export class Socket< | |
} | ||
|
||
this._cleanup(); | ||
this.nsp._remove(this); | ||
this.client._remove(this); | ||
this.connected = false; | ||
this.emitReserved("disconnect", reason, description); | ||
return; | ||
} | ||
|
@@ -772,6 +769,9 @@ export class Socket< | |
*/ | ||
_cleanup() { | ||
this.leaveAll(); | ||
this.nsp._remove(this); | ||
this.client._remove(this); | ||
this.connected = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, I just thought it does no harm since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
this.join = noop; | ||
} | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_cleanup is called here and in two more places: https://github.com/socketio/socket.io/blob/main/lib/namespace.ts#L327-L333
I believe the
this.nsp._remove(this);
should be called in all these cases