File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -34,24 +34,24 @@ function adapter(uri, opts){
34
34
uri = null ;
35
35
}
36
36
37
- // handle uri string
38
- if ( uri ) {
39
- uri = uri . split ( ':' ) ;
40
- opts . host = uri [ 0 ] ;
41
- opts . port = uri [ 1 ] ;
42
- }
43
-
44
37
// opts
45
- var host = opts . host || '127.0.0.1' ;
46
- var port = Number ( opts . port || 6379 ) ;
47
38
var pub = opts . pubClient ;
48
39
var sub = opts . subClient ;
49
40
var prefix = opts . key || 'socket.io' ;
50
41
var subEvent = opts . subEvent || 'message' ;
51
42
52
43
// init clients if needed
53
- if ( ! pub ) pub = redis ( port , host ) ;
54
- if ( ! sub ) sub = redis ( port , host , { return_buffers : true } ) ;
44
+ function createClient ( redis_opts ) {
45
+ if ( uri ) {
46
+ // handle uri string
47
+ return redis ( uri , redis_opts ) ;
48
+ } else {
49
+ return redis ( opts . port , opts . host , redis_opts ) ;
50
+ }
51
+ }
52
+
53
+ if ( ! pub ) pub = createClient ( ) ;
54
+ if ( ! sub ) sub = createClient ( { return_buffers : true } ) ;
55
55
56
56
// this server's key
57
57
var uid = uid2 ( 6 ) ;
You can’t perform that action at this time.
0 commit comments