hi all
I want for using 2 queue in each node,
every packet store in queue1 and some of them that is frametype_==1 stores
in to queue2
but when i run the simulation i have a problem:
segmentation fault <core dumped>
I think I can not store the same packet in to queue
thanks for your attention



void DtRrQueue::enque(Packet* p)
{
  hdr_ip* ih = hdr_ip::access(p);
  hdr_cmn* ch = hdr_cmn::access(p);
  Packet *p1=p;
  q1_->enque(p);

  if (q1_->length()  > (qlim_-10)) {
      q1_->remove(p);
     drop(p);
   }

 if (ch->frametype_==1) {
     q2_->enque(p1);


    if ((q1_->length() + q2_->length()) > qlim_) {
 q2_->remove(p1);
drop(p1);}

  }

  }



Packet* DtRrQueue::deque()
{
  Packet *p;


if (deq_turn_ == 1)
{
    p =  q1_->deque();
    if (p == 0) {
      p = q2_->deque();
      deq_turn_ = 1;
    }
    else {
      deq_turn_ = 2;
    }
  }
else {
    p =  q2_->deque();
    if (p == 0) {
      p = q1_->deque();
      deq_turn_ = 2;
    }
    else {
      deq_turn_ = 1;
    }
  }

  return (p);
}

Reply via email to