From 3023245c4f75f2ffc9ab3fbb7b8d89012d165108 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Fri, 26 Jul 2019 16:48:34 +0700 Subject: [PATCH] Pengamanan tambahan --- lib/modem.js | 2 ++ lib/mutex.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/modem.js b/lib/modem.js index f98ad4a..3be3937 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -189,6 +189,8 @@ async function registerSignalStrengthBackgroundQuery() { } async function sendSMS(destination, msg) { + if (typeof destination !== 'string' || typeof msg !== 'string' || !destination.trim() || !msg.trim()) return; + await mutex.setLockWaitForCommand(); logger.info('Sending message', { destination, msg }); diff --git a/lib/mutex.js b/lib/mutex.js index cf255bd..677b525 100644 --- a/lib/mutex.js +++ b/lib/mutex.js @@ -36,7 +36,7 @@ function releaseLockWaitForCommand() { } catch (e) { // } - }, 1500); + }, 2000); } exports.setLockWaitForOK = setLockWaitForOK; -- 1.9.0