Re: (unknown)

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

I don't think that sleep in that case the best approach.
You could just call:
	bb_smscconn_send_failed(...,...,SMSCCONN_FAILED_TEMPORARILY,...)

and smscconn core will take care of resending.

Thanks,
Alex

Vincent CHAVANIS schrieb:
> Hi,
> 
> I would like to implement a retry mode in kannel_parse_reply (smsc_http.c)
> I mean actually we have only 2 way of process.
> -the msg has been rejected.
> -the msg has been accepted.
> Then it could be an interresting idea to retry sending the failed msg due to a failed connection.
> (We could even use http_status_code >= 500 ?! in this patch)
> 
> Is it making sense to you ?
> 
> regards
> 
> Vincent
> 
> 
> diff -rau /gateway-cvs/gw/smsc/smsc_http.c /gateway/gw/smsc/smsc_http.c
> --- /gateway-cvs/gw/smsc/smsc_http.c    2006-04-19 13:03:21.000000000 +0200
> +++ /gateway/gw/smsc/smsc_http.c        2006-04-19 21:38:04.000000000 +0200
> @@ -396,9 +396,21 @@
>              octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
>              octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
>          bb_smscconn_sent(conn, msg, NULL);
> +    } else if ((status == HTTP_INTERNAL_SERVER_ERROR || status == HTTP_NOT_IMPLEMENTED
> +        || status == HTTP_BAD_GATEWAY || status == HTTP_SERVICE_UNAVAILABLE)
> +        && (octstr_case_compare(body, octstr_imm("Try again later.")) == 0)) {
> +          ConnData *conndata = conn->data;
> +          conn->status = SMSCCONN_RECONNECTING;
> +          gwthread_sleep(conn->reconnect_delay);
> +          debug("smsc.http.kannel", 0, "HTTP[%s]: Re-sending request",
> +                octstr_get_cstr(conn->id));
> +          conndata->open_sends++;
> +          conndata->send_sms(conn, msg);
>      } else {
> +        error(0, "HTTP[%s]: Message was rejected. SMSC reponse was: <%s>",
> +              octstr_get_cstr(conn->id), octstr_get_cstr(body));
>          bb_smscconn_send_failed(conn, msg,
> -                   SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
> +                    SMSCCONN_FAILED_REJECTED, octstr_duplicate(body));
>      }
>  }
> 
> 
> --
> Telemaque - NICE - (FR)
> Service Technique - Developpement
> http://www.telemaque.fr/
> [email protected]
> Tel : +33 4 93 97 71 64 (fax 68)
> 
> 
> ------------------------------------------------------------------------
> 
> diff -rau /gateway-cvs/gw/smsc/smsc_http.c /gateway/gw/smsc/smsc_http.c
> --- /gateway-cvs/gw/smsc/smsc_http.c    2006-04-19 13:03:21.000000000 +0200
> +++ /gateway/gw/smsc/smsc_http.c        2006-04-19 21:38:04.000000000 +0200
> @@ -396,9 +396,21 @@
>              octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
>              octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
>          bb_smscconn_sent(conn, msg, NULL);
> +    } else if ((status == HTTP_INTERNAL_SERVER_ERROR || status == HTTP_NOT_IMPLEMENTED
> +        || status == HTTP_BAD_GATEWAY || status == HTTP_SERVICE_UNAVAILABLE)
> +        && (octstr_case_compare(body, octstr_imm("Try again later.")) == 0)) {
> +          ConnData *conndata = conn->data;
> +          conn->status = SMSCCONN_RECONNECTING;
> +          gwthread_sleep(conn->reconnect_delay);
> +          debug("smsc.http.kannel", 0, "HTTP[%s]: Re-sending request",
> +                octstr_get_cstr(conn->id));
> +          conndata->open_sends++;
> +          conndata->send_sms(conn, msg);
>      } else {
> +        error(0, "HTTP[%s]: Message was rejected. SMSC reponse was: <%s>",
> +              octstr_get_cstr(conn->id), octstr_get_cstr(body));
>          bb_smscconn_send_failed(conn, msg,
> -                   SMSCCONN_FAILED_MALFORMED, octstr_duplicate(body));
> +                    SMSCCONN_FAILED_REJECTED, octstr_duplicate(body));
>      }
>  }
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.