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)
|
||||
*/
|
||||
function client(options, callback) {
|
||||
var sock;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
@@ -111,10 +112,10 @@ function client(options, callback) {
|
||||
'enqLinkTiming': 20000 // 20 sec
|
||||
}, options || {});
|
||||
|
||||
if(options && options.tls && option.tls === true){
|
||||
var sock = new tls.Socket();
|
||||
if (options && options.tls && option.tls === true) {
|
||||
sock = new tls.Socket();
|
||||
} else {
|
||||
var sock = new net.Socket();
|
||||
sock = new net.Socket();
|
||||
}
|
||||
|
||||
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)
|
||||
*/
|
||||
function server(options, callback) {
|
||||
var tlsOrNet;
|
||||
|
||||
if (typeof options === 'function') {
|
||||
callback = options;
|
||||
options = {};
|
||||
@@ -159,16 +161,16 @@ function server(options, callback) {
|
||||
'timeout': 40000 // 40 sec
|
||||
}, options || {});
|
||||
|
||||
if(options && options.tls && option.tls === true){
|
||||
var tls_or_net = tls;
|
||||
if (options && options.tls && option.tls === true) {
|
||||
tlsOrNet = tls;
|
||||
} else {
|
||||
var tls_or_net = net;
|
||||
tlsOrNet = net;
|
||||
}
|
||||
|
||||
// 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 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);
|
||||
|
||||
// We have a connection - a socket object is assigned to the connection automatically
|
||||
|
||||
Reference in New Issue
Block a user