Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved detection of attempts to destroy invalid sessions into Channel …

…instead of Server.
  • Loading branch information...
commit 6eebd6e13232ff52518b34f16a85d627d35b5cfa 1 parent 5dc4946
@scottgonzalez authored
Showing with 5 additions and 4 deletions.
  1. +4 −0 lib/channel.js
  2. +1 −4 lib/server.js
View
4 lib/channel.js
@@ -90,6 +90,10 @@ extend(Channel.prototype, {
},
destroySession: function(id) {
+ if (!id || !this.sessions[id]) {
+ return false;
+ }
+
this.appendMessage(this.sessions[id].nick, "part");
delete this.sessions[id];
},
View
5 lib/server.js
@@ -74,10 +74,7 @@ var handlers = [
{ path: "/part", handler: function(channel, request, response) {
var id = qs.parse(url.parse(request.url).query).id;
- // TODO: can we remove the check and just always call destroySession()?
- if (id && channel.sessions[id]) {
- channel.destroySession(id);
- }
+ channel.destroySession(id);
response.simpleJSON(200, {});
} },
{ path: "/recv", handler: function(channel, request, response) {
Please sign in to comment.
Something went wrong with that request. Please try again.