diff --git a/examples/HttpServer.cpp b/examples/HttpServer.cpp index c956fe4..6c72bdf 100644 --- a/examples/HttpServer.cpp +++ b/examples/HttpServer.cpp @@ -28,7 +28,7 @@ int main(int argc, char **argv) { }; int port = 3000; - struct us_new_socket_context_options_t ssl_options = {}; + struct us_socket_context_options_t ssl_options = {}; while ((option = optparse_long(&options, longopts, nullptr)) != -1) { switch (option) { @@ -63,7 +63,7 @@ int main(int argc, char **argv) { AsyncFileStreamer asyncFileStreamer(root); /* Either serve over HTTP or HTTPS */ - struct us_new_socket_context_options_t empty_ssl_options = {}; + struct us_socket_context_options_t empty_ssl_options = {}; if (memcmp(&ssl_options, &empty_ssl_options, sizeof(empty_ssl_options))) { /* HTTPS */ uWS::SSLApp(ssl_options).get("/*", [&asyncFileStreamer](auto *res, auto *req) { diff --git a/examples/helpers/AsyncFileReader.h b/examples/helpers/AsyncFileReader.h index 001127e..c086c1e 100644 --- a/examples/helpers/AsyncFileReader.h +++ b/examples/helpers/AsyncFileReader.h @@ -45,7 +45,7 @@ public: // get loop for thread - loop = uWS::Loop::defaultLoop(); + loop = uWS::Loop::get(); } /* Returns any data already cached for this offset */ diff --git a/examples/helpers/AsyncFileStreamer.h b/examples/helpers/AsyncFileStreamer.h index 1064b63..3e76e5a 100644 --- a/examples/helpers/AsyncFileStreamer.h +++ b/examples/helpers/AsyncFileStreamer.h @@ -1,4 +1,4 @@ -#include +#include struct AsyncFileStreamer { @@ -12,7 +12,7 @@ struct AsyncFileStreamer { void updateRootCache() { // todo: if the root folder changes, we want to reload the cache - for(auto &p : std::experimental::filesystem::recursive_directory_iterator(root)) { + for(auto &p : std::filesystem::recursive_directory_iterator(root)) { std::string url = p.path().string().substr(root.length()); if (url == "/index.html") { url = "/"; @@ -38,7 +38,7 @@ struct AsyncFileStreamer { static void streamFile(uWS::HttpResponse *res, AsyncFileReader *asyncFileReader) { /* Peek from cache */ std::string_view chunk = asyncFileReader->peek(res->getWriteOffset()); - if (!chunk.length() || res->tryEnd(chunk, asyncFileReader->getFileSize())) { + if (!chunk.length() || res->tryEnd(chunk, asyncFileReader->getFileSize()).first) { /* Request new chunk */ // todo: we need to abort this callback if peer closed! // this also means Loop::defer needs to support aborting (functions should embedd an atomic boolean abort or something)