On Thu, Jul 31, 2008 at 7:01 AM, Oliver Frietsch
<[EMAIL PROTECTED]> wrote:
> Hello list,
>
> I'm currently working on a special-purpose derivate of CTP and therefore
> read all the source code to get an overview. One point that is totally
> unclear to me is in CtpForwardingEngineP (most recent CVS release).
> It says (line 439):
>
>       // Once we are here, we have decided to send the packet.
>       if (call SentCache.lookup(qe->msg)) {
>         call CollectionDebug.logEvent(NET_C_FE_DUPLICATE_CACHE_AT_SEND);
>         call SendQueue.dequeue();
>        if (call MessagePool.put(qe->msg) != SUCCESS)
>          call CollectionDebug.logEvent(NET_C_FE_PUT_MSGPOOL_ERR);
>        if (call QEntryPool.put(qe) != SUCCESS)
>          call CollectionDebug.logEvent(NET_C_FE_PUT_QEPOOL_ERR);
>         post sendTask();
>         return;
>       }
>
> OK, so it should *stop sending* and drop the next packet, in the case
> that this packet (i.e. something very similar...) has already been sent
> before. That's what I think...
>
> Unfortunately, my opinion collides with the comment "Once we are here,
> we have decided to send the packet."

The comment is misleading. As you note, there are more tests done
after the comment before deciding to send the packet.


> and the implementation of the cache
> itself.
>
> As stated in LruCtpMsgCacheP, the result of lookup is: "if key [packet]
> is in cache returns the index (offset by first), otherwise returns count
> [of enqueued packets]".
> So... The packet is dropped *everytime*, except that is is the first one
> in the sent cache or the cache is empty? What does this position imply
> for the packet, except that it is the oldest one that I can remember?
>
> I'm very sure that I missed something important, as this implementation
> looks senseless to me ATM. Please help me!

Cache.lookup returns TRUE if a packet with the same signature is in
the cache. This TRUE/FALSE return by Cache.lookup is different from
what the internal lookup function in LruCtpMsgCacheP.nc returns. The
internal lookup function in LruCtpMsgCacheP.nc returns the position of
a packet in the cache if a similar packet is found, otherwise the size
of the cache. CTP does not use the internal lookup function
LruCtpMsgCacheP.nc.

- om_p
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to