MCPcopy Create free account
hub / github.com/Segs/Segs / httpDownloadFinished

Method httpDownloadFinished

Utilities/slav/ServerConnection.cpp:44–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void ServerConnection::httpDownloadFinished(QNetworkReply *reply)
45{
46 auto op_iter = m_operations_in_flight.find(reply);
47 assert(op_iter != m_operations_in_flight.end());
48 if(reply->error()) {
49 emit networkFailure(tr("Download failure: %1").arg(reply->errorString()));
50 m_operations_in_flight.erase(reply);
51 reply->deleteLater();
52 return;
53 }
54 const QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
55 OperationData op_data(op_iter->second);
56 m_operations_in_flight.erase(reply);
57
58 if(!redirectionTarget.isNull()) {
59 qCritical() << "Redirections are not handled yet";
60 }
61 op_data.target->write(reply->readAll());
62 op_data.target->close();
63 switch (op_data.targetType) {
64 case 0: // a manifest file
65 {
66 QBuffer *buf(qobject_cast<QBuffer *>(op_data.target));
67 emit retrievedManifest(op_data.requested_url,buf->data());
68 delete buf;
69 op_data.target = nullptr;
70 break;
71 }
72 default:
73 assert(false);
74 }
75 reply->deleteLater();
76}
77
78void ServerConnection::onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)
79{

Callers

nothing calls this directly

Calls 7

findMethod · 0.45
endMethod · 0.45
errorMethod · 0.45
errorStringMethod · 0.45
eraseMethod · 0.45
closeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected