[ns] Regarding Timers in DSR

Jian Li lijian@cs.ucdavis.edu
Fri Apr 5 16:25:01 2002


I think you miss the "start" command. In DSRAgent::command() in
dsragent.cc:

	  // cheap source of jitter
	  send_buf_timer.sched(BUFFER_CHECK
			       + BUFFER_CHECK * Random::uniform(1.0));
//start your timer here
          your_timer.handle((Event*) 0);


Jian

On Fri, 5 Apr 2002, Harshal Haridas wrote:

> Hello,
>
> I am trying to add another Timer in DSR. I have done everything
> mentioned in the Manual.
>
> Added following to dsragent.h
>
> class Neighbor_Timer : public TimerHandler {
> public:
>             Neighbor_Timer(DSRAgent* a) : TimerHandler () { agent = a; }
>             void expire(Event *e);
> private:
>             DSRAgent *agent;
>             Event intr;
> };
>
> also the following two lines in class DSRAgent:
>
>   Neighbor_Timer neighbor_timer;
>   friend class Neighbor_Timer;
>
> Added following to dsragent.cc
>
>
> void
> Neighbor_Timer::expire(Event *)
> {
>             agent->nb_purge ();
>             resched(NEIGHBOR_INTERVAL);
>
> }
>
> and defined the appropriate further routines required.
>
> I also initialized in the constructor:
>
> DSRAgent::DSRAgent(): Agent(PT_DSR),request_table(128), \
> route_cache(NULL), neighbor_timer (this), send_buf_timer(this)
>
> However, I am not able to get the code running in the Neighbor_timer
> routine.
>
> Could anyone help me and inform me how should I get the code working. Is
> there anything that needs to be added to the dsr.tcl file to start the
> timer once and for all. I have added nothing to the dsr.tcl file.
>
> Thanx in advance,
>
>
> Harshal S. Haridas
> Graduate Student,
> Computer Science and Engineering Department,
> Penn State University, University Park
>
>

--