Commit 891496590fbbf1fac0008599576da9b255255748

Authored by Adhidarma Hadiwinoto
1 parent cc62b3bf91
Exists in master and in 1 other branch webadmin

Max length 140

Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff

... ... @@ -18,10 +18,10 @@ async function sleep(ms) {
18 18 });
19 19 }
20 20  
21   -async function sendToModem(partner, msg, modem, parentXid) {
  21 +async function sendToModem(partner, msg, modem, parentXid, part) {
22 22 const xid = parentXid || uniqid();
23 23  
24   - const [msgHead, msgTail] = messageSplitter(msg.trim(), 160);
  24 + const [msgHead, msgTail] = messageSplitter(msg.trim(), 140);
25 25 if (!msgHead) {
26 26 return;
27 27 }
... ... @@ -29,7 +29,10 @@ async function sendToModem(partner, msg, modem, parentXid) {
29 29 logger.info('TRANSPORT: Sending message to EVO-CP', {
30 30 xid,
31 31 partner,
32   - msgHead,
  32 + msg: msgHead,
  33 + msgLength: msgHead.length,
  34 + tailLength: msgTail.length,
  35 + part,
33 36 modem: modem.name,
34 37 });
35 38  
... ... @@ -72,7 +75,7 @@ async function sendToModem(partner, msg, modem, parentXid) {
72 75 modemLocks.unlock(modem.name);
73 76  
74 77 if (msgTail) {
75   - await sendToModem(partner, msgTail, modem);
  78 + await sendToModem(partner, msgTail, modem, part + 1);
76 79 }
77 80 }
78 81  
... ... @@ -99,5 +102,5 @@ exports.send = async (partner, msg) => {
99 102 return;
100 103 }
101 104  
102   - await sendToModem(partner, msg.trim(), modem, xid);
  105 + await sendToModem(partner, msg.trim(), modem, xid, 1);
103 106 };