Fix -Wunused-parameter
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "App.h"
|
||||
|
||||
struct us_listen_socket_t *listen_socket;
|
||||
struct us_listen_socket_t *global_listen_socket;
|
||||
|
||||
int main() {
|
||||
/* ws->getUserData returns one of these */
|
||||
@@ -25,28 +25,28 @@ int main() {
|
||||
/* Exit gracefully if we get a closedown message (ASAN debug) */
|
||||
if (message == "closedown") {
|
||||
/* Bye bye */
|
||||
us_listen_socket_close(0, listen_socket);
|
||||
us_listen_socket_close(0, global_listen_socket);
|
||||
ws->close();
|
||||
}
|
||||
|
||||
/* Simply broadcast every single message we get */
|
||||
ws->publish("broadcast", message, opCode, true);
|
||||
},
|
||||
.drain = [](auto *ws) {
|
||||
.drain = [](auto */*ws*/) {
|
||||
/* Check getBufferedAmount here */
|
||||
},
|
||||
.ping = [](auto *ws) {
|
||||
.ping = [](auto */*ws*/) {
|
||||
|
||||
},
|
||||
.pong = [](auto *ws) {
|
||||
.pong = [](auto */*ws*/) {
|
||||
|
||||
},
|
||||
.close = [](auto *ws, int code, std::string_view message) {
|
||||
.close = [](auto */*ws*/, int /*code*/, std::string_view /*message*/) {
|
||||
/* We automatically unsubscribe from any topic here */
|
||||
}
|
||||
}).listen(9001, [](auto *token) {
|
||||
listen_socket = token;
|
||||
if (token) {
|
||||
}).listen(9001, [](auto *listen_socket) {
|
||||
global_listen_socket = listen_socket;
|
||||
if (listen_socket) {
|
||||
std::cout << "Listening on port " << 9001 << std::endl;
|
||||
}
|
||||
}).run();
|
||||
|
||||
@@ -25,26 +25,26 @@ int main() {
|
||||
.maxBackpressure = 1 * 1024 * 1024,
|
||||
/* Handlers */
|
||||
.upgrade = nullptr,
|
||||
.open = [](auto *ws) {
|
||||
.open = [](auto */*ws*/) {
|
||||
/* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
|
||||
},
|
||||
.message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
|
||||
ws->send(message, opCode, true);
|
||||
},
|
||||
.drain = [](auto *ws) {
|
||||
.drain = [](auto */*ws*/) {
|
||||
/* Check ws->getBufferedAmount() here */
|
||||
},
|
||||
.ping = [](auto *ws) {
|
||||
.ping = [](auto */*ws*/) {
|
||||
/* Not implemented yet */
|
||||
},
|
||||
.pong = [](auto *ws) {
|
||||
.pong = [](auto */*ws*/) {
|
||||
/* Not implemented yet */
|
||||
},
|
||||
.close = [](auto *ws, int code, std::string_view message) {
|
||||
.close = [](auto */*ws*/, int /*code*/, std::string_view /*message*/) {
|
||||
/* You may access ws->getUserData() here */
|
||||
}
|
||||
}).listen(9001, [](auto *token) {
|
||||
if (token) {
|
||||
}).listen(9001, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Listening on port " << 9001 << std::endl;
|
||||
}
|
||||
}).run();
|
||||
|
||||
@@ -11,7 +11,7 @@ int main() {
|
||||
/* Simple echo websocket server, using multiple threads */
|
||||
std::vector<std::thread *> threads(std::thread::hardware_concurrency());
|
||||
|
||||
std::transform(threads.begin(), threads.end(), threads.begin(), [](std::thread *t) {
|
||||
std::transform(threads.begin(), threads.end(), threads.begin(), [](std::thread */*t*/) {
|
||||
return new std::thread([]() {
|
||||
|
||||
/* Very simple WebSocket echo server */
|
||||
@@ -23,26 +23,26 @@ int main() {
|
||||
.maxBackpressure = 1 * 1024 * 1024,
|
||||
/* Handlers */
|
||||
.upgrade = nullptr,
|
||||
.open = [](auto *ws) {
|
||||
.open = [](auto */*ws*/) {
|
||||
|
||||
},
|
||||
.message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
|
||||
ws->send(message, opCode);
|
||||
},
|
||||
.drain = [](auto *ws) {
|
||||
.drain = [](auto */*ws*/) {
|
||||
/* Check getBufferedAmount here */
|
||||
},
|
||||
.ping = [](auto *ws) {
|
||||
.ping = [](auto */*ws*/) {
|
||||
|
||||
},
|
||||
.pong = [](auto *ws) {
|
||||
.pong = [](auto */*ws*/) {
|
||||
|
||||
},
|
||||
.close = [](auto *ws, int code, std::string_view message) {
|
||||
.close = [](auto */*ws*/, int /*code*/, std::string_view /*message*/) {
|
||||
|
||||
}
|
||||
}).listen(9001, [](auto *token) {
|
||||
if (token) {
|
||||
}).listen(9001, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Thread " << std::this_thread::get_id() << " listening on port " << 9001 << std::endl;
|
||||
} else {
|
||||
std::cout << "Thread " << std::this_thread::get_id() << " failed to listen on port 9001" << std::endl;
|
||||
|
||||
@@ -8,11 +8,11 @@ int main() {
|
||||
.key_file_name = "../misc/key.pem",
|
||||
.cert_file_name = "../misc/cert.pem",
|
||||
.passphrase = "1234"
|
||||
}).get("/*", [](auto *res, auto *req) {
|
||||
}).get("/*", [](auto *res, auto */*req*/) {
|
||||
res->end("Hello world!");
|
||||
}).listen(3000, [](auto *token) {
|
||||
if (token) {
|
||||
std::cout << "Listening on port " << 3000 << std::endl;
|
||||
}).listen(3000, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Listening on port " << 3000 << std::endl;
|
||||
}
|
||||
}).run();
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ int main() {
|
||||
/* Overly simple hello world app, using multiple threads */
|
||||
std::vector<std::thread *> threads(std::thread::hardware_concurrency());
|
||||
|
||||
std::transform(threads.begin(), threads.end(), threads.begin(), [](std::thread *t) {
|
||||
std::transform(threads.begin(), threads.end(), threads.begin(), [](std::thread */*t*/) {
|
||||
return new std::thread([]() {
|
||||
|
||||
uWS::App().get("/*", [](auto *res, auto *req) {
|
||||
uWS::App().get("/*", [](auto *res, auto * /*req*/) {
|
||||
res->end("Hello world!");
|
||||
}).listen(3000, [](auto *token) {
|
||||
if (token) {
|
||||
}).listen(3000, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Thread " << std::this_thread::get_id() << " listening on port " << 3000 << std::endl;
|
||||
} else {
|
||||
std::cout << "Thread " << std::this_thread::get_id() << " failed to listen on port 3000" << std::endl;
|
||||
|
||||
@@ -21,9 +21,9 @@ int main() {
|
||||
.passphrase = "1234"
|
||||
});
|
||||
|
||||
}).get("/*", [](auto *res, auto *req) {
|
||||
}).get("/*", [](auto *res, auto */*req*/) {
|
||||
res->end("Hello world!");
|
||||
}).get("/exit", [](auto *res, auto *req) {
|
||||
}).get("/exit", [](auto *res, auto */*req*/) {
|
||||
res->end("Shutting down!");
|
||||
/* We use this to check graceful closedown */
|
||||
us_listen_socket_close(1, globalListenSocket);
|
||||
|
||||
@@ -103,21 +103,21 @@ int main() {
|
||||
/* We simply echo whatever data we get */
|
||||
ws->send(message, opCode);
|
||||
},
|
||||
.drain = [](auto *ws) {
|
||||
.drain = [](auto */*ws*/) {
|
||||
/* Check ws->getBufferedAmount() here */
|
||||
},
|
||||
.ping = [](auto *ws) {
|
||||
.ping = [](auto */*ws*/) {
|
||||
/* You don't need to handle this one, we automatically respond to pings as per standard */
|
||||
},
|
||||
.pong = [](auto *ws) {
|
||||
.pong = [](auto */*ws*/) {
|
||||
/* You don't need to handle this one either */
|
||||
},
|
||||
.close = [](auto *ws, int code, std::string_view message) {
|
||||
.close = [](auto */*ws*/, int /*code*/, std::string_view /*message*/) {
|
||||
/* You may access ws->getUserData() here, but sending or
|
||||
* doing any kind of I/O with the socket is not valid. */
|
||||
}
|
||||
}).listen(9001, [](auto *token) {
|
||||
if (token) {
|
||||
}).listen(9001, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Listening on port " << 9001 << std::endl;
|
||||
}
|
||||
}).run();
|
||||
|
||||
@@ -56,21 +56,21 @@ int main() {
|
||||
/* We simply echo whatever data we get */
|
||||
ws->send(message, opCode);
|
||||
},
|
||||
.drain = [](auto *ws) {
|
||||
.drain = [](auto */*ws*/) {
|
||||
/* Check ws->getBufferedAmount() here */
|
||||
},
|
||||
.ping = [](auto *ws) {
|
||||
.ping = [](auto */*ws*/) {
|
||||
/* You don't need to handle this one, we automatically respond to pings as per standard */
|
||||
},
|
||||
.pong = [](auto *ws) {
|
||||
.pong = [](auto */*ws*/) {
|
||||
/* You don't need to handle this one either */
|
||||
},
|
||||
.close = [](auto *ws, int code, std::string_view message) {
|
||||
.close = [](auto */*ws*/, int /*code*/, std::string_view /*message*/) {
|
||||
/* You may access ws->getUserData() here, but sending or
|
||||
* doing any kind of I/O with the socket is not valid. */
|
||||
}
|
||||
}).listen(9001, [](auto *token) {
|
||||
if (token) {
|
||||
}).listen(9001, [](auto *listen_socket) {
|
||||
if (listen_socket) {
|
||||
std::cout << "Listening on port " << 9001 << std::endl;
|
||||
}
|
||||
}).run();
|
||||
|
||||
Reference in New Issue
Block a user