mailing list archives
Re: [Nsock] Scalable event handling
From: David Fifield <david () bamsoftware com>
Date: Tue, 6 Aug 2013 23:41:13 -0700
On Thu, Jul 25, 2013 at 10:31:03PM +0200, Henri Doreau wrote:
2013/7/25 David Fifield <david () bamsoftware com>:
+ gh_lnode_t nodeq;
+ gh_lnode_t nodeq2; /* used for pcap events */
Can you elaborate on how nodeq and nodeq2 work? From what I understand,
nodeq2 is used for pcap-related events and nodeq is used for other kinds
of events. Why do these need to be separate? I wonder if there is a more
orthogonal way to do it. first_ev_next taking a nodeq2 parameter to
choose which list to work on is a little strange.
That's it nodeq is for everything but pcap and nodeq2 is for pcap
only. The thing is that nsock has this strange "BSD hack mode" where
pcap events are added to both "read" and "pcap_read" event lists. This
requires a second gh_lnode_t handle. Having it always (not only in
BSD_HACK_MODE) used for "pcap_read" events makes the code lighter.
The current gh_list implementation hides it a bit, but It's been there
for a while. I'm not fond of it either I have to say, but I'm planning
to change these linked lists to something else (probably a unique red
black tree, I'm still experimenting and benchmarking at the moment).
Making the BSD hack mode less intrusive will be one of my goals then.
One thing I could do in order to avoid having an extra gh_lnode_t (=
two pointers) per structure when not in BSD_HACK_MODE is to add inline
helpers or play with macros like:
#define nodeq2 nodeq
I don't want you to do any tricks to change the structures. I'm not
worried about struct sizes. Do you think the member name should be
nodeq_bsd_hack or something like that? That would be enough of a clue as
to what it's for.
Please go ahead and merge this patch when you are ready.
Sent through the dev mailing list
Archived at http://seclists.org/nmap-dev/