Minor simplification of code
This commit is contained in:
+4
-7
@@ -310,25 +310,22 @@ function sendReturn(pdu, status, params, closeAfterSend, callback) {
|
|||||||
closeAfterSend = undefined;
|
closeAfterSend = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof callback !== 'function') {
|
||||||
|
callback = function() {};
|
||||||
|
}
|
||||||
|
|
||||||
utils.pduReturn(pdu, status, params, function(err, retPdu) {
|
utils.pduReturn(pdu, status, params, function(err, retPdu) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('larvitsmpp: lib/session.js: sendReturn() - Could not create return PDU: ' + err.message);
|
log.error('larvitsmpp: lib/session.js: sendReturn() - Could not create return PDU: ' + err.message);
|
||||||
that.closeSocket();
|
that.closeSocket();
|
||||||
|
|
||||||
if (typeof callback === 'function') {
|
|
||||||
callback(err);
|
callback(err);
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.silly('larvitsmpp: lib/session.js: sendReturn() - Sending return PDU: ' + retPdu.toString('hex'));
|
log.silly('larvitsmpp: lib/session.js: sendReturn() - Sending return PDU: ' + retPdu.toString('hex'));
|
||||||
|
|
||||||
that.sockWrite(retPdu, closeAfterSend);
|
that.sockWrite(retPdu, closeAfterSend);
|
||||||
|
|
||||||
if (typeof callback === 'function') {
|
|
||||||
callback(null, retPdu);
|
callback(null, retPdu);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user