Various comments and fixes

This commit is contained in:
Alex Hultman
2018-09-23 18:00:18 +02:00
parent ede5fb304a
commit 7f3753e9db
4 changed files with 111 additions and 57 deletions
+8 -4
View File
@@ -47,8 +47,6 @@ int main(int argc, char **argv) {
for (auto *x : delayedResponses) {
std::cout << "Resuming a response now!" << std::endl;
// resume should take a string_view!
x->resume();
}
@@ -76,10 +74,16 @@ int main(int argc, char **argv) {
/* This route streams back chunks of data in delayed fashion */
res->writeStatus(uWS::HTTP_200_OK)->write([res](int offset) {
/* Handle aborted stream out */
if (offset == -1) {
std::cout << "Removing closed stream!" << std::endl;
delayedResponses.erase(res);
return uWS::HTTP_STREAM_FIN;
}
/* Delay stream out */
std::cout << "Delaying stream now" << std::endl;
delayedResponses.insert(res);
//asyncFetchData(res)
return uWS::HTTP_STREAM_PAUSE;
}, 100);