#ifndef INCLUDEILEDOWNLOADER_H #define INCLUDEILEDOWNLOADER_H #include #include #include #include #include #include #include class Downloader : public QObject { Q_OBJECT public: struct Status { bool running = false; double percent = 0.0; quint64 total_bytes = 0; quint64 downloaded_bytes = 0; quint64 current_speed = 0; quint64 average_speed = 0; quint64 elapsed_time = 0; }; friend Status operator+(const Status& a, const Status &b) { Status result; result.running = a.running || b.running; result.total_bytes = a.total_bytes + b.total_bytes; result.downloaded_bytes = a.downloaded_bytes + b.downloaded_bytes; result.percent = double(result.downloaded_bytes) * 100.0 / double(result.total_bytes); result.average_speed = a.average_speed + b.average_speed; result.current_speed = a.current_speed + b.current_speed; // Counting elapsed time quint64 delta_size = result.total_bytes - result.downloaded_bytes; quint64 avg_speed = qMax(quint64(1), result.average_speed); while (delta_size > 1024 && avg_speed > 1024) { // Making precision smaller to get smoother dynamics delta_size /= 1024; avg_speed /= 1024; } result.elapsed_time = delta_size / avg_speed; return result; } explicit Downloader(QObject *parent = 0); private: Q_DISABLE_COPY(Downloader) public: virtual ~Downloader(); QUrl getUrl() const; void setUrl(const QUrl& _url); void waitForDownloaded() const; bool isStarted() const; double getPercent() const; quint64 getBytesTotal() const; quint64 getBytesDownloaded() const; quint64 getElapsedTime() const; quint64 getCurrentSpeed() const; quint64 getAverageSpeed() const; Status getDownloadStatus() const; static QString getSizeFormatted(quint64 bytes); static QString getSpeedFormatted(quint64 speed_bytes_per_sec); static QString getElapsedTimeFormatted(quint64 elapsed_time_secs); signals: void downloadFinished(Downloader* this_downloader_ptr); void progressChanged(Downloader* this_downloader_ptr, Status status); public slots: void start(); void updateDownloadSpeedLimit(int bytes_per_sec); void stop(); private slots: void onDownloadProgressChanged(qint64 bytesReceived, qint64 bytesTotal); void onDownloadFinished(QNetworkReply* pReply); void onReadyRead(); public: QFile* targetFile {nullptr}; QByteArray* targetBytearray {nullptr}; private: QTime last_tick_time_; quint64 download_speed_ = 0; // bytes per second quint64 average_speed_ = 0; quint64 update_ticks_counter_ = 0; quint64 bytes_total_ = 0; quint64 bytes_downloaded_ = 0; quint64 bytes_downloaded_before_tick_ = 0; // Нужны для подсчёта текущей скорости скачивания, а не bool busy_; QUrl url_; QNetworkReply* m_CurrentReply {nullptr}; QNetworkAccessManager m_WebCtrl; unsigned download_speed_limit {0}; }; Q_DECLARE_METATYPE(Downloader::Status) #endif // INCLUDEILEDOWNLOADER_H PANIC: session(release): write data/sessions/2/e/2e131c05d56d6e4f: no space left on device

PANIC

session(release): write data/sessions/2/e/2e131c05d56d6e4f: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)