Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v2 1/2] gatserver: add command finished functions
Date: Fri, 12 Aug 2011 02:00:04 -0500	[thread overview]
Message-ID: <4E44CF74.6070109@gmail.com> (raw)
In-Reply-To: <1312468190-27253-1-git-send-email-frederic.danis@linux.intel.com>

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

Hi Frédéric,

On 08/04/2011 09:29 AM, Frédéric Danis wrote:
> ---
>  gatchat/gatserver.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
>  gatchat/gatserver.h |    7 +++++++
>  2 files changed, 51 insertions(+), 0 deletions(-)
> 

I haven't forgotten about this patch, but I found a nasty corner case in
GAtServer that breaks the current implementation.  I'm still looking for
a nice solution.

> diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
> index ab785f7..8e92071 100644
> --- a/gatchat/gatserver.c
> +++ b/gatchat/gatserver.c
> @@ -115,6 +115,9 @@ struct _GAtServer {
>  	gpointer user_disconnect_data;		/* User disconnect data */
>  	GAtDebugFunc debugf;			/* Debugging output function */
>  	gpointer debug_data;			/* Data to pass to debug func */
> +	GAtServerFinishFunc finishf;		/* Command finish function */
> +	gpointer finish_data;			/* Finish func data */
> +	guint finish_source;
>  	GHashTable *command_list;		/* List of AT commands */
>  	GQueue *write_queue;			/* Write buffer queue */
>  	guint max_read_attempts;		/* Max reads per select */
> @@ -1177,12 +1180,27 @@ static void server_wakeup_writer(GAtServer *server)
>  	g_at_io_set_write_handler(server->io, can_write_data, server);
>  }
>  
> +static gboolean notify_finish(void *user_data)
> +{
> +	GAtServer *server = user_data;
> +
> +	server->finishf(server, server->finish_data);
> +	server->finish_source = 0;
> +
> +	return FALSE;
> +}
> +
>  static void server_resume(GAtServer *server)
>  {
>  	if (server->suspended == FALSE)
>  		return;
>  
>  	server->suspended = FALSE;
> +
> +	if (server->finishf)
> +		server->finish_source = g_timeout_add_seconds(0, notify_finish,
> +								server);
> +
>  	g_at_io_set_read_handler(server->io, new_bytes, server);
>  }
>  

<snip>

Can you brainstorm some ideas of a way not to use a g_timeout_add and do
the finish notify synchronously?  I suspect there is a nice(r) solution.

Regards,
-Denis

  parent reply	other threads:[~2011-08-12  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-04 14:29 [PATCH v2 1/2] gatserver: add command finished functions =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-08-04 14:29 ` [PATCH v2 2/2] emulator: fix indicator notification =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-08-15  5:24   ` Denis Kenzior
2011-08-12  7:00 ` Denis Kenzior [this message]
2011-08-15  5:32 ` [PATCH v2 1/2] gatserver: add command finished functions Denis Kenzior

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=4E44CF74.6070109@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