diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 17:32:26 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-21 17:32:26 +0200 |
commit | bdf23a3d23042e558183932585d49c9513393a06 (patch) | |
tree | fea9a721c42a6bf2a6f0e65fad20c168332fa39b /Applications/ChanViewer/ThreadCatalogModel.cpp | |
parent | ff6ce422ddecb7dcb7fd9f67d3ea0cfdec7e74ea (diff) | |
download | serenity-bdf23a3d23042e558183932585d49c9513393a06.zip |
LibCore: Make it possible to cancel pending CNetworkJobs
Subclasses of CNetworkJob handle this by overriding shutdown().
This patch implements it for CHttpJob by simply tearing down the
underlying socket.
We also automatically call shutdown() after the job finishes,
regardless of success or failure. :^)
Diffstat (limited to 'Applications/ChanViewer/ThreadCatalogModel.cpp')
-rw-r--r-- | Applications/ChanViewer/ThreadCatalogModel.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Applications/ChanViewer/ThreadCatalogModel.cpp b/Applications/ChanViewer/ThreadCatalogModel.cpp index 789b5d5f4d..4c18ee767b 100644 --- a/Applications/ChanViewer/ThreadCatalogModel.cpp +++ b/Applications/ChanViewer/ThreadCatalogModel.cpp @@ -29,6 +29,8 @@ void ThreadCatalogModel::update() CHttpRequest request; request.set_url(String::format("http://a.4cdn.org/%s/catalog.json", m_board.characters())); + if (m_pending_job) + m_pending_job->cancel(); m_pending_job = request.schedule(); if (on_load_started) |