I have deduced that the error is due to rescheduling the same event by ns2
which is the copies of the packet to be sent overall interfaces. So, I must
make the copied packets to appear as different events to ns2. For this
purpose I have changed the uid_ of the copied packets to be different from
each other as follows:

/*----------------------------------
int uuu = p->uid_; 
if(nIfaces) {
  for(int i = 0; i < nIfaces; i++){
  Packet *p_copy = p->copy();
  p_copy->uid_ = uuu--; //to avoid getting uid > 0
  Scheduler::instance().schedule(targetlist[i], p_copy, 0.);
  } 
  Packet::free(p);
  }
------------------------------------*/

and it works 100%. Is my observation correct? I will appreciate any usefull
comments.

Thanx,

Ghada


Ghada Al-Mashaqbeh wrote:
> 
> 
> Dear all,
>    
>   I am working with ns-2 2.31, I have added the multi-interface capability
> according to Multi-interface support howto, by Ramon Aguero
>    
>   I have modified the routing agent (I have worked with AODV) to support
> broadcasting packets on all interfaces as follows:
>    
>   if(nIfaces) {
>   for(int i = 0; i < nIfaces; i++){
>   Packet *p_copy = p->copy();
>   Scheduler::instance().schedule(targetlist[i], p_copy, 0.);
>   } 
>   Packet::free(p);
>   }
>    
>   when I run my simulation scenario ( which is a static grid topology of
> 20 wireless nodes)
>   I got the error of: 
>   "Scheduler: Event uid is not valid" at time 67 sec of the simulation
> time.
>    
>   I have searched the mailing list and the available sources about this
> error, I have fixed all MAC bugs (most of them are already fixed in the ns
> distribution), then I have found a FAQ in which the following is stated:
>   "2. You are dealing with packets. A packet is also a kind of event to be
> scheduled and a UID is associated with it. When you create a copy or alloc
> again before freeing it, due to the same packet with a positive UID, it
> cannot be scheduled again. "
> 
>   So, I gussed that the error is in copying the packet to be sent on all
> interfaces (in the modifed code presented above). So, I have modifed that
> code as follows to free the copies of the packet:
>    
>    
>   if(nIfaces) {
>   for(int i = 0; i < nIfaces; i++){
>   Packet *p_copy = p->copy();
>   Scheduler::instance().schedule(targetlist[i], p_copy, 0.);
>   Packet::free(p_copy);
>   } 
>   Packet::free(p);
>   }
>    
>   but when I run my simulation scenario I got:
>   " segmentation fault 'core dumped'"
>    
>   I am sure that the error is in the routing agent module, since I have
> run simulation scenarios without the modified AODV and it worked, but I
> cannot congifure where the bug is.
>    
>   Is there anybody have worked in multi-interface support for AODV? have
> you faced such problem in your testing?
>    
>   any useful comments and hints will be highly apreciated.
>    
>   Thanx,
>    
>   Ghada
> 
>        
> ---------------------------------
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail,
> news, photos & more. 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Scheduler%3A-Event-uid-is-not-valid-tf4516045.html#a12894830
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to