Skip to content

Commit

Permalink
Fix issue #3 #5 timeout + err
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian H-J committed Apr 4, 2017
1 parent bd62a44 commit 8bb4bad
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ port.on('data', function (data) {
}
})
}
if (log.indexOf('+CMS ERROR:304') != -1 && stack[0] && stack[0].a == 'msg' && !stack[0].error) {
stack[0].nbTry++;
if (log.indexOf('ERROR') != -1 && stack[0] && stack[0].a == 'msg' && !stack[0].error) {
stack[0].nbTry++;
if (stack[0].nbTry == 5) {
if (typeof stack[0].onError == 'function') {
stack[0].onError(parseErr(log))
Expand All @@ -100,11 +100,6 @@ port.on('data', function (data) {
} else {
smsS1();
}
} else if (log.indexOf('ERROR') != -1 && stack[0] && stack[0].a == 'msg' && !stack[0].error) {
if (typeof stack[0].onError == 'function') {
stack[0].onError(parseErr(log))
}
onStackItemDone();
} else if (log.indexOf('+CME ERROR:58') != -1 && !stack[0].error) {
if (stack[0] && typeof stack[0].onError == 'function') {
stack[0].onError(parseErr(log))
Expand Down Expand Up @@ -280,7 +275,10 @@ app.post('/msg', (req, res) => {
text: req.body.text,
onSent: () => {
res.json({
success: true
success: true,
nbTry: stack[0].nbTry,
nbErr: stack[0].nbErr,
nbPdu: stack[0].nbPdu
})
},
onError: (err) => {
Expand Down

0 comments on commit 8bb4bad

Please sign in to comment.