Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/3] sms: restore pending tx messages from backup
Date: Mon, 06 Dec 2010 20:43:49 -0600	[thread overview]
Message-ID: <4CFD9F65.6030104@gmail.com> (raw)
In-Reply-To: <1290639202-12221-4-git-send-email-kristen@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]

Hi Kristen,

On 11/24/2010 04:53 PM, Kristen Carlson Accardi wrote:
> ---
>  src/ofono.h   |    1 +
>  src/sms.c     |   38 +++++++++++++++++++
>  src/smsutil.c |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  src/smsutil.h |    6 +++
>  4 files changed, 161 insertions(+), 0 deletions(-)
> 
> diff --git a/src/ofono.h b/src/ofono.h
> index d1a4bdc..4777f70 100644
> --- a/src/ofono.h
> +++ b/src/ofono.h
> @@ -241,6 +241,7 @@ enum ofono_sms_submit_flag {
>  	OFONO_SMS_SUBMIT_FLAG_RECORD_HISTORY =	0x2,
>  	OFONO_SMS_SUBMIT_FLAG_RETRY =		0x4,
>  	OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS =	0x8,
> +	OFONO_SMS_SUBMIT_FLAG_REUSE_UUID =	0x10,
>  };
>  
>  typedef void (*ofono_sms_txq_submit_cb_t)(gboolean ok, void *data);
> diff --git a/src/sms.c b/src/sms.c
> index f987946..be710b1 100644
> --- a/src/sms.c
> +++ b/src/sms.c
> @@ -1814,6 +1814,40 @@ static void bearer_init_callback(const struct ofono_error *error, void *data)
>  		ofono_error("Error bootstrapping SMS Bearer Preference");
>  }
>  
> +static void sms_restore_tx_queue(struct ofono_sms *sms)
> +{
> +	GQueue *backupq;
> +	unsigned int flags;
> +	struct txq_backup_entry *entry;
> +	struct ofono_uuid ofono_uuid;
> +
> +	DBG("");
> +
> +	flags = OFONO_SMS_SUBMIT_FLAG_RECORD_HISTORY;
> +	flags |= OFONO_SMS_SUBMIT_FLAG_RETRY;
> +	flags |= OFONO_SMS_SUBMIT_FLAG_REUSE_UUID;
> +
> +	if (sms->use_delivery_reports)
> +		flags |= OFONO_SMS_SUBMIT_FLAG_REQUEST_SR;

As I mentioned before, you should be restoring this information.
Assuming that it is the same for all messages on the tx queue is a
really bad idea.

> +
> +	backupq = sms_tx_queue_load(sms->imsi);
> +
> +	while ((entry = g_queue_pop_head(backupq))) {
> +		decode_hex_own_buf(entry->uuid, -1, NULL, 0, ofono_uuid.uuid);
> +
> +		__ofono_sms_txq_submit(sms, entry->msg_list, flags,
> +					&ofono_uuid, NULL, NULL);

Using sms_txq_submit is a bad idea.  This one will re-calculate the UUID
which gets tossed out later.  I suggest creating the tx_queue entries 'raw'.

> +
> +		g_slist_foreach(entry->msg_list, (GFunc)g_free, NULL);
> +		g_slist_free(entry->msg_list);
> +
> +		g_free(entry->uuid);
> +		g_free(entry);
> +	}
> +
> +	g_queue_free(backupq);
> +}
> +
>  /*
>   * Indicate oFono that a SMS driver is ready for operation
>   *

<snip>

Regards,
-Denis

  reply	other threads:[~2010-12-07  2:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24 22:53 [PATCH 0/3] Persist TX SMS messages Kristen Carlson Accardi
2010-11-24 22:53 ` [PATCH 1/3] sms: store pending tx pdus on disk Kristen Carlson Accardi
2010-12-07  2:38   ` Denis Kenzior
2010-12-07 22:57     ` Kristen Carlson Accardi
2010-12-08 11:01       ` Denis Kenzior
2010-12-11  0:16     ` [PATCH 1/3 v2] " Kristen Carlson Accardi
2010-12-07 13:26   ` [PATCH 1/3] " Aki Niemi
2010-11-24 22:53 ` [PATCH 2/3] sms: delete sent sms messages from backup Kristen Carlson Accardi
2010-12-07  2:31   ` Denis Kenzior
2010-12-11  0:16     ` [PATCH 2/3 v2] " Kristen Carlson Accardi
2010-11-24 22:53 ` [PATCH 3/3] sms: restore pending tx " Kristen Carlson Accardi
2010-12-07  2:43   ` Denis Kenzior [this message]
2010-12-11  0:17     ` [PATCH 3/3 v2] " Kristen Carlson Accardi
  -- strict thread matches above, loose matches on Subject: below --
2011-01-25 12:47 [PATCH 0/3] Persist TX SMS messages Lucas De Marchi
2011-01-25 12:47 ` [PATCH 3/3] sms: restore pending tx messages from backup Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CFD9F65.6030104@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox