diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h index 5c1158df134..b53708a685a 100644 --- a/proxy/ControlMatcher.h +++ b/proxy/ControlMatcher.h @@ -127,17 +127,6 @@ struct RequestData { virtual sockaddr const *get_client_ip() = 0; - enum RD_Type { - RD_NULL, - RD_HTTP, - RD_CONGEST_ENTRY, - }; - - virtual RD_Type - data_type(void) - { - return RD_NULL; - } }; class HttpRequestData : public RequestData diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc index 28bb2ebac7e..f952881561a 100644 --- a/proxy/congest/Congestion.cc +++ b/proxy/congest/Congestion.cc @@ -256,16 +256,20 @@ CongestionControlRecord::UpdateMatch(CongestionControlRule *pRule, RequestData * */ if (pRule->record == 0 || pRule->record->rank < rank || (pRule->record->line_num > line_num && pRule->record->rank == rank)) { if (rank > 0) { - if (rdata->data_type() == RequestData::RD_CONGEST_ENTRY) { + CongestionEntry* entry = dynamic_cast(rdata); + if (entry) { // Enforce the same port and prefix - if (port != 0 && port != ((CongestionEntry *)rdata)->pRecord->port) + if (port != 0 && port != entry->pRecord->port) return; - if (prefix != NULL && ((CongestionEntry *)rdata)->pRecord->prefix == NULL) + if (prefix != NULL && entry->pRecord->prefix == NULL) return; - if (prefix != NULL && strncmp(prefix, ((CongestionEntry *)rdata)->pRecord->prefix, prefix_len)) + if (prefix != NULL && strncmp(prefix, entry->pRecord->prefix, prefix_len)) return; - } else if (!this->CheckModifiers((HttpRequestData *)rdata)) { - return; + } else { + HttpRequestData* h = dynamic_cast(rdata); + if (h && !this->CheckModifiers(h)) { + return; + } } } pRule->record = this; diff --git a/proxy/congest/Congestion.h b/proxy/congest/Congestion.h index e792837290f..85786fcac3c 100644 --- a/proxy/congest/Congestion.h +++ b/proxy/congest/Congestion.h @@ -225,11 +225,6 @@ struct CongestionEntry : public RequestData { { return NULL; } - virtual RD_Type - data_type(void) - { - return RD_CONGEST_ENTRY; - } /* print the entry into the congested list output buffer */ int sprint(char *buf, int buflen, int format = 0);