diff --git a/server/streamtiming.cpp b/server/streamtiming.cpp index 2cd8825..03407f4 100644 --- a/server/streamtiming.cpp +++ b/server/streamtiming.cpp @@ -21,12 +21,9 @@ along with this program. If not, see #include "timestamp.h" -StreamTiming::StreamTiming(int portCount) +StreamTiming::StreamTiming() : QObject(nullptr) // FIXME: parent { - for (int i = 0; i < portCount; i++) - timing_.append(new QHash); - timer_ = new QTimer(this); connect(timer_, &QTimer::timeout, this, &StreamTiming::processRecords); timer_->setInterval(3000); @@ -152,7 +149,7 @@ StreamTiming* StreamTiming::instance() static StreamTiming *instance{nullptr}; if (!instance) - instance = new StreamTiming(10); // FIXME: WRONG param + instance = new StreamTiming(); return instance; } diff --git a/server/streamtiming.h b/server/streamtiming.h index 332b656..27d8e18 100644 --- a/server/streamtiming.h +++ b/server/streamtiming.h @@ -30,7 +30,7 @@ class StreamTiming : public QObject { Q_OBJECT public: - StreamTiming(int portCount); + StreamTiming(); bool recordTxTime(uint portId, uint guid, uint ttagId, struct timespec timestamp); @@ -73,7 +73,7 @@ private: typedef quint32 Key; QHash txHash_; QHash rxHash_; - QList*> timing_; // list index => portId + QHash*> timing_; // outer key => portId QMutex txHashLock_; QMutex rxHashLock_; QMutex timingLock_; // FIXME: change to RW lock?