[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in queue.h ?



As I run through the code of the PacketQueue class I found the following
bug in line 76:

inline Packet* tail() { return tail_ ? *tail_ : 0; }

This method should return a pointer to the packet on the tail of the
queue.
But it returns the next_ pointer from the latest packet in the queue
wich is
always 0. I think we have to go through the whole queue to access the
tail
packet:
 
inline Packet* tail() { for (Packet* p = head_; p != 0; p = p->next_) {
				if ( !p->next)
					return(p);
			}
			return (0);
		}

Roman

-- 
--------------------------------------------------------
Roman Pletka                [email protected]
c/o Sanitas P2/213                         Bruggeregg 19
CH-8802 Kilchberg                        CH-9100 Herisau
Office: ++41 (0)1 724 89 76    Tf.: ++41-(0)71 352 28 62
Home:   ++41 (0)1 716 72 32    Fax: ++41-(0)71 352 48 62
* *  Also on WWW: http://studwww.eurecom.fr/~pletka  * *
--------------------------------------------------------