hello.
   
  trying to write a packet scheduler that can read information (timestamp of 
head packet) from upstream queues BEFORE pulling to determine which queue to 
pull from.
   
  however, it gives a seg fault eveytime the upstream queue tried to read 
packet information.
   
  --------------------------
  Queue function
  --------------------------
  int
  ModifiedNotifierQueue::priority {
     int head_pkt_time_sec = 0;
     int head_pkt_time_usec = 0;
     int head_pkt_time = 0;
   
     if (_head != _tail) {
         // *SEG FAULT* - works if next 4 lines deleted
         Packet *p = _q[_head];
         struct timeval &timestamp = p->timestamp_anno();
         head_pkt_time = timestamp.tv_sec + 1000000*timestamp.tv_usec;       
         click_chatter("head pkt: %i", head_pkt_time); 
     }
   
     return head_pkt_time;
   
  }
   
  --------------------------
  Scheduler function
  --------------------------
  Packet *
  ModifiedRoundRobinScheduler::pull(int)
  {
       int q_prio;
       int next_q = -1;
   
       for (int j = 0; j < ninputs(); j++) {
          if (signals[j]) {
               Queue* q = (Queue*)input(j).element();
               q_prio = q->priority();
               if (some_condition_with_q_prio) {
                     next_q = j;
               }
          }
       }
   
   
       if (next_q == -1) 
           return 0;
       else
           return input(next_q).pull();
   
   
  }
   
   
  this works just fine when i use test sources like TimedSource or 
InfiniteSource on the same machine. but when i run the same using an external 
source and external sink (different machines), then i get the seg fault.
   
  can someone please shed some light?
   
  thanks in advance.
  venky
   

                
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

Reply via email to