From: robertc <> Date: Mon, 23 Jun 2003 16:39:52 +0000 (+0000) Subject: Summary: Callback event loop was busted. X-Git-Tag: SQUID_3_0_PRE1~93 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=010ffcf0050ef5b8fe7e81f0dd5d79c1fad90567;p=thirdparty%2Fsquid.git Summary: Callback event loop was busted. Keywords: The comms callback event loop was not dereferencing the dlink_node correctly, leading to comparing the sequence number to a pointer. Once again, typecasts leads to bugs :[. * Increment sequence number on each loop. * Compare to the event's record sequence number. * Add a virtual destructor to CommCallbackData to remove some (spurious) warnings that apply to the synthetic constructor under -some- gcc's. --- diff --git a/src/comm.cc b/src/comm.cc index cdc34ddcef..1b8fb61bdb 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.375 2003/05/18 00:03:55 robertc Exp $ + * $Id: comm.cc,v 1.376 2003/06/23 10:39:52 robertc Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -205,6 +205,8 @@ public: void operator delete(void *); virtual void deleteSelf() const; CommCallbackData(CommCommonCallback const &); + virtual ~CommCallbackData() {} + virtual comm_callback_t getType() const { return COMM_CB_DERIVED; } void callACallback(); @@ -559,11 +561,11 @@ comm_calliocallback(void) { CommCallbackData *cio; dlink_node *node; - int oldseqnum = CommCallbackSeqnum; + int oldseqnum = CommCallbackSeqnum++; /* Call our callbacks until we hit NULL or the seqnum changes */ - while (CommCallbackList.head != NULL && oldseqnum != ((CommCallbackData *)CommCallbackList.head)->result.seqnum) { + while (CommCallbackList.head != NULL && oldseqnum != ((CommCallbackData *)CommCallbackList.head->data)->result.seqnum) { node = (dlink_node *)CommCallbackList.head; cio = (CommCallbackData *)node->data;