MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / initCache

Method initCache

launcher/net/MetaCacheSink.cpp:55–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55Task::State MetaCacheSink::initCache(QNetworkRequest& request)
56{
57 if (!m_entry->isStale())
58 {
59 return Task::State::Succeeded;
60 }
61
62 // check if file exists, if it does, use its information for the request
63 QFile current(m_filename);
64 if(current.exists() && current.size() != 0)
65 {
66 if (m_entry->getRemoteChangedTimestamp().size())
67 {
68 request.setRawHeader(QString("If-Modified-Since").toLatin1(), m_entry->getRemoteChangedTimestamp().toLatin1());
69 }
70 if (m_entry->getETag().size())
71 {
72 request.setRawHeader(QString("If-None-Match").toLatin1(), m_entry->getETag().toLatin1());
73 }
74 }
75
76 return Task::State::Running;
77}
78
79Task::State MetaCacheSink::finalizeCache(QNetworkReply & reply)
80{

Callers

nothing calls this directly

Calls 6

QStringClass · 0.85
isStaleMethod · 0.80
existsMethod · 0.80
getETagMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected