Skip to content

Commit

Permalink
Merge pull request #20 from 5cript/fix-new-warnings
Browse files Browse the repository at this point in the history
Fixed new warnings.
  • Loading branch information
5cript authored Apr 6, 2024
2 parents 4fe66b2 + f4530de commit bf6387b
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs_source/sphinx/websocket/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
There is no pure websocket server. Instead you have to setup an http server and upgrade your session to a websocket session.
Here is an example:

```{code-block} c++
```c++
---
#include <roar/routing/request_listener.hpp>
#include <roar/websocket/websocket_session.hpp>
Expand Down Expand Up @@ -40,5 +40,5 @@ void RequestListener::ws(Roar::Session& session, Roar::EmptyBodyRequest&& reques
.fail([](Roar::Error const&) {
std::cout << "Could not upgrade to websocket.\n";
});
}
}
```
2 changes: 1 addition & 1 deletion examples/100_continue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int main()
server.installRequestListener<RequestListener>();

// Start server and bind on port "port".
server.start(port);
(void)server.start(port);

std::cout
<< Roar::Curl::Request{}.verbose().source("Small").put("http://localhost:" + std::to_string(port) + "/").code()
Expand Down
2 changes: 1 addition & 1 deletion examples/most_minimal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main()
}};

// Start server and bind on port "port".
server.start(8081);
(void)server.start(8081);

// Prevent exit somehow:
std::cin.get();
Expand Down
2 changes: 1 addition & 1 deletion examples/serve_directory/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main()
}};

// Start server and bind on port "port".
server.start(port);
(void)server.start(port);

// Add a request listener class.
server.installRequestListener<FileServer>();
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_server/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main()
}};

// Start server and bind on port "port".
server.start(port);
(void)server.start(port);

// Add a request listener class.
server.installRequestListener<RequestListener>();
Expand Down
2 changes: 1 addition & 1 deletion examples/websocket/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main()
Roar::Server server{{.executor = executor}};

// Start server and bind on port "port".
server.start(port);
(void)server.start(port);

// Add a request listener class.
server.installRequestListener<RequestListener>();
Expand Down
2 changes: 1 addition & 1 deletion include/roar/directory_server/directory_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace Roar::Detail
else
return {.file = *absolute, .relative = *relative, .status = std::filesystem::file_status{}};
}
return {.file = {}, .status = std::filesystem::file_status{}};
return {};
};

std::pair<std::filesystem::file_type, std::filesystem::path> fileAndStatus;
Expand Down
2 changes: 1 addition & 1 deletion include/roar/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Roar
*/
struct Error
{
std::variant<boost::system::error_code, std::string> error;
std::variant<boost::system::error_code, std::string> error = std::string{};
std::string_view additionalInfo = {};

std::string toString() const;
Expand Down
6 changes: 3 additions & 3 deletions include/roar/routing/request_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ namespace Roar

struct FileAndStatus
{
std::filesystem::path file;
std::filesystem::path relative;
std::filesystem::file_status status;
std::filesystem::path file{};
std::filesystem::path relative{};
std::filesystem::file_status status{};
};
template <typename RequestListenerT>
using ServeHandlerType = ServeDecision (RequestListenerT::*)(
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ git clone --branch gh-pages git@github.com:5cript/roar.git .
cd ..

./scripts/build_docs.sh
rsync -rts ./build/clang_docs/docs/ gh-pages
rsync -rts ./build/clang_debug/docs/ gh-pages

# Do manually:
# cd gh-pages
Expand Down
6 changes: 4 additions & 2 deletions test/util/common_server_setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ namespace Roar::Tests
errors_.push_back(std::move(err));
},
});
server_->start();
auto result = server_->start();
if (!result)
throw std::runtime_error{"Failed to start server"};
}

std::pair<std::filesystem::path, std::filesystem::path> generateCertAndKey() const
Expand Down Expand Up @@ -86,7 +88,7 @@ namespace Roar::Tests
errors_.push_back(std::move(err));
},
});
secureServer_->start();
(void)secureServer_->start();
}

std::shared_ptr<Client>
Expand Down

0 comments on commit bf6387b

Please sign in to comment.