From e042f75df792f91b2d69e63da196a1df54f9e115 Mon Sep 17 00:00:00 2001 From: iflamed Date: Mon, 23 Jun 2014 19:43:48 +0800 Subject: [PATCH 1/2] #1 fixed multiple connection to ssdb server like how redis to do --- SSDB.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SSDB.js b/SSDB.js index 2280ae0..452ac7d 100644 --- a/SSDB.js +++ b/SSDB.js @@ -11,7 +11,7 @@ var net = require('net'); // timeout: microseconds, if ommitted, it will be treated as listener // callback(err, ssdb) -exports.connect = function(host, port, timeout, listener){ +var SSDBConnect = function(host, port, timeout, listener){ var self = this; var recv_buf = new Buffer(0); var callbacks = []; @@ -441,6 +441,17 @@ exports.connect = function(host, port, timeout, listener){ return self; } +/** + * new a connection to ssdb server + * @param {[type]} host [host] + * @param {[type]} port [port] + * @param {[type]} timeout [microseconds, if ommitted, it will be treated as listener] + * @param {[type]} listener [callback after connection,] + * @return {object} [SSDBConnect] + */ +exports.connect = function(host, port, timeout, listener){ + return new SSDBConnect(host, port, timeout, listener); +} /* example: From 9658aa5c46ae5b6b56808f899b319b32c28887ff Mon Sep 17 00:00:00 2001 From: iflamed Date: Mon, 23 Jun 2014 19:45:47 +0800 Subject: [PATCH 2/2] update the function description --- SSDB.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SSDB.js b/SSDB.js index 452ac7d..ff432ce 100644 --- a/SSDB.js +++ b/SSDB.js @@ -443,10 +443,10 @@ var SSDBConnect = function(host, port, timeout, listener){ /** * new a connection to ssdb server - * @param {[type]} host [host] - * @param {[type]} port [port] - * @param {[type]} timeout [microseconds, if ommitted, it will be treated as listener] - * @param {[type]} listener [callback after connection,] + * @param {string} host [host] + * @param {int} port [port] + * @param {int} timeout [microseconds, if ommitted, it will be treated as listener] + * @param {function} listener [callback after connection,] * @return {object} [SSDBConnect] */ exports.connect = function(host, port, timeout, listener){