[PATCH] Throttling support for AT smsc

Vincent CHAVANIS <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization TELEMAQUE
Message-ID <[email protected]>
Hi all,

Here is a small patch to support throttling on AT smsc

Any comment ?

regards

Vincent.
smsc_at_throttling.txt (text/plain, 914 B)
--- /gateway-cvs/gw/smsc/smsc_at.c      2010-10-07 16:26:11.212892930 +0200
+++ /gateway/gw/smsc/smsc_at.c  2011-05-13 14:44:13.446937850 +0200
@@ -269,7 +269,7 @@
      * the connection and sending the first AT commands 
      */
     if (privdata->modem == NULL || privdata->modem->need_sleep)
-        sleep(1);
+        gwthread_sleep(1);
     debug("bb.smsc.at2", 0, "AT2[%s]: device opened", octstr_get_cstr(privdata->name));
     return 0;
 }
@@ -2210,9 +2210,12 @@
     if (privdata->modem->enable_mms && gw_prioqueue_len(privdata->outgoing_queue) > 1)
         at2_send_modem_command(privdata, "AT+CMMS=2", 0, 0);
 
-    if ((msg = gw_prioqueue_remove(privdata->outgoing_queue)))
+    if ((msg = gw_prioqueue_remove(privdata->outgoing_queue))) {
+       if (privdata->conn->throughput > 0)
+            gwthread_sleep(1.0 / privdata->conn->throughput);
         at2_send_one_message(privdata, msg);
 }
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.