Indent and minor linting tweaks to the latest merge
This commit is contained in:
+4
-3
@@ -95,6 +95,7 @@ function clientSession(sock, options) {
|
|||||||
* @param func callback(err, session)
|
* @param func callback(err, session)
|
||||||
*/
|
*/
|
||||||
function client(options, callback) {
|
function client(options, callback) {
|
||||||
|
var sock;
|
||||||
|
|
||||||
if (typeof options === 'function') {
|
if (typeof options === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
@@ -111,10 +112,10 @@ function client(options, callback) {
|
|||||||
'enqLinkTiming': 20000 // 20 sec
|
'enqLinkTiming': 20000 // 20 sec
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
if(options && options.tls && option.tls === true){
|
if (options && options.tls && option.tls === true) {
|
||||||
var sock = new tls.Socket();
|
sock = new tls.Socket();
|
||||||
} else {
|
} else {
|
||||||
var sock = new net.Socket();
|
sock = new net.Socket();
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug('larvitsmpp: lib/client.js: client() - Connecting to ' + options.host + ':' + options.port);
|
log.debug('larvitsmpp: lib/client.js: client() - Connecting to ' + options.host + ':' + options.port);
|
||||||
|
|||||||
+6
-4
@@ -147,6 +147,8 @@ function serverSession(sock, options) {
|
|||||||
* @param func callback(err, session)
|
* @param func callback(err, session)
|
||||||
*/
|
*/
|
||||||
function server(options, callback) {
|
function server(options, callback) {
|
||||||
|
var tlsOrNet;
|
||||||
|
|
||||||
if (typeof options === 'function') {
|
if (typeof options === 'function') {
|
||||||
callback = options;
|
callback = options;
|
||||||
options = {};
|
options = {};
|
||||||
@@ -159,16 +161,16 @@ function server(options, callback) {
|
|||||||
'timeout': 40000 // 40 sec
|
'timeout': 40000 // 40 sec
|
||||||
}, options || {});
|
}, options || {});
|
||||||
|
|
||||||
if(options && options.tls && option.tls === true){
|
if (options && options.tls && option.tls === true) {
|
||||||
var tls_or_net = tls;
|
tlsOrNet = tls;
|
||||||
} else {
|
} else {
|
||||||
var tls_or_net = net;
|
tlsOrNet = net;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a server instance, and chain the listen function to it
|
// Create a server instance, and chain the listen function to it
|
||||||
// The function passed to net.createServer() becomes the event handler for the 'connection' event
|
// The function passed to net.createServer() becomes the event handler for the 'connection' event
|
||||||
// The sock object the callback function receives UNIQUE for each connection
|
// The sock object the callback function receives UNIQUE for each connection
|
||||||
tls_or_net.createServer(options, function(sock) {
|
tlsOrNet.createServer(options, function(sock) {
|
||||||
var returnObj = serverSession(sock, options);
|
var returnObj = serverSession(sock, options);
|
||||||
|
|
||||||
// We have a connection - a socket object is assigned to the connection automatically
|
// We have a connection - a socket object is assigned to the connection automatically
|
||||||
|
|||||||
Reference in New Issue
Block a user