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

Fix possible race condition when attaching clients #1639

Merged
merged 1 commit into from Oct 17, 2017

Conversation

xPaw
Copy link
Member

@xPaw xPaw commented Oct 17, 2017

Socket events were bound before attaching client, so technically an event could be trigger before there is an attached client and crash. I believe this fixes the issue.

        this.attachedClients[socketId].openChannel = target.chan.id;
                                                   ^
 
TypeError: Cannot set property 'openChannel' of undefined
    at Client.open (/home/irc/root/lounge/src/client.js:438:45)
    at Socket.<anonymous> (/home/irc/root/lounge/src/server.js:318:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at /home/irc/root/lounge/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

@xPaw xPaw added the Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors. label Oct 17, 2017
@xPaw xPaw added this to the 2.6.0 milestone Oct 17, 2017
@xPaw xPaw merged commit 4d54414 into master Oct 17, 2017
@xPaw xPaw deleted the xpaw/fix-attach-race-condition branch October 17, 2017 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues that report and PRs that solve any defects that cause unexpected behaviors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants