[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Processing delay
>
> Hi. ns-users:
>
> I want to apply processing delay to an agent.
>
> Agent works like:
> 1. receive a packet
> 2. make new packets and send them
> 3. do nothing during processing delay
> 4. back to 1. (process next packet)
>
> I used Timer, but it causes a problem that the agent can receive a
> packet and send new packets before timeout.
>
> Does anyone know how to solve this problem?
>
> Thanks in advance.
>
>
> --Yukio HASHIMOTO
>
Hi Yukio
We think that you should take a look how the queue.cc and delay.cc work together. When you receive a packet, check if you are already processing a packet (block flag or something). If not blocked, block object and process packet, if blocked, put packet in queue for later processing.
When packet processed, release the object with a callback function.
This is just what Queue and LinkDelay does; all you have to do is to spawn new packets.
Hope this cleared some of your problems.
-johan & wesa