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: Sven Eckelmann <sven@narfation.org>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: detect not yet announced clients
Date: Wed, 27 Jun 2012 08:34:05 +0200	[thread overview]
Message-ID: <20120627063404.GE3290@ritirata.org> (raw)
In-Reply-To: <1564568.1LY5lsXFIC@sven-laptop.home.narfation.org>

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

On Tue, Jun 26, 2012 at 11:50:22PM +0200, Sven Eckelmann wrote:
> > 
> >  	for (i = 0; i < hash->size; i++) {
> >  		head = &hash->table[i];
> >  		list_lock = &hash->list_locks[i];
> > 
> >  		spin_lock_bh(list_lock);
> > -		batadv_tt_global_roam_purge_list(bat_priv, head);
> > +		hlist_for_each_entry_safe(tt_common_entry, node, node_tmp,
> > +					  head, hash_entry) {
> > +			purge = false;
> > +			tt_global = container_of(tt_common_entry,
> > +						 struct batadv_tt_global_entry,
> > +						 common);
> > +			if ((tt_global->common.flags & BATADV_TT_CLIENT_ROAM) &&
> > +			    batadv_has_timed_out(tt_global->roam_at,
> > +						 roam_timeout)) {
> > +				purge = true;
> > +				msg = "Roaming timeout\n";
> > +			}
> > +
> > +			if ((tt_global->common.flags & BATADV_TT_CLIENT_TEMP) &&
> > +			    batadv_has_timed_out(tt_global->common.added_at,
> > +						 temp_timeout)) {
> > +				purge = true;
> > +				msg = "Temporary client timeout\n";
> > +			}
> > +
> > +			if (!purge)
> > +				continue;
> > +
> > +			batadv_dbg(BATADV_DBG_TT, bat_priv,
> > +				   "Deleting global tt entry (%pM): %s\n",
> > +				   tt_global->common.addr, msg);
> > +
> > +			hlist_del_rcu(node);
> > +			batadv_tt_global_entry_free_ref(tt_global);
> > +		}
> >  		spin_unlock_bh(list_lock);
> >  	}
> 
> Why writing this whole thing in one function? You don't get a price for the 
> highest indentation level that banged the hardest against the 80 character 
> limit.

Mh, I like challenges :-) However, I'll add another function like:
has_to_be_purged() or similar in which i will check for the conditions and I
will use it only in the loop.


> 
> 
> > -	if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM)
> > +	if (tt_common_entry->flags & BATADV_TT_CLIENT_ROAM ||
> > +	    tt_common_entry->flags & BATADV_TT_CLIENT_TEMP)
> >  		return 0;
> > 
> > +
> >  	tt_global_entry = container_of(tt_common_entry,
> >  				       struct batadv_tt_global_entry,
> >  				       common);
> 
> And this new line doesn't make sense

I agree.


Thank you very much Sven.

Cheers,


-- 
Antonio Quartulli

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

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

  reply	other threads:[~2012-06-27  6:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 20:00 [B.A.T.M.A.N.] [PATCH 0/5] new feature: Speedy Join 2012-06-26 Antonio Quartulli
2012-06-26 20:00 ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: add reference counting for type batadv_tt_orig_list_entry Antonio Quartulli
2012-06-26 21:23   ` Sven Eckelmann
     [not found]   ` <3809123.2JX82ntKN2@sven-laptop.home.narfation.org>
2012-06-27  6:26     ` Antonio Quartulli
     [not found]   ` <1403237.H233GFHdJC@sven-laptop.home.narfation.org>
2012-06-27  6:26     ` Antonio Quartulli
2012-06-26 20:00 ` [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: implement batadv_tt_global_entry_get_orig() Antonio Quartulli
2012-06-26 20:00 ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: enable roaming packets to carry flags Antonio Quartulli
2012-06-26 21:22   ` Sven Eckelmann
2012-06-26 21:45     ` Matthias Schiffer
2012-06-27  6:31       ` Antonio Quartulli
     [not found]   ` <3265215.erIRmWtS44@sven-laptop.home.narfation.org>
2012-06-27  6:30     ` Antonio Quartulli
2012-06-27  6:58       ` Antonio Quartulli
2012-06-26 20:00 ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: detect not yet announced clients Antonio Quartulli
2012-06-26 21:50   ` Sven Eckelmann
2012-06-27  6:34     ` Antonio Quartulli [this message]
2012-06-26 20:00 ` [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: change interface_rx to get orig node Antonio Quartulli

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=20120627063404.GE3290@ritirata.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sven@narfation.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