Commit 49d83242 authored by Georgios Katsikas's avatar Georgios Katsikas Committed by Tom Barbette

TimestampDiff element properly initialized

This patch moves some code from the configure() function of
TimestampDiff to the initialize() function. This prevents
undesired access to queuedevice elements' (e.g., FromDPDKDevice)
internal memory, before such elements are initialized
Signed-off-by: Georgios Katsikas's avatarGeorgios Katsikas <katsikas.gp@gmail.com>
parent 99e55693
......@@ -56,10 +56,6 @@ int TimestampDiff::configure(Vector<String> &conf, ErrorHandler *errh)
.complete() < 0)
return -1;
if (get_passing_threads().weight() > 1 && !_limit) {
return errh->error("TimestampDiff is only thread safe if N is set");
}
if ((_rt = static_cast<RecordTimestamp*>(e->cast("RecordTimestamp"))) == 0)
return errh->error("RECORDER must be a valid RecordTimestamp element");
......@@ -72,6 +68,15 @@ int TimestampDiff::configure(Vector<String> &conf, ErrorHandler *errh)
return 0;
}
int TimestampDiff::initialize(ErrorHandler *errh)
{
if (get_passing_threads().weight() > 1 && !_limit) {
return errh->error("TimestampDiff is only thread safe if N is set");
}
return 0;
}
enum {
TSD_AVG_HANDLER,
TSD_MIN_HANDLER,
......
......@@ -54,6 +54,7 @@ public:
const char *flow_code() const { return "x/x"; }
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
int initialize(ErrorHandler *) CLICK_COLD;
void add_handlers() CLICK_COLD;
static String read_handler(Element *, void *) CLICK_COLD;
......
......@@ -229,9 +229,7 @@ protected:
}
inline int thread_for_queue(int queue) {
if (_queue_to_thread.empty()) {
return 0;
}
assert(!_queue_to_thread.empty());
return _queue_to_thread[queue];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment