the common communication between nodes is fine, but when i want to test the perimeter mode it has throw the error "Wrong the other node", it seems that it couldn't find its next hop node.
i trace the code as show below
Code:
int GPSRNeighbors::intersect(nsaddr_t theother, double sx, double sy, double dx, double dy){ //line 1 (x1,y1)--(x2,y2) is the segment //line 2 (x3,y3)--(x4,y4) is the xD struct gpsr_neighbor *other = getnb(theother); if(other==NULL){ printf("Wrong the other node\n"); exit(1); } **************** struct gpsr_neighbor* GPSRNeighbors::getnb(nsaddr_t nid){ struct gpsr_neighbor *temp = head_; while(temp){ if(temp->id_ == nid){ if((GPSR_CURRENT - temp->ts_) < DEFAULT_GPSR_TIMEOUT) return temp; else { delnb(temp); //if this entry expire, delete it and return NULL return NULL; } return temp; } temp = temp->next_; } return NULL; }
the simulation scene was shown in the attachment.
when i make node 0 send packet to node 1, the error will occur.
would somebody know how to solve it?
thank you for your time!