From 4d79a1877e8ae7c6a5f1526a9d42523f3c99fb9a Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Mon, 24 Aug 2020 12:28:30 +0200 Subject: [PATCH] Stress a bit more of uSockets when fuzzing --- fuzzing/EpollHelloWorld.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fuzzing/EpollHelloWorld.cpp b/fuzzing/EpollHelloWorld.cpp index a33269a..e4c2b93 100644 --- a/fuzzing/EpollHelloWorld.cpp +++ b/fuzzing/EpollHelloWorld.cpp @@ -33,6 +33,7 @@ void test() { /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */ ws->getNativeHandle(); ws->getRemoteAddressAsText(); + us_poll_ext((struct us_poll_t *) ws); }, .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) { ws->send(message, opCode, true); @@ -41,7 +42,10 @@ void test() { /* Check ws->getBufferedAmount() here */ }, .ping = [](auto *ws) { - /* Not implemented yet */ + /* We use this to trigger the async/wakeup feature */ + uWS::Loop::get()->defer([]() { + /* Do nothing */ + }); }, .pong = [](auto *ws) { /* Not implemented yet */ @@ -55,6 +59,8 @@ void test() { /* Here we want to stress the connect feature, since nothing else stresses it */ struct us_loop_t *loop = (struct us_loop_t *) uWS::Loop::get(); + /* This function is stupid */ + us_loop_iteration_number(loop); struct us_socket_context_t *client_context = us_create_socket_context(0, loop, 0, {}); client = us_socket_context_connect(0, client_context, "hostname", 5000, "localhost", 0, 0);