Re: [PATCH] more precise throughput using double [v3]

"Vincent CHAVANIS" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <217001c65a53$b71c7a00$9600a8c0@vince>
wow, something is going wrong with your modifications.

Here is the fix, 

--- /gateway-cvs/gw/smscconn.c  2006-04-07 14:54:05.000000000 +0200
+++ /gateway/gw/smscconn.c      2006-04-07 16:54:44.000000000 +0200
@@ -220,8 +220,10 @@
     if ((tmp = cfg_get(grp, octstr_imm("throughput"))) != NULL) {
         if (octstr_parse_double(&throughput, tmp, 0) == -1)
             conn->throughput = 0;
+        else
+            conn->throughput = (double) throughput;
         octstr_destroy(tmp);
-        info(0, "Set throughput to %.3f for smsc id <%s>", throughput, octstr_get_cstr(conn->id));
+        info(0, "Set throughput to %.3f for smsc id <%s>", conn->throughput, octstr_get_cstr(conn->id));
     }

Vincent

--
Telemaque - NICE - (FR)
Service Technique - Developpement
http://www.telemaque.fr/
[email protected]
Tel : +33 4 93 97 71 64 (fax 68)

----- Original Message ----- 
From: "Alexander Malysh" <[email protected]>
To: <[email protected]>
Sent: Friday, April 07, 2006 4:32 PM
Subject: Re: [PATCH] more precise throughput using double [v3]


> Vincent CHAVANIS schrieb:
>> Thanks++,
>> 
>> I did not see that point.
> 
> cfg_get(...) returns Octstr* that must be destroyed afterwards. and we 
> avoid using strXXX functions if we have the same functionality in Octstr.
> 
> Thanks,
> Alex
> 
>> 
>> Vincent
>> 
>> --
>> Telemaque - NICE - (FR)
>> Service Technique - Developpement
>> http://www.telemaque.fr/
>> [email protected]
>> Tel : +33 4 93 97 71 64 (fax 68)
>> 
>> ----- Original Message ----- 
>> From: "Alexander Malysh" <[email protected]>
>> To: <[email protected]>
>> Sent: Friday, April 07, 2006 2:51 PM
>> Subject: Re: [PATCH] more precise throughput using double [v3]
>> 
>> 
>>> Hi,
>>>
>>> this patch applies ok and committed to cvs in modified form.
>>>
>>>>> +    throughput = strtod(octstr_get_cstr(cfg_get(grp, 
>>> octstr_imm("throughput"))),(char **) NULL);
>>>>> +    if (throughput == ERANGE || throughput <= 0)
>>>>>          conn->throughput = 0;   /* defaults to no throughtput
>>> ...
>>>
>>> Here you have memleak. Look into committed version where it's fixed.
>>>
>>> Thanks,
>>> Alex
>>>
>>> Vincent CHAVANIS schrieb:
>>>> is this new one is ok ?
>>>>
>>>> --
>>>> Telemaque - NICE - (FR)
>>>> Service Technique - Developpement
>>>> http://www.telemaque.fr/
>>>> [email protected]
>>>> Tel : +33 4 93 97 71 64 (fax 68)
>>>>
>>>> ----- Original Message ----- 
>>>> From: "Alexander Malysh" <[email protected]>
>>>> To: <[email protected]>
>>>> Sent: Thursday, April 06, 2006 7:23 PM
>>>> Subject: Re: [PATCH] more precise throughput using double [v3]
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> you patch doesn't apply. Please redo your patch with cvs -Nau from 
>>>>> within gateway dir.
>>>>>
>>>>> Thanks,
>>>>> Alex
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smsc/smsc_emi.c gateway-patch/gw/smsc/smsc_emi.c
>>>>> --- gateway/gw/smsc/smsc_emi.c  2005-02-11 16:35:48.000000000 +0100
>>>>> +++ gateway-patch/gw/smsc/smsc_emi.c    2006-04-06 19:42:24.000000000 +0200
>>>>> @@ -992,7 +992,7 @@
>>>>>      Msg *msg;
>>>>>      double delay = 0;
>>>>>  
>>>>> -    if (conn->throughput) {
>>>>> +    if (conn->throughput > 0) {
>>>>>          delay = 1.0 / conn->throughput;
>>>>>      }
>>>>>      
>>>>> @@ -1001,7 +1001,7 @@
>>>>>             (msg = gw_prioqueue_remove(PRIVDATA(conn)->outgoing_queue)) != NULL) {
>>>>>          int nexttrn = emi2_next_trn(conn);
>>>>>  
>>>>> -        if (conn->throughput)
>>>>> +        if (conn->throughput > 0)
>>>>>              gwthread_sleep(delay);
>>>>>  
>>>>>          /* convert the generic Kannel message into an EMI type message */
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smsc/smsc_fake.c gateway-patch/gw/smsc/smsc_fake.c
>>>>> --- gateway/gw/smsc/smsc_fake.c 2005-02-11 16:35:48.000000000 +0100
>>>>> +++ gateway-patch/gw/smsc/smsc_fake.c   2006-04-06 19:42:38.000000000 +0200
>>>>> @@ -243,7 +243,7 @@
>>>>>      Msg        *msg;
>>>>>      double delay = 0;
>>>>>  
>>>>> -    if (conn->throughput) {
>>>>> +    if (conn->throughput > 0) {
>>>>>          delay = 1.0 / conn->throughput;
>>>>>      }
>>>>>  
>>>>> @@ -297,7 +297,7 @@
>>>>>              }
>>>>>  
>>>>>              /* obey throughput speed limit, if any */
>>>>> -            if (conn->throughput) {
>>>>> +            if (conn->throughput > 0) {
>>>>>                  gwthread_sleep(delay);
>>>>>              }
>>>>>          }
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smsc/smsc_http.c gateway-patch/gw/smsc/smsc_http.c
>>>>> --- gateway/gw/smsc/smsc_http.c 2006-03-29 11:17:55.000000000 +0200
>>>>> +++ gateway-patch/gw/smsc/smsc_http.c   2006-04-06 19:43:00.000000000 +0200
>>>>> @@ -1308,7 +1308,7 @@
>>>>>      Msg *sms = msg_duplicate(msg);
>>>>>      double delay = 0;
>>>>>  
>>>>> -    if (conn->throughput) {
>>>>> +    if (conn->throughput > 0) {
>>>>>          delay = 1.0 / conn->throughput;
>>>>>      }
>>>>>  
>>>>> @@ -1316,7 +1316,7 @@
>>>>>      conndata->send_sms(conn, sms);
>>>>>  
>>>>>      /* obey throughput speed limit, if any */
>>>>> -    if (conn->throughput)
>>>>> +    if (conn->throughput > 0)
>>>>>          gwthread_sleep(delay);
>>>>>  
>>>>>      return 0;
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smsc/smsc_smasi.c gateway-patch/gw/smsc/smsc_smasi.c
>>>>> --- gateway/gw/smsc/smsc_smasi.c        2005-02-11 16:35:48.000000000 +0100
>>>>> +++ gateway-patch/gw/smsc/smsc_smasi.c  2006-04-06 19:43:19.000000000 +0200
>>>>> @@ -872,7 +872,7 @@
>>>>>  
>>>>>      if (*pending_submits == -1) return;
>>>>>  
>>>>> -    if (smasi->conn->throughput) {
>>>>> +    if (smasi->conn->throughput > 0) {
>>>>>          delay = 1.0 / smasi->conn->throughput;
>>>>>      }
>>>>>  
>>>>> @@ -894,7 +894,7 @@
>>>>>          smasi_pdu_destroy(pdu);
>>>>>  
>>>>>          /* obey throughput speed limit, if any */
>>>>> -        if (smasi->conn->throughput)
>>>>> +        if (smasi->conn->throughput > 0)
>>>>>              gwthread_sleep(delay);
>>>>>  
>>>>>          ++(*pending_submits);
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smsc/smsc_smpp.c gateway-patch/gw/smsc/smsc_smpp.c
>>>>> --- gateway/gw/smsc/smsc_smpp.c 2006-02-07 15:54:44.000000000 +0100
>>>>> +++ gateway-patch/gw/smsc/smsc_smpp.c   2006-04-06 19:44:14.000000000 +0200
>>>>> @@ -1013,7 +1013,7 @@
>>>>>              /*
>>>>>               * obey throughput speed limit, if any.
>>>>>               */
>>>>> -            if (smpp->conn->throughput)
>>>>> +            if (smpp->conn->throughput > 0)
>>>>>                  gwthread_sleep(delay);
>>>>>          }
>>>>>          else { /* write error occurs */
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smscconn.c gateway-patch/gw/smscconn.c
>>>>> --- gateway/gw/smscconn.c       2006-04-01 19:48:51.000000000 +0200
>>>>> +++ gateway-patch/gw/smscconn.c 2006-04-06 19:51:57.000000000 +0200
>>>>> @@ -64,6 +64,7 @@
>>>>>  
>>>>>  #include <signal.h>
>>>>>  #include <time.h>
>>>>> +#include <errno.h>
>>>>>  
>>>>>  #include "gwlib/gwlib.h"
>>>>>  #include "gwlib/regex.h"
>>>>> @@ -151,7 +152,7 @@
>>>>>      SMSCConn *conn;
>>>>>      Octstr *smsc_type;
>>>>>      int ret;
>>>>> -    long throughput;
>>>>> +    double throughput;
>>>>>      Octstr *allowed_smsc_id_regex;
>>>>>      Octstr *denied_smsc_id_regex;
>>>>>      Octstr *allowed_prefix_regex;
>>>>> @@ -216,10 +217,13 @@
>>>>>          if ((conn->preferred_prefix_regex = gw_regex_comp(preferred_prefix_regex, REG_EXTENDED)) == NULL)
>>>>>              panic(0, "Could not compile pattern '%s'", octstr_get_cstr(preferred_prefix_regex));
>>>>>  
>>>>> -    if (cfg_get_integer(&throughput, grp, octstr_imm("throughput")) == -1)
>>>>> +    throughput = strtod(octstr_get_cstr(cfg_get(grp, octstr_imm("throughput"))),(char **) NULL);
>>>>> +    if (throughput == ERANGE || throughput <= 0)
>>>>>          conn->throughput = 0;   /* defaults to no throughtput limitation */
>>>>>      else
>>>>> -        conn->throughput = (int) throughput;
>>>>> +        conn->throughput = throughput;
>>>>> +
>>>>> +    info(0, "Set throughput to %.3f for smsc id <%s>", throughput, octstr_get_cstr(conn->id));
>>>>>  
>>>>>      /* configure the internal rerouting rules for this smsc id */
>>>>>      init_reroute(conn, grp);
>>>>> diff -i -E -b -w -B -rNau gateway/gw/smscconn_p.h gateway-patch/gw/smscconn_p.h
>>>>> --- gateway/gw/smscconn_p.h     2005-02-11 16:35:48.000000000 +0100
>>>>> +++ gateway-patch/gw/smscconn_p.h       2006-04-06 19:46:51.000000000 +0200
>>>>> @@ -194,7 +194,7 @@
>>>>>  
>>>>>      int alt_dcs; /* use alternate DCS 0xFX */
>>>>>  
>>>>> -    int throughput;     /* message thoughput per sec. to be delivered to SMSC */
>>>>> +    double throughput;     /* message thoughput per sec. to be delivered to SMSC */
>>>>>  
>>>>>      /* Stores rerouting information for this specific smsc-id */
>>>>>      int reroute;                /* simply turn MO into MT and process internally */
>>>
>>>
>> 
>> 
>> 
> 
> 
>
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.