All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz at gmail.com>
To: iwd at lists.01.org
Subject: Re: [PATCH 1/2] Initial signal level notification
Date: Fri, 20 May 2022 15:11:55 -0500	[thread overview]
Message-ID: <a5abf8cf-ab6e-7ea5-a458-f5d629f18561@gmail.com> (raw)
In-Reply-To: 20220520185948.9533-1-jesse@twosheds.org

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

Hi Jesse,

On 5/20/22 13:59, Jesse Lentz wrote:
> After registration of a SignalLevelAgent, make iwd inform the client of
> the initial signal level via a "Changed" method call.
> ---
>   src/netdev.c  |  5 +++++
>   src/netdev.h  |  1 +
>   src/station.c | 16 ++++++++++++----
>   3 files changed, 18 insertions(+), 4 deletions(-)
> 

<snip>

> diff --git a/src/station.c b/src/station.c
> index 2d85054c..7be256fe 100644
> --- a/src/station.c
> +++ b/src/station.c

<snip>

> @@ -3758,10 +3768,8 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
>   
>   	l_debug("agent %s path %s", sender, path);
>   
> -	/*
> -	 * TODO: send an initial notification in a oneshot idle callback,
> -	 * if state is connected.
> -	 */
> +	if (station->connected_network)
> +		l_idle_oneshot(signal_agent_notify_initial, station, NULL);
>   
>   	return l_dbus_message_new_method_return(message);

I'd rather not use l_idle_oneshot here.  There's a astronomically tiny chance 
that station will be wiped out before the idle callback fires on the next loop 
iteration.  It should also be easy to avoid:

struct l_dbus_message *reply;

...

reply = l_dbus_message_new_method_return(message);
l_dbus_send(dbus, reply);

if (station->connected_network)
	station_signal_agent_notify(...);

return NULL;

This ensures the reply goes out prior to the Changed method being invoked.

>   }
> 

Regards,
-Denis

             reply	other threads:[~2022-05-20 20:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 20:11 Denis Kenzior [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-20 22:00 [PATCH 1/2] Initial signal level notification Denis Kenzior
2022-05-20 21:53 Jesse Lentz
2022-05-20 20:50 Jesse Lentz
2022-05-20 18:59 Jesse Lentz

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=a5abf8cf-ab6e-7ea5-a458-f5d629f18561@gmail.com \
    --to=unknown@example.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.