public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: "Martin Hundebøll" <martin@hundeboll.net>
Cc: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval
Date: Wed, 18 Apr 2012 10:37:15 +0200	[thread overview]
Message-ID: <20120418083714.GG27966@ritirata.org> (raw)
In-Reply-To: <4F8E7C5E.9010301@hundeboll.net>

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

On Wed, Apr 18, 2012 at 10:33:34AM +0200, Martin Hundebøll wrote:
> Hi Antonio,
> 
> On 04/18/2012 12:27 AM, Antonio Quartulli wrote:
> > +	/* check for ADD+DEL or DEL+ADD events */
> >   	spin_lock_bh(&bat_priv->tt_changes_list_lock);
> > +	list_for_each_entry_safe(entry, safe,&bat_priv->tt_changes_list,
> > +				 list) {
> > +		if (!compare_eth(entry->change.addr, addr))
> > +			continue;
> 
> Please add an empty line here.

Is this really needed for some specific reason?

> 
> > +		if (!(!(flags&  TT_CLIENT_DEL)&&  /* ADD op */
> > +		      entry->change.flags&  TT_CLIENT_DEL)&&
> > +		    !(flags&  TT_CLIENT_DEL&&
> > +		      !(entry->change.flags&  TT_CLIENT_DEL))) /* ADD op */
> > +			continue;
> 
> This is messy and hard to unerstand. Couldn't you use some tmp vars like this:
> 
> int local_del = (flags & TT_CLIENT_DEL) == TT_CLIENT_DEL;
> int change_del = (entry->change.flags & TT_CLIENT_DEL) == TT_CLIENT_DEL;
> 
> if (local_del == change_del)
> 	continue;
> 
> I'm not 100% sure I understood the original if correctly, but that just proofs the need to rework it :)

eheh, I know I like to mess up the code with boolean formulas :D
Thank you for your feedback, I will simplify it.

> 
> > +		/* DEL+ADD in the same orig interval have no effect and can be
> > +		 * removed to avoid silly behaviour on the receiver side. The
> > +		 * other way around (ADD+DEL) can happen in case of roaming of
> > +		 * a client still in the NEW state. Roaming of NEW clients is
> > +		 * now possible due to automatically recognition of "temporary"
> > +		 * clients */
> 
> Remember newline for */ :)

yes .-.


Thanks again!


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2012-04-18  8:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-17 22:27 [B.A.T.M.A.N.] [PATCH 0/5] Preparation for SPEEDY_JOIN/ROAM Antonio Quartulli
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: don't delay OGM information announcement Antonio Quartulli
2012-04-18  8:12   ` Martin Hundebøll
2012-04-18  8:31     ` Antonio Quartulli
2012-04-18  8:35       ` Martin Hundebøll
2012-04-18  8:37         ` Antonio Quartulli
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: clear ADD+DEL (and viceversa) events in the same orig-interval Antonio Quartulli
2012-04-18  8:33   ` Martin Hundebøll
2012-04-18  8:37     ` Antonio Quartulli [this message]
2012-04-18  8:40       ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: let tt_global_entry_has_orig() return the orig_entry or NULL instead of 1 or 0 only Antonio Quartulli
2012-04-18  8:44   ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: update ttvn in case of client reannouncement Antonio Quartulli
2012-04-18  8:46   ` Martin Hundebøll
2012-04-17 22:27 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: beautify tt_global_add() argument list Antonio Quartulli
2012-04-18  8:52   ` Martin Hundebøll

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=20120418083714.GG27966@ritirata.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=martin@hundeboll.net \
    /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