Almost working async file streamer

This commit is contained in:
Alex Hultman
2018-09-29 21:35:28 +02:00
parent 5a1de2039c
commit b514da14ca
5 changed files with 83 additions and 82 deletions
+5 -2
View File
@@ -39,6 +39,9 @@ private:
}
public:
using Super::close;
/* Write the HTTP status */
HttpResponse *writeStatus(std::string_view status) {
HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
@@ -167,13 +170,13 @@ public:
int written = Super::write(data.data(), data.length(), true);
httpResponseData->offset += written;
std::cout << "Offset is now: " << httpResponseData->offset << std::endl;
//std::cout << "Offset is now: " << httpResponseData->offset << std::endl;
return written == data.length();
}
// this path is completely wrong!
std::cout << "tryEnd returning " << (httpResponseData->offset == /*totalSize*/ data.length()) << std::endl;
//std::cout << "tryEnd returning " << (httpResponseData->offset == /*totalSize*/ data.length()) << std::endl;
return httpResponseData->offset == /*totalSize*/ data.length();
}