Indent and minor linting tweaks to the latest merge

This commit is contained in:
2016-06-23 11:42:10 +02:00
parent 9257174f9e
commit 3c6f462175
2 changed files with 121 additions and 118 deletions
+3 -2
View File
@@ -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;
@@ -112,9 +113,9 @@ function client(options, callback) {
}, options || {});
if (options && options.tls && option.tls === true) {
var sock = new tls.Socket();
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);
+5 -3
View File
@@ -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 = {};
@@ -160,15 +162,15 @@ function server(options, callback) {
}, options || {});
if (options && options.tls && option.tls === true) {
var tls_or_net = tls;
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