Skip to content

Fix RedisStore #529

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

Merged
merged 37 commits into from
Sep 19, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9bf10ed
Updated to the latest redis release. Lots of important patches.
dshaw Jul 11, 2011
59e250b
Run initStore on store setting change. Fixes #367.
dshaw Jul 11, 2011
ffa17e1
Merge remote-tracking branch 'learnboost/master'
dshaw Jul 11, 2011
3a2545b
merge
dshaw Jul 12, 2011
dfebed6
Fix typo. Also mentioned in @dluxemburg's #341.
dshaw Jul 12, 2011
831f1ba
Merge remote-tracking branch 'learnboost/master'
dshaw Jul 28, 2011
1fa158c
Merge with learnboost/master
dshaw Aug 3, 2011
559d366
Merge remote-tracking branch 'learnboost/master'
dshaw Aug 7, 2011
3028494
Merge remote-tracking branch 'learnboost/master'
dshaw Aug 8, 2011
dd30de3
Merge remote-tracking branch 'learnboost/master'
dshaw Aug 16, 2011
bb2e100
Added http referrer verification to manager.js verifyOrigin + tests f…
einaros Aug 16, 2011
1866491
added hybi10 support
einaros Aug 27, 2011
a075870
added hybi10 parser tests
einaros Aug 27, 2011
39ae8d4
added hybi10 close operation
einaros Aug 27, 2011
a9e9e64
updated to work with two-level websocket versioning
einaros Aug 27, 2011
7e60d37
minor cleanups
einaros Aug 27, 2011
71e013a
added test and support for really long messages, but capped by 32 bit
einaros Aug 27, 2011
169ad82
Release 0.7.10
rauchg Aug 27, 2011
5186788
cleanups and comments
einaros Aug 27, 2011
c4b2324
Release 0.7.11
rauchg Aug 27, 2011
94fdbad
added initial hybi07 protocol parser
einaros Aug 28, 2011
b69dac6
added hybi07 tests
einaros Aug 28, 2011
444229a
Changed protocols require path.
rauchg Aug 28, 2011
b7998e8
Renamed wsver/ -> websocket/
rauchg Aug 28, 2011
c8938a9
Release 0.8.0
rauchg Aug 28, 2011
ce4c46b
fixed Parser library path and did some code cleanup
einaros Aug 29, 2011
48dadd8
joined compatible hybi protocol handlers and updated test reference
einaros Aug 29, 2011
2c3dc42
corrected ping handling from websocket transport, and added warning o…
einaros Aug 29, 2011
12fc168
fixed bug in send framing for over 64kB of data
einaros Aug 29, 2011
140ed41
Fixed typo.
Znarkus Aug 29, 2011
72a79e5
fixed utf8 bug in send framing
einaros Aug 29, 2011
93c963e
Release 0.8.1
rauchg Aug 29, 2011
d88575d
Release 0.8.2
rauchg Aug 29, 2011
7b2b302
merge learnboost/master
dshaw Sep 1, 2011
cc0a96a
Wow, really.
dshaw Sep 1, 2011
f80ab2a
Merge branch 'master' of https://github.com/LearnBoost/socket.io
dshaw Sep 12, 2011
c6b3549
Minimal RedisClient configs.
dshaw Sep 12, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ function Manager (server, options) {
this.settings[i] = options[i];
}

var self = this;

this.initStore();

this.on('set:store', function() {
self.initStore();
});

// reset listeners
this.oldListeners = server.listeners('request');
server.removeAllListeners('request');

var self = this;

server.on('request', function (req, res) {
self.handleRequest(req, res);
});
Expand Down
26 changes: 21 additions & 5 deletions lib/stores/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,28 @@ function Redis (opts) {
}
}

var redis = opts.redis || require('redis');
var redis = opts.redis || require('redis')
, RedisClient = redis.RedisClient;

// initialize a pubsub client and a regular client
this.pub = redis.createClient(opts.redisPub);
this.sub = redis.createClient(opts.redisSub);
this.cmd = redis.createClient(opts.redisClient);
if (opts.redisPub instanceof RedisClient) {
this.pub = opts.redisPub;
} else {
opts.redisPub || (opts.redisPub = {});
this.pub = redis.createClient(opts.redisPub.port, opts.redisPub.host, opts.redisPub);
}
if (opts.redisSub instanceof RedisClient) {
this.sub = opts.redisSub;
} else {
opts.redisSub || (opts.redisSub = {});
this.sub = redis.createClient(opts.redisSub.port, opts.redisSub.host, opts.redisSub);
}
if (opts.redisClient instanceof RedisClient) {
this.cmd = opts.redisClient;
} else {
opts.redisClient || (opts.redisClient = {});
this.cmd = redis.createClient(opts.redisClient.port, opts.redisClient.host, opts.redisClient);
}

Store.call(this, opts);
};
Expand Down Expand Up @@ -118,7 +134,7 @@ Redis.prototype.subscribe = function (name, consumer, fn) {
self.on('unsubscribe', function unsubscribe (ch) {
if (name == ch) {
self.sub.removeListener('message', message);
self.removeEvent('unsubscribe', unsubscribe);
self.removeListener('unsubscribe', unsubscribe);
}
});

Expand Down