[Click] Elements being cloned
Eddie Kohler
kohler at cs.ucla.edu
Tue Oct 26 02:17:20 EDT 2004
Hi Bart,
Sounds like you're using an old version of Click. New versions of Click don't
use the clone() mechanism. But anyway.
Click used to pre-allocate one copy of each element type *at boot time*. That
copy was hooked up to the Lexer (not any router), none of its code ever ran, and
it lived until Click itself exited. Some people got confused by this before,
because they'd see that their element constructor was called twice, even though
there was only one version of the element in their program. Maybe that's what
you're seeing?
Eddie
Bart Braem wrote:
> List,
>
> I am using some elements that need to keep track of their state (in particular
> their buffer).
> Now I just discovered that my element is being cloned instead of being a
> single one troughout the program, that way maintaining state is clearly
> impossible. Is that a mistake I make or is it inherent to the Click design?
>
> The element AODVWaitingForDiscovery appears in the Clickscript like this:
>
> elementclass RouteDiscovery{
> discovery :: AODVWaitingForDiscovery(rreq)
> -> [0]output;
>
> input[0]
> -> [0]discovery;
> input[1]
> -> [1]discovery;
> }
> ...
>
> routediscovery :: RouteDiscovery;
>
> ...
>
> destinationclassifier[0]
> -> [1]routediscovery;
> ...
>
> lookup[1] // unknown destination, routediscovery
> -> [0]routediscovery;
> routediscovery[0]
> -> [0]arpquerier;
>
> Those are the only occurences of AODVWaitingForDiscovery and RouteDiscovery in
> the whole Clickscript, so I'm definitely not working with two elements.
> But what's the problem then?
>
> Thanks for any help,
> Bart
More information about the click
mailing list