Minor simplification of code

This commit is contained in:
2015-06-13 14:43:48 +02:00
parent 9b88428ebd
commit e42aa4f1e7
+6 -9
View File
@@ -310,25 +310,22 @@ function sendReturn(pdu, status, params, closeAfterSend, callback) {
closeAfterSend = undefined;
}
if (typeof callback !== 'function') {
callback = function() {};
}
utils.pduReturn(pdu, status, params, function(err, retPdu) {
if (err) {
log.error('larvitsmpp: lib/session.js: sendReturn() - Could not create return PDU: ' + err.message);
that.closeSocket();
if (typeof callback === 'function') {
callback(err);
}
callback(err);
return;
}
log.silly('larvitsmpp: lib/session.js: sendReturn() - Sending return PDU: ' + retPdu.toString('hex'));
that.sockWrite(retPdu, closeAfterSend);
if (typeof callback === 'function') {
callback(null, retPdu);
}
callback(null, retPdu);
});
}