Better robusteness for errors when writing buffers
This commit is contained in:
+7
-1
@@ -69,7 +69,13 @@ function session(sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.verbose('larvitsmpp: lib/session.js: session() - sockWrite() - sending PDU. SeqNr: ' + pdu.readUInt32BE(12) + ' cmd: ' + defs.cmdsById[pdu.readUInt32BE(4)].command + ' cmdStatus: ' + defs.errorsById[parseInt(pdu.readUInt32BE(8))] + ' hex: ' + pdu.toString('hex'));
|
||||
try {
|
||||
log.verbose('larvitsmpp: lib/session.js: session() - sockWrite() - sending PDU. SeqNr: ' + pdu.readUInt32BE(12) + ' cmd: ' + defs.cmdsById[pdu.readUInt32BE(4)].command + ' cmdStatus: ' + defs.errorsById[parseInt(pdu.readUInt32BE(8))] + ' hex: ' + pdu.toString('hex'));
|
||||
} catch (e) {
|
||||
log.error('larvitsmpp: lib/session.js: session() - sockWrite() - PDU buffer is invalid. Buffer hex: "' + pdu.toString('hex') + '"');
|
||||
return;
|
||||
}
|
||||
|
||||
sock.write(pdu);
|
||||
|
||||
if (closeAfterSend) {
|
||||
|
||||
Reference in New Issue
Block a user