Re: [PATCH] new config variable : add-delay

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

Sorry but I can't understand why you need this additional config option? 
Is throughput not enough? It would be better to just allow throughput to 
be double if it now the case already.

Thanks,
Alex

Vincent CHAVANIS schrieb:
> This patch adds a new variable called 'add-delay' to the config file
> 
> group = smsc
> smsc = fake
> smsc-id = FAKE
> throughput = 1 
> add-delay = 200 # adding 200ms to the delay (ie. = 1.0 / throughput + add-delay)
> port = 10000
> connect-allow-ip = 127.0.0.1
> 
> 'add-delay' is a delay in milisec that can fixes the strict operator QOS.
> Typically, when you are connected to your operator with an ADSL line, you 
> depends to the "ADSL plateform lag" (in our case between 50-200ms) which can alter the time that
> your operator will receive your MT and then should drop or not your MT.
> This allows to set a margin for this problem.
> 'add-delay' is only working when throughput > 0
> 
> regards
> 
> Vincent.
> 
> 
> --
> Telemaque - NICE - (FR)
> Service Technique - Developpement
> http://www.telemaque.fr/
> [email protected]
> Tel : +33 4 93 97 71 64 (fax 68)
> 
> 
> ------------------------------------------------------------------------
> 
> diff -i -E -b -w -B -ur gateway/gw/smsc/emimsg.c gateway2/gw/smsc/emimsg.c
> --- gateway/gw/smsc/emimsg.c    2005-02-11 16:35:48.000000000 +0100
> +++ gateway2/gw/smsc/emimsg.c   2006-02-21 17:05:16.000000000 +0100
> @@ -992,8 +1006,12 @@
>      Msg *msg;
>      double delay = 0;
>  
> -    if (conn->throughput) {
> -        delay = 1.0 / conn->throughput;
> +    if (conn->throughput > 0) {
> +        if (conn->add_delay > 0) {
> +        delay = ((1.0 / conn->throughput) + (conn->add_delay / 1000));
> +        } else {
> +        delay = (1.0 / conn->throughput);
> +        }
>      }
>      
>      /* Send messages if there's room in the sending window */
> diff -i -E -b -w -B -ur gateway/gw/smsc/smsc_fake.c gateway2/gw/smsc/smsc_fake.c
> --- gateway/gw/smsc/smsc_fake.c 2005-02-11 16:35:48.000000000 +0100
> +++ gateway2/gw/smsc/smsc_fake.c        2006-03-03 16:19:08.000000000 +0100
> @@ -243,8 +243,12 @@
>      Msg        *msg;
>      double delay = 0;
>  
> -    if (conn->throughput) {
> -        delay = 1.0 / conn->throughput;
> +    if (conn->throughput > 0) {
> +        if (conn->add_delay > 0) {
> +        delay = ((1.0 / conn->throughput) + (conn->add_delay / 1000));
> +        } else {
> +        delay = (1.0 / conn->throughput);
> +        }
>      }
>  
>      while (1) {
> diff -i -E -b -w -B -ur gateway/gw/smsc/smsc_http.c gateway2/gw/smsc/smsc_http.c
> --- gateway/gw/smsc/smsc_http.c 2005-09-20 00:07:33.000000000 +0200
> +++ gateway2/gw/smsc/smsc_http.c        2006-03-03 16:18:24.000000000 +0100
> @@ -1072,8 +1072,12 @@
>      Msg *sms = msg_duplicate(msg);
>      double delay = 0;
>  
> -    if (conn->throughput) {
> -        delay = 1.0 / conn->throughput;
> +    if (conn->throughput > 0) {
> +        if (conn->add_delay > 0) {
> +        delay = ((1.0 / conn->throughput) + (conn->add_delay / 1000));
> +        } else {       
> +        delay = (1.0 / conn->throughput);
> +        }
>      }
>  
>      conndata->open_sends++;
> diff -i -E -b -w -B -ur gateway/gw/smsc/smsc_smasi.c gateway2/gw/smsc/smsc_smasi.c
> --- gateway/gw/smsc/smsc_smasi.c        2005-02-11 16:35:48.000000000 +0100
> +++ gateway2/gw/smsc/smsc_smasi.c       2006-03-03 16:17:27.000000000 +0100
> @@ -872,8 +872,12 @@
>  
>      if (*pending_submits == -1) return;
>  
> -    if (smasi->conn->throughput) {
> -        delay = 1.0 / smasi->conn->throughput;
> +    if (smasi->conn->throughput > 0) {
> +        if (smasi->conn->add_delay) {
> +        delay = ((1.0 / smasi->conn->throughput) + (smasi->conn->add_delay / 1000));
> +        } else {
> +        delay = (1.0 / smasi->conn->throughput);
> +        }
>      }
>  
>      while (*pending_submits < MAX_PENDING_SUBMITS) {
> diff -i -E -b -w -B -ur gateway/gw/smsc/smsc_smpp.c gateway2/gw/smsc/smsc_smpp.c
> --- gateway/gw/smsc/smsc_smpp.c 2006-02-07 15:54:44.000000000 +0100
> +++ gateway2/gw/smsc/smsc_smpp.c        2006-03-03 16:17:41.000000000 +0100
> @@ -987,7 +987,11 @@
>          return;
>  
>      if (smpp->conn->throughput > 0) {
> -        delay = 1.0 / smpp->conn->throughput;
> +        if (smpp->conn->add_delay > 0) {
> +        delay = ((1.0 / smpp->conn->throughput) + (smpp->conn->add_delay / 1000));
> +        } else {
> +        delay = (1.0 / smpp->conn->throughput);
> +        }
>      }
>  
>      while (*pending_submits < smpp->max_pending_submits) {
> diff -i -E -b -w -B -ur gateway/gw/smscconn.c gateway2/gw/smscconn.c
> --- gateway/gw/smscconn.c       2005-03-09 21:04:20.000000000 +0100
> +++ gateway2/gw/smscconn.c      2006-03-03 12:59:19.000000000 +0100
> @@ -151,6 +151,7 @@
>      SMSCConn *conn;
>      Octstr *smsc_type;
>      int ret;
> +    long add_delay;
>      long throughput;
>      Octstr *allowed_smsc_id_regex;
>      Octstr *denied_smsc_id_regex;
> @@ -216,6 +217,12 @@
>          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(&add_delay, grp, octstr_imm("add-delay")) == -1)
> +        conn->add_delay = 0;   /* defaults to no add_delay limitation */
> +    else
> +        conn->add_delay = (int) add_delay;
> +    info(0, "SMS add-delay set to [%d] milisec for smsc id <%s>", conn->add_delay, octstr_get_cstr(conn->id));
> +
>      if (cfg_get_integer(&throughput, grp, octstr_imm("throughput")) == -1)
>          conn->throughput = 0;   /* defaults to no throughtput limitation */
>      else
> diff -i -E -b -w -B -ur gateway/gw/smscconn_p.h gateway2/gw/smscconn_p.h
> --- gateway/gw/smscconn_p.h     2005-02-11 16:35:48.000000000 +0100
> +++ gateway2/gw/smscconn_p.h    2006-03-03 12:12:11.000000000 +0100
> @@ -194,6 +194,7 @@
>  
>      int alt_dcs; /* use alternate DCS 0xFX */
>  
> +    int add_delay;     /* add delay to SMSC */
>      int throughput;     /* message thoughput per sec. to be delivered to SMSC */
>  
>      /* Stores rerouting information for this specific smsc-id */
> 
> diff -i -E -b -w -B -ur gateway/gwlib/cfg.def gateway2/gwlib/cfg.def
> --- gateway/gwlib/cfg.def       2006-01-29 16:54:05.000000000 +0100
> +++ gateway2/gwlib/cfg.def      2006-03-03 12:19:31.000000000 +0100
> @@ -299,6 +299,7 @@
>      OCTSTR(log-level)
>      OCTSTR(our-host)
>      OCTSTR(alt-dcs)
> +    OCTSTR(add-delay) 
>      OCTSTR(throughput)
>      OCTSTR(alt-charset)
>      OCTSTR(host)
>
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.