_Z4testv:
   11|  6.94k|void test() {
   12|       |	/* ws->getUserData returns one of these */
   13|  6.94k|    struct PerSocketData {
   14|       |        /* Fill with user data */
   15|  6.94k|    };
   16|       |
   17|  6.94k|    {
   18|       |        /* Keep in mind that uWS::SSLApp({options}) is the same as uWS::App() when compiled without SSL support.
   19|       |        * You may swap to using uWS:App() if you don't need SSL */
   20|  6.94k|        auto app = uWS::App({
   21|       |            /* There are example certificates in uWebSockets.js repo */
   22|  6.94k|            .key_file_name = "../misc/key.pem",
   23|  6.94k|            .cert_file_name = "../misc/cert.pem",
   24|  6.94k|            .passphrase = "1234"
   25|  6.94k|        }).ws<PerSocketData>("/empty", {
   26|       |        /* Having no handlers here should not crash */
   27|  6.94k|        }).get("/*", [](auto *res, auto *req) {
   28|  6.94k|            if (req->getHeader("write").length()) {
   29|  6.94k|                res->writeStatus("200 OK")->writeHeader("write", "true")->write("Hello");
   30|  6.94k|                res->write(" world!");
   31|  6.94k|                res->end();
   32|  6.94k|            } else if (req->getQuery().length()) {
   33|  6.94k|                res->close();
   34|  6.94k|            } else {
   35|  6.94k|                res->end("Hello world!");
   36|  6.94k|            }
   37|  6.94k|        }).post("/*", [](auto *res, auto *req) {
   38|  6.94k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  6.94k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  6.94k|                });
   43|  6.94k|            });
   44|  6.94k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  6.94k|                if (isEnd) {
   46|  6.94k|                    res->cork([res, chunk]() {
   47|  6.94k|                        res->write("something ahead");
   48|  6.94k|                        res->end(chunk);
   49|  6.94k|                    });
   50|  6.94k|                }
   51|  6.94k|            });
   52|  6.94k|        }).any("/:candy/*", [](auto *res, auto *req) {
   53|  6.94k|            if (req->getParameter(0).length() == 0) {
   54|  6.94k|                free((void *) -1);
   55|  6.94k|            }
   56|       |            /* Some invalid queries */
   57|  6.94k|            req->getParameter(30000);
   58|  6.94k|            req->getParameter((unsigned short) -34234);
   59|  6.94k|            req->getHeader("yhello");
   60|  6.94k|            req->getQuery();
   61|  6.94k|            req->getQuery("assd");
   62|       |
   63|  6.94k|            res->end("done");
   64|  6.94k|        }).ws<PerSocketData>("/*", {
   65|       |            /* Settings */
   66|  6.94k|            .compression = uWS::SHARED_COMPRESSOR,
   67|  6.94k|            .maxPayloadLength = 16 * 1024,
   68|  6.94k|            .idleTimeout = 12,
   69|  6.94k|            .maxBackpressure = 1024,
   70|       |            /* Handlers */
   71|  6.94k|            .open = [](auto *ws) {
   72|       |                /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
   73|  6.94k|                ws->getNativeHandle();
   74|  6.94k|                ws->getRemoteAddressAsText();
   75|  6.94k|                us_poll_ext((struct us_poll_t *) ws);
   76|  6.94k|            },
   77|  6.94k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   78|  6.94k|                ws->send(message, opCode, true);
   79|  6.94k|            },
   80|  6.94k|            .drain = [](auto *ws) {
   81|       |                /* Check ws->getBufferedAmount() here */
   82|  6.94k|            },
   83|  6.94k|            .ping = [](auto *ws, std::string_view) {
   84|       |                /* We use this to trigger the async/wakeup feature */
   85|  6.94k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  6.94k|                });
   88|  6.94k|            },
   89|  6.94k|            .pong = [](auto *ws, std::string_view) {
   90|       |                /* Not implemented yet */
   91|  6.94k|            },
   92|  6.94k|            .close = [](auto *ws, int code, std::string_view message) {
   93|       |                /* You may access ws->getUserData() here */
   94|  6.94k|            }
   95|  6.94k|        }).listen(9001, [](auto *listenSocket) {
   96|  6.94k|            listen_socket = listenSocket;
   97|  6.94k|        });
   98|       |
   99|       |        /* Here we want to stress the connect feature, since nothing else stresses it */
  100|  6.94k|        struct us_loop_t *loop = (struct us_loop_t *) uWS::Loop::get();
  101|       |        /* This function is stupid */
  102|  6.94k|        us_loop_iteration_number(loop);
  103|  6.94k|        struct us_socket_context_t *client_context = us_create_socket_context(0, loop, 0, {});
  104|  6.94k|        us_socket_context_timestamp(0, client_context);
  105|  6.94k|        client = us_socket_context_connect(0, client_context, "hostname", 5000, "localhost", 0, 0);
  106|       |	    
  107|  6.94k|        if (client) {
  ------------------
  |  Branch (107:13): [True: 2.03k, False: 4.90k]
  ------------------
  108|  2.03k|            us_socket_is_established(0, client);
  109|  2.03k|            us_socket_local_port(0, client);
  110|  2.03k|        }
  111|       |
  112|  6.94k|        us_socket_context_on_connect_error(0, client_context, [](struct us_socket_t *s, int code) {
  113|  6.94k|            client = nullptr;
  114|  6.94k|            return s;
  115|  6.94k|        });
  116|       |
  117|  6.94k|        us_socket_context_on_open(0, client_context, [](struct us_socket_t *s, int is_client, char *ip, int ip_length) {
  118|  6.94k|            us_socket_flush(0, s);
  119|  6.94k|            return s;
  120|  6.94k|        });
  121|       |
  122|  6.94k|        us_socket_context_on_end(0, client_context, [](struct us_socket_t *s) {
  123|       |            /* Someone sent is a FIN, but we can still send data */
  124|  6.94k|            us_socket_write(0, s, "asdadasdasdasdaddfgdfhdfgdfg", 28, false);
  125|  6.94k|            return s;
  126|  6.94k|        });
  127|       |
  128|  6.94k|        us_socket_context_on_data(0, client_context, [](struct us_socket_t *s, char *data, int length) {
  129|  6.94k|            return s;
  130|  6.94k|        });
  131|       |
  132|  6.94k|        us_socket_context_on_writable(0, client_context, [](struct us_socket_t *s) {
  133|       |            /* Let's defer a close here */
  134|  6.94k|            us_socket_shutdown_read(0, s);
  135|  6.94k|            return s;
  136|  6.94k|        });
  137|       |
  138|  6.94k|        us_socket_context_on_close(0, client_context, [](struct us_socket_t *s, int code, void *reason) {
  139|  6.94k|            client = NULL;
  140|  6.94k|            return s;
  141|  6.94k|        });
  142|       |
  143|       |        /* Trigger some context functions */
  144|  6.94k|        app.addServerName("servername", {});
  145|  6.94k|        app.removeServerName("servername");
  146|  6.94k|        app.missingServerName(nullptr);
  147|  6.94k|        app.getNativeHandle();
  148|       |
  149|  6.94k|        app.run();
  150|       |
  151|       |        /* After done we also free the client context */
  152|  6.94k|        us_socket_context_free(0, client_context);
  153|  6.94k|    }
  154|  6.94k|    uWS::Loop::get()->setSilent(true);
  155|  6.94k|    uWS::Loop::get()->free();
  156|  6.94k|}
_Z8teardownv:
  159|  6.90k|void teardown() {
  160|       |	/* If we are called twice there's a bug (it potentially could if
  161|       |	 * all open sockets cannot be error-closed in one epoll_wait call).
  162|       |	 * But we only allow 1k FDs and we have a buffer of 1024 from epoll_wait */
  163|  6.90k|	if (!listen_socket && !client) {
  ------------------
  |  Branch (163:6): [True: 104, False: 6.80k]
  |  Branch (163:24): [True: 0, False: 104]
  ------------------
  164|      0|		exit(-1);
  165|      0|	}
  166|       |
  167|  6.90k|    if (client) {
  ------------------
  |  Branch (167:9): [True: 133, False: 6.77k]
  ------------------
  168|    133|        us_socket_close(0, client, 0, 0);
  169|    133|        client = NULL;
  170|    133|    }
  171|       |
  172|       |	/* We might have open sockets still, and these will be error-closed by epoll_wait */
  173|       |	// us_socket_context_close - close all open sockets created with this socket context
  174|  6.90k|    if (listen_socket) {
  ------------------
  |  Branch (174:9): [True: 6.80k, False: 104]
  ------------------
  175|  6.80k|        us_listen_socket_close(0, listen_socket);
  176|  6.80k|        listen_socket = NULL;
  177|  6.80k|    }
  178|  6.90k|}
EpollHelloWorld.cpp:_ZZ4testvENK4$_10clEP11us_socket_ti:
  112|  1.76k|        us_socket_context_on_connect_error(0, client_context, [](struct us_socket_t *s, int code) {
  113|  1.76k|            client = nullptr;
  114|  1.76k|            return s;
  115|  1.76k|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_11clEP11us_socket_tiPci:
  117|    225|        us_socket_context_on_open(0, client_context, [](struct us_socket_t *s, int is_client, char *ip, int ip_length) {
  118|    225|            us_socket_flush(0, s);
  119|    225|            return s;
  120|    225|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_12clEP11us_socket_t:
  122|    896|        us_socket_context_on_end(0, client_context, [](struct us_socket_t *s) {
  123|       |            /* Someone sent is a FIN, but we can still send data */
  124|    896|            us_socket_write(0, s, "asdadasdasdasdaddfgdfhdfgdfg", 28, false);
  125|    896|            return s;
  126|    896|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_13clEP11us_socket_tPci:
  128|    295|        us_socket_context_on_data(0, client_context, [](struct us_socket_t *s, char *data, int length) {
  129|    295|            return s;
  130|    295|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_14clEP11us_socket_t:
  132|    844|        us_socket_context_on_writable(0, client_context, [](struct us_socket_t *s) {
  133|       |            /* Let's defer a close here */
  134|    844|            us_socket_shutdown_read(0, s);
  135|    844|            return s;
  136|    844|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_15clEP11us_socket_tiPv:
  138|    269|        us_socket_context_on_close(0, client_context, [](struct us_socket_t *s, int code, void *reason) {
  139|    269|            client = NULL;
  140|    269|            return s;
  141|    269|        });
EpollHelloWorld.cpp:_ZZ4testvENK3$_0clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   27|  11.1k|        }).get("/*", [](auto *res, auto *req) {
   28|  11.1k|            if (req->getHeader("write").length()) {
  ------------------
  |  Branch (28:17): [True: 2.55k, False: 8.63k]
  ------------------
   29|  2.55k|                res->writeStatus("200 OK")->writeHeader("write", "true")->write("Hello");
   30|  2.55k|                res->write(" world!");
   31|  2.55k|                res->end();
   32|  8.63k|            } else if (req->getQuery().length()) {
  ------------------
  |  Branch (32:24): [True: 953, False: 7.68k]
  ------------------
   33|    953|                res->close();
   34|  7.68k|            } else {
   35|  7.68k|                res->end("Hello world!");
   36|  7.68k|            }
   37|  11.1k|        }).post("/*", [](auto *res, auto *req) {
EpollHelloWorld.cpp:_ZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   37|  4.44k|        }).post("/*", [](auto *res, auto *req) {
   38|  4.44k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  4.44k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  4.44k|                });
   43|  4.44k|            });
   44|  4.44k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  4.44k|                if (isEnd) {
   46|  4.44k|                    res->cork([res, chunk]() {
   47|  4.44k|                        res->write("something ahead");
   48|  4.44k|                        res->end(chunk);
   49|  4.44k|                    });
   50|  4.44k|                }
   51|  4.44k|            });
   52|  4.44k|        }).any("/:candy/*", [](auto *res, auto *req) {
EpollHelloWorld.cpp:_ZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEv:
   38|  3.00k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  3.00k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  3.00k|                });
   43|  3.00k|            });
EpollHelloWorld.cpp:_ZZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvENKUlvE_clEv:
   40|  2.78k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  2.78k|                });
EpollHelloWorld.cpp:_ZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNS9_11char_traitsIcEEEEbE_clESD_b:
   44|  33.5k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  33.5k|                if (isEnd) {
  ------------------
  |  Branch (45:21): [True: 1.43k, False: 32.1k]
  ------------------
   46|  1.43k|                    res->cork([res, chunk]() {
   47|  1.43k|                        res->write("something ahead");
   48|  1.43k|                        res->end(chunk);
   49|  1.43k|                    });
   50|  1.43k|                }
   51|  33.5k|            });
EpollHelloWorld.cpp:_ZZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNS9_11char_traitsIcEEEEbE_clESD_bENKUlvE_clEv:
   46|  1.43k|                    res->cork([res, chunk]() {
   47|  1.43k|                        res->write("something ahead");
   48|  1.43k|                        res->end(chunk);
   49|  1.43k|                    });
EpollHelloWorld.cpp:_ZZ4testvENK3$_2clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   52|  2.31k|        }).any("/:candy/*", [](auto *res, auto *req) {
   53|  2.31k|            if (req->getParameter(0).length() == 0) {
  ------------------
  |  Branch (53:17): [True: 0, False: 2.31k]
  ------------------
   54|      0|                free((void *) -1);
   55|      0|            }
   56|       |            /* Some invalid queries */
   57|  2.31k|            req->getParameter(30000);
   58|  2.31k|            req->getParameter((unsigned short) -34234);
   59|  2.31k|            req->getHeader("yhello");
   60|  2.31k|            req->getQuery();
   61|  2.31k|            req->getQuery("assd");
   62|       |
   63|  2.31k|            res->end("done");
   64|  2.31k|        }).ws<PerSocketData>("/*", {
EpollHelloWorld.cpp:_ZZ4testvENK3$_3clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   71|  39.0k|            .open = [](auto *ws) {
   72|       |                /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
   73|  39.0k|                ws->getNativeHandle();
   74|  39.0k|                ws->getRemoteAddressAsText();
   75|  39.0k|                us_poll_ext((struct us_poll_t *) ws);
   76|  39.0k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_4clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS1_6OpCodeE:
   77|  10.4k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   78|  10.4k|                ws->send(message, opCode, true);
   79|  10.4k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_5clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   80|  4.10k|            .drain = [](auto *ws) {
   81|       |                /* Check ws->getBufferedAmount() here */
   82|  4.10k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   83|  6.97k|            .ping = [](auto *ws, std::string_view) {
   84|       |                /* We use this to trigger the async/wakeup feature */
   85|  6.97k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  6.97k|                });
   88|  6.97k|            },
EpollHelloWorld.cpp:_ZZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEENKUlvE_clEv:
   85|  5.08k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  5.08k|                });
EpollHelloWorld.cpp:_ZZ4testvENK3$_7clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   89|  1.22k|            .pong = [](auto *ws, std::string_view) {
   90|       |                /* Not implemented yet */
   91|  1.22k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_8clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_iNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   92|  39.0k|            .close = [](auto *ws, int code, std::string_view message) {
   93|       |                /* You may access ws->getUserData() here */
   94|  39.0k|            }
EpollHelloWorld.cpp:_ZZ4testvENK3$_9clI18us_listen_socket_tEEDaPT_:
   95|  6.94k|        }).listen(9001, [](auto *listenSocket) {
   96|  6.94k|            listen_socket = listenSocket;
   97|  6.94k|        });

set_consumable_data:
   71|  6.94k|void set_consumable_data(const unsigned char *new_data, int new_length) {
   72|  6.94k|	consumable_data = (unsigned char *) new_data;
   73|  6.94k|	consumable_data_length = new_length;
   74|  6.94k|}
consume_byte:
   77|  3.82M|int consume_byte(unsigned char *b) {
   78|  3.82M|	if (consumable_data_length) {
  ------------------
  |  Branch (78:6): [True: 3.82M, False: 5.01k]
  ------------------
   79|  3.82M|		*b = consumable_data[0];
   80|  3.82M|		consumable_data++;
   81|  3.82M|		consumable_data_length--;
   82|  3.82M|		return 0;
   83|  3.82M|	}
   84|  5.01k|	return -1;
   85|  3.82M|}
allocate_fd:
   90|  1.40M|int allocate_fd() {
   91|       |	// this can be massively optimized by having a list of free blocks or the like
   92|   351M|	for (int fd = 0; fd < MAX_FDS; fd++) {
  ------------------
  |  Branch (92:19): [True: 351M, False: 510]
  ------------------
   93|   351M|		if (!fd_to_file[fd]) {
  ------------------
  |  Branch (93:7): [True: 1.40M, False: 349M]
  ------------------
   94|  1.40M|			num_fds++;
   95|  1.40M|			return fd + RESERVED_SYSTEM_FDS;
   96|  1.40M|		}
   97|   351M|	}
   98|    510|	return -1;
   99|  1.40M|}
init_fd:
  102|  1.40M|void init_fd(int fd, int type, struct file *f) {
  103|  1.40M|	if (fd >= RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (103:6): [True: 1.40M, False: 0]
  ------------------
  104|  1.40M|		fd_to_file[fd - RESERVED_SYSTEM_FDS] = f;
  105|  1.40M|		fd_to_file[fd - RESERVED_SYSTEM_FDS]->type = type;
  106|  1.40M|		fd_to_file[fd - RESERVED_SYSTEM_FDS]->next = NULL;
  107|  1.40M|		fd_to_file[fd - RESERVED_SYSTEM_FDS]->prev = NULL;
  108|  1.40M|	}
  109|  1.40M|}
map_fd:
  111|  19.3M|struct file *map_fd(int fd) {
  112|  19.3M|	if (fd >= RESERVED_SYSTEM_FDS && fd < MAX_FDS + RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (112:6): [True: 19.3M, False: 0]
  |  Branch (112:35): [True: 19.3M, False: 0]
  ------------------
  113|  19.3M|		return fd_to_file[fd - RESERVED_SYSTEM_FDS];
  114|  19.3M|	}
  115|      0|	return NULL;
  116|  19.3M|}
free_fd:
  119|  1.40M|int free_fd(int fd) {
  120|  1.40M|	if (fd >= RESERVED_SYSTEM_FDS && fd < MAX_FDS + RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (120:6): [True: 1.40M, False: 0]
  |  Branch (120:35): [True: 1.40M, False: 0]
  ------------------
  121|  1.40M|		if (fd_to_file[fd - RESERVED_SYSTEM_FDS]) {
  ------------------
  |  Branch (121:7): [True: 1.40M, False: 0]
  ------------------
  122|  1.40M|			fd_to_file[fd - RESERVED_SYSTEM_FDS] = 0;
  123|  1.40M|			num_fds--;
  124|  1.40M|			return 0;
  125|  1.40M|		}
  126|  1.40M|	}
  127|       |
  128|      0|	return -1;
  129|  1.40M|}
__wrap_epoll_create1:
  141|  6.94k|int __wrap_epoll_create1(int flags) {
  142|       |
  143|       |	/* Todo: check that we do not allocate more than one epoll FD */
  144|  6.94k|	int fd = allocate_fd();
  145|       |
  146|  6.94k|	if (fd != -1) {
  ------------------
  |  Branch (146:6): [True: 6.94k, False: 0]
  ------------------
  147|  6.94k|		struct epoll_file *ef = (struct epoll_file *)malloc(sizeof(struct epoll_file));
  148|       |
  149|       |		/* Init the epoll_file */
  150|  6.94k|		ef->poll_set_head = NULL;
  151|  6.94k|		ef->poll_set_tail = NULL;
  152|       |
  153|  6.94k|		init_fd(fd, FD_TYPE_EPOLL, (struct file *)ef);
  154|  6.94k|	}
  155|       |
  156|       |#ifdef PRINTF_DEBUG
  157|       |	printf("epoll_create1 returning epfd: %d\n", fd);
  158|       |#endif
  159|       |
  160|  6.94k|	return fd;
  161|  6.94k|}
__wrap_epoll_ctl:
  165|  3.05M|int __wrap_epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) {
  166|       |
  167|  3.05M|	struct epoll_file *ef = (struct epoll_file *)map_fd(epfd);
  168|  3.05M|	if (!ef) {
  ------------------
  |  Branch (168:6): [True: 0, False: 3.05M]
  ------------------
  169|      0|		return -1;
  170|      0|	}
  171|       |
  172|  3.05M|	struct file *f = (struct file *)map_fd(fd);
  173|  3.05M|	if (!f) {
  ------------------
  |  Branch (173:6): [True: 0, False: 3.05M]
  ------------------
  174|      0|		return -1;
  175|      0|	}
  176|       |
  177|       |	/* We add new polls in the head */
  178|  3.05M|	if (op == EPOLL_CTL_ADD) {
  ------------------
  |  Branch (178:6): [True: 1.40M, False: 1.64M]
  ------------------
  179|       |		// if there is a head already
  180|  1.40M|		if (ef->poll_set_head) {
  ------------------
  |  Branch (180:7): [True: 1.39M, False: 6.94k]
  ------------------
  181|  1.39M|			ef->poll_set_head->prev = f;
  182|       |
  183|       |			// then it will be our next
  184|  1.39M|			f->next = ef->poll_set_head;
  185|  1.39M|		} else {
  186|       |			// if there was no head then we became the tail also
  187|  6.94k|			ef->poll_set_tail = f;
  188|  6.94k|		}
  189|       |
  190|       |		// we are now the head in any case
  191|  1.40M|		ef->poll_set_head = f;
  192|       |
  193|  1.40M|		f->epev = *event;
  194|       |
  195|  1.64M|	} else if (op == EPOLL_CTL_MOD) {
  ------------------
  |  Branch (195:13): [True: 247k, False: 1.40M]
  ------------------
  196|       |		/* Modifying is simply changing the file itself */
  197|   247k|		f->epev = *event;
  198|  1.40M|	} else if (op == EPOLL_CTL_DEL) {
  ------------------
  |  Branch (198:13): [True: 1.40M, False: 0]
  ------------------
  199|       |
  200|  1.40M|		if (f->prev) {
  ------------------
  |  Branch (200:7): [True: 670k, False: 731k]
  ------------------
  201|   670k|			f->prev->next = f->next;
  202|   731k|		} else {
  203|   731k|			ef->poll_set_head = f->next;
  204|   731k|		}
  205|       |
  206|  1.40M|		if (f->next) {
  ------------------
  |  Branch (206:7): [True: 1.39M, False: 6.94k]
  ------------------
  207|  1.39M|			f->next->prev = f->prev;
  208|  1.39M|		} else {
  209|       |			// tail ska vara vår.prev
  210|  6.94k|			ef->poll_set_tail = f->prev;
  211|  6.94k|		}
  212|       |
  213|       |		// a file that is not in the list should be reset to NULL
  214|  1.40M|		f->prev = NULL;
  215|  1.40M|		f->next = NULL;
  216|  1.40M|	}
  217|       |
  218|       |	/* You have to poll for errors and hangups */
  219|  3.05M|	f->epev.events |= EPOLLERR | EPOLLHUP;
  220|       |
  221|  3.05M|	return 0;
  222|  3.05M|}
__wrap_epoll_wait:
  226|  3.36M|               int maxevents, int timeout) {
  227|       |	//printf("epoll_wait: %d\n", 0);
  228|       |
  229|       |#ifdef PRINTF_DEBUG
  230|       |	printf("Calling epoll_wait\n");
  231|       |#endif
  232|       |
  233|  3.36M|	struct epoll_file *ef = (struct epoll_file *)map_fd(epfd);
  234|  3.36M|	if (!ef) {
  ------------------
  |  Branch (234:6): [True: 0, False: 3.36M]
  ------------------
  235|      0|		return -1;
  236|      0|	}
  237|       |
  238|  3.36M|	if (consumable_data_length) {
  ------------------
  |  Branch (238:6): [True: 3.35M, False: 6.90k]
  ------------------
  239|       |
  240|  3.35M|		int ready_events = 0;
  241|       |
  242|  19.8M|		for (struct file *f = ef->poll_set_head; f; f = f->next) {
  ------------------
  |  Branch (242:44): [True: 16.5M, False: 3.35M]
  ------------------
  243|       |
  244|       |
  245|       |			/* Consume one fuzz byte, AND it with the event */
  246|  16.5M|			if (!consumable_data_length) {
  ------------------
  |  Branch (246:8): [True: 498, False: 16.5M]
  ------------------
  247|       |				// break if we have no data
  248|    498|				break;
  249|    498|			}
  250|       |
  251|       |			// here we have the main condition that drives everything
  252|  16.5M|			int ready_event = consumable_data[0] & f->epev.events;
  253|       |
  254|       |			// consume the byte
  255|  16.5M|			consumable_data_length--;
  256|  16.5M|			consumable_data++;
  257|       |
  258|  16.5M|			if (ready_event) {
  ------------------
  |  Branch (258:8): [True: 12.0M, False: 4.41M]
  ------------------
  259|  12.0M|				if (ready_events < maxevents) {
  ------------------
  |  Branch (259:9): [True: 12.0M, False: 0]
  ------------------
  260|  12.0M|					events[ready_events] = f->epev;
  261|       |
  262|       |					// todo: the event should be masked by the byte, not everything it wants shold be given all the time!
  263|  12.0M|					events[ready_events++].events = ready_event;
  264|  12.0M|				} else {
  265|       |					// we are full, break
  266|      0|					break;
  267|      0|				}
  268|  12.0M|			}
  269|       |
  270|  16.5M|		}
  271|       |
  272|  3.35M|		return ready_events;
  273|       |
  274|  3.35M|	} else {
  275|       |
  276|       |#ifdef PRINTF_DEBUG
  277|       |		printf("Calling teardown\n");
  278|       |#endif
  279|  6.90k|		teardown();
  280|       |
  281|       |		// after shutting down the listen socket we clear the whole list (the bug in epoll_ctl remove)
  282|       |		// so the below loop doesn't work - we never close anything more than the listen socket!
  283|       |
  284|       |		/* You don't really need to emit teardown, you could simply emit error on every poll */
  285|       |
  286|  6.90k|		int ready_events = 0;
  287|       |
  288|       |#ifdef PRINTF_DEBUG
  289|       |		printf("Emitting error on every remaining FD\n");
  290|       |#endif
  291|  69.7k|		for (struct file *f = ef->poll_set_head; f; f = f->next) {
  ------------------
  |  Branch (291:44): [True: 62.8k, False: 6.90k]
  ------------------
  292|       |
  293|  62.8k|			if (f->type == FD_TYPE_SOCKET) {
  ------------------
  |  Branch (293:8): [True: 42.0k, False: 20.7k]
  ------------------
  294|       |
  295|  42.0k|				if (ready_events < maxevents) {
  ------------------
  |  Branch (295:9): [True: 42.0k, False: 0]
  ------------------
  296|  42.0k|					events[ready_events] = f->epev;
  297|       |
  298|       |					// todo: the event should be masked by the byte, not everything it wants shold be given all the time!
  299|  42.0k|					events[ready_events++].events = EPOLLERR | EPOLLHUP;
  300|  42.0k|				} else {
  301|       |					// we are full, break
  302|      0|					break;
  303|      0|				}
  304|       |
  305|  42.0k|			}
  306|  62.8k|		}
  307|       |
  308|       |#ifdef PRINTF_DEBUG
  309|       |		printf("Ready events: %d\n", ready_events);
  310|       |#endif
  311|       |
  312|  6.90k|		return ready_events;
  313|  6.90k|	}
  314|  3.36M|}
__wrap_read:
  332|  8.42M|int __wrap_read(int fd, void *buf, size_t count) {
  333|       |
  334|  8.42M|	if (fd < RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (334:6): [True: 0, False: 8.42M]
  ------------------
  335|      0|		return __real_read(fd, buf, count);
  336|      0|	}
  337|       |
  338|       |#ifdef PRINTF_DEBUG
  339|       |	printf("Wrapped read\n");
  340|       |#endif
  341|       |
  342|       |	/* Let's try and clear the buffer first */
  343|       |	//memset(buf, 0, count);
  344|       |
  345|  8.42M|	struct file *f = map_fd(fd);
  346|  8.42M|	if (!f) {
  ------------------
  |  Branch (346:6): [True: 0, False: 8.42M]
  ------------------
  347|      0|		return -1;
  348|      0|	}
  349|       |
  350|  8.42M|	errno = 0;
  351|       |
  352|  8.42M|	if (f->type == FD_TYPE_SOCKET) {
  ------------------
  |  Branch (352:6): [True: 295k, False: 8.13M]
  ------------------
  353|       |
  354|   295k|		if (!consumable_data_length) {
  ------------------
  |  Branch (354:7): [True: 2.66k, False: 292k]
  ------------------
  355|  2.66k|			errno = EWOULDBLOCK;
  356|  2.66k|			return -1;
  357|   292k|		} else {
  358|   292k|			int data_available = (unsigned char) consumable_data[0];
  359|   292k|			consumable_data_length--;
  360|   292k|			consumable_data++;
  361|       |
  362|   292k|			if (consumable_data_length < data_available) {
  ------------------
  |  Branch (362:8): [True: 5.53k, False: 287k]
  ------------------
  363|  5.53k|				data_available = consumable_data_length;
  364|  5.53k|			}
  365|       |
  366|   292k|			if (count < data_available) {
  ------------------
  |  Branch (366:8): [True: 0, False: 292k]
  ------------------
  367|      0|				data_available = count;
  368|      0|			}
  369|       |
  370|   292k|			memcpy(buf, consumable_data, data_available);
  371|       |
  372|   292k|			consumable_data_length -= data_available;
  373|   292k|			consumable_data += data_available;
  374|       |
  375|   292k|			return data_available;
  376|   292k|		}
  377|   295k|	}
  378|       |
  379|  8.13M|	if (f->type == FD_TYPE_EVENT) {
  ------------------
  |  Branch (379:6): [True: 2.66M, False: 5.46M]
  ------------------
  380|  2.66M|		memset(buf, 1, 8);
  381|  2.66M|		return 8;
  382|  2.66M|	}
  383|       |
  384|  5.46M|	if (f->type == FD_TYPE_TIMER) {
  ------------------
  |  Branch (384:6): [True: 5.46M, False: 0]
  ------------------
  385|  5.46M|		memset(buf, 1, 8);
  386|  5.46M|		return 8;
  387|  5.46M|	}
  388|       |
  389|      0|	return -1;
  390|  5.46M|}
__wrap_recv:
  393|   295k|int __wrap_recv(int sockfd, void *buf, size_t len, int flags) {
  394|   295k|	return __wrap_read(sockfd, buf, len);
  395|   295k|}
__wrap_send:
  397|   282k|int __wrap_send(int sockfd, const void *buf, size_t len, int flags) {
  398|       |
  399|   282k|	if (consumable_data_length) {
  ------------------
  |  Branch (399:6): [True: 271k, False: 11.2k]
  ------------------
  400|       |		/* We can send len scaled by the 1 byte */
  401|   271k|		unsigned char scale = consumable_data[0];
  402|   271k|		consumable_data++;
  403|   271k|		consumable_data_length--;
  404|       |
  405|   271k|		int written = float(scale) / 255.0f * len;
  406|       |
  407|   271k|		if (written == 0) {
  ------------------
  |  Branch (407:7): [True: 67.4k, False: 203k]
  ------------------
  408|  67.4k|			errno = EWOULDBLOCK;
  409|   203k|		} else {
  410|   203k|			errno = 0;
  411|   203k|		}
  412|       |
  413|   271k|		return written;
  414|   271k|	} else {
  415|  11.2k|		return -1;
  416|  11.2k|	}
  417|   282k|}
__wrap_bind:
  424|  8.84k|int __wrap_bind() {
  425|  8.84k|	return 0;
  426|  8.84k|}
__wrap_setsockopt:
  428|  1.39M|int __wrap_setsockopt() {
  429|  1.39M|	return 0;
  430|  1.39M|}
__wrap_fcntl:
  433|  2.77M|int __wrap_fcntl(int fd, int cmd, ... /* arg */) {
  434|  2.77M|	if (fd < RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (434:6): [True: 9.77k, False: 2.76M]
  ------------------
  435|  9.77k|		va_list args;
  436|  9.77k|		va_start(args, cmd);
  437|  9.77k|		int ret = __real_fcntl(fd, cmd, args);
  438|  9.77k|		va_end(args);
  439|  9.77k|		return ret;
  440|  9.77k|	}
  441|       |
  442|  2.76M|	return 0;
  443|  2.77M|}
__wrap_getaddrinfo:
  448|  15.9k|                       struct addrinfo **res) {
  449|       |	//printf("Wrapped getaddrinfo\n");
  450|       |
  451|  15.9k|	struct addrinfo default_hints = {};
  452|       |
  453|  15.9k|	if (!hints) {
  ------------------
  |  Branch (453:6): [True: 2.03k, False: 13.8k]
  ------------------
  454|  2.03k|		hints = &default_hints;
  455|  2.03k|	}
  456|       |
  457|  15.9k|	unsigned char b;
  458|  15.9k|	if (consume_byte(&b)) {
  ------------------
  |  Branch (458:6): [True: 25, False: 15.8k]
  ------------------
  459|     25|		return -1;
  460|     25|	}
  461|       |
  462|       |	/* This one should be thread_local */
  463|  15.8k|	static /*thread_local*/ struct addrinfo ai;
  464|  15.8k|	ai.ai_flags = hints->ai_flags;
  465|  15.8k|	ai.ai_socktype = hints->ai_socktype;
  466|  15.8k|	ai.ai_protocol = hints->ai_protocol;
  467|       |
  468|  15.8k|	if (b > 127) {
  ------------------
  |  Branch (468:6): [True: 2.05k, False: 13.8k]
  ------------------
  469|  2.05k|		ai.ai_family = AF_INET;//hints->ai_family;
  470|  13.8k|	} else {
  471|  13.8k|		ai.ai_family = AF_INET6;//hints->ai_family;
  472|  13.8k|	}
  473|       |
  474|       |	/* This one is for generating the wrong family (maybe invalid?) */
  475|  15.8k|	if (b == 0) {
  ------------------
  |  Branch (475:6): [True: 5.10k, False: 10.7k]
  ------------------
  476|  5.10k|		ai.ai_family = hints->ai_family;
  477|  5.10k|	}
  478|       |
  479|  15.8k|	ai.ai_next = NULL;
  480|  15.8k|	ai.ai_canonname = NULL; // fel
  481|       |
  482|       |	// these should depend on inet6 or inet */
  483|  15.8k|	ai.ai_addrlen = 4; // fel
  484|  15.8k|	ai.ai_addr = NULL; // ska peka på en sockaddr!
  485|       |
  486|       |	// we need to return an addrinfo with family AF_INET6
  487|       |
  488|  15.8k|	*res = &ai;
  489|  15.8k|	return 0;
  490|  15.9k|}
__wrap_freeaddrinfo:
  492|  15.8k|int __wrap_freeaddrinfo() {
  493|  15.8k|	return 0;
  494|  15.8k|}
__wrap_getpeername:
  497|  39.0k|int __wrap_getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
  498|       |
  499|  39.0k|	struct file *f = map_fd(sockfd);
  500|  39.0k|	if (!f) {
  ------------------
  |  Branch (500:6): [True: 0, False: 39.0k]
  ------------------
  501|      0|		return -1;
  502|      0|	}
  503|       |
  504|       |	// todo: this could fail with -1 also (consume a byte)?
  505|       |
  506|  39.0k|	if (f->type == FD_TYPE_SOCKET) {
  ------------------
  |  Branch (506:6): [True: 39.0k, False: 0]
  ------------------
  507|       |
  508|  39.0k|		struct socket_file *sf = (struct socket_file *) f;
  509|       |
  510|  39.0k|		if (addr) {
  ------------------
  |  Branch (510:7): [True: 39.0k, False: 0]
  ------------------
  511|  39.0k|			memcpy(addr, &sf->addr, sf->len);
  512|  39.0k|			*addrlen = sf->len;
  513|  39.0k|		}
  514|       |
  515|  39.0k|		return 0;
  516|  39.0k|	}
  517|       |
  518|      0|	return -1;
  519|  39.0k|}
__wrap_accept4:
  521|  3.80M|int __wrap_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
  522|       |	/* We must end with -1 since we are called in a loop */
  523|       |
  524|  3.80M|	unsigned char b;
  525|  3.80M|	if (consume_byte(&b)) {
  ------------------
  |  Branch (525:6): [True: 4.98k, False: 3.80M]
  ------------------
  526|  4.98k|		return -1;
  527|  4.98k|	}
  528|       |
  529|       |	/* This rule might change, anything below 10 is accepted */
  530|  3.80M|	if (b < 10) {
  ------------------
  |  Branch (530:6): [True: 1.37M, False: 2.42M]
  ------------------
  531|       |
  532|  1.37M|		int fd = allocate_fd();
  533|  1.37M|		if (fd != -1) {
  ------------------
  |  Branch (533:7): [True: 1.37M, False: 510]
  ------------------
  534|       |
  535|       |			/* Allocate the file */
  536|  1.37M|			struct socket_file *sf = (struct socket_file *) malloc(sizeof(struct socket_file));
  537|       |
  538|       |			/* Init the file */
  539|       |
  540|       |			/* Here we need to create a socket FD and return */
  541|  1.37M|			init_fd(fd, FD_TYPE_SOCKET, (struct file *)sf);
  542|       |
  543|       |			/* We need to provide an addr */
  544|       |
  545|       |			/* Begin by setting it to an empty in6 address */
  546|  1.37M|			memset(&sf->addr, 0, sizeof(struct sockaddr_in6));
  547|  1.37M|			sf->len = sizeof(struct sockaddr_in6);
  548|  1.37M|			sf->addr.in6.sin6_family = AF_INET6;
  549|       |
  550|       |			/* Opt-in to ipv4 */
  551|  1.37M|			if (b < 5) {
  ------------------
  |  Branch (551:8): [True: 588k, False: 784k]
  ------------------
  552|   588k|				memset(&sf->addr, 0, sizeof(struct sockaddr_in6));
  553|   588k|				sf->len = sizeof(struct sockaddr_in);
  554|   588k|				sf->addr.in.sin_family = AF_INET;
  555|   588k|			}
  556|       |
  557|  1.37M|			if (addr) {
  ------------------
  |  Branch (557:8): [True: 1.37M, False: 0]
  ------------------
  558|       |				/* Copy from socket to addr */
  559|  1.37M|				memcpy(addr, &sf->addr, sf->len);
  560|  1.37M|			}
  561|  1.37M|		}
  562|       |
  563|  1.37M|		return fd;
  564|  1.37M|	}
  565|       |
  566|  2.42M|	return -1;
  567|  3.80M|}
__wrap_listen:
  569|  6.81k|int __wrap_listen() {
  570|       |	/* Listen consumes one byte and fails on -1 */
  571|  6.81k|	unsigned char b;
  572|  6.81k|	if (consume_byte(&b)) {
  ------------------
  |  Branch (572:6): [True: 10, False: 6.80k]
  ------------------
  573|     10|		return -1;
  574|     10|	}
  575|       |
  576|  6.80k|	if (b) {
  ------------------
  |  Branch (576:6): [True: 6.80k, False: 2]
  ------------------
  577|  6.80k|		return 0;
  578|  6.80k|	}
  579|       |
  580|      2|	return -1;
  581|  6.80k|}
__wrap_socket:
  584|  13.7k|int __wrap_socket(int domain, int type, int protocol) {
  585|       |
  586|       |	/* Only accept valid families */
  587|  13.7k|	if (domain != AF_INET && domain != AF_INET6) {
  ------------------
  |  Branch (587:6): [True: 12.1k, False: 1.61k]
  |  Branch (587:27): [True: 4.88k, False: 7.23k]
  ------------------
  588|  4.88k|		return -1;
  589|  4.88k|	}
  590|       |
  591|  8.84k|	int fd = allocate_fd();
  592|       |
  593|  8.84k|	if (fd != -1) {
  ------------------
  |  Branch (593:6): [True: 8.84k, False: 0]
  ------------------
  594|  8.84k|		struct socket_file *sf = (struct socket_file *)malloc(sizeof(struct socket_file));
  595|       |
  596|       |		/* Init the file */
  597|       |
  598|  8.84k|		init_fd(fd, FD_TYPE_SOCKET, (struct file *)sf);
  599|  8.84k|	}
  600|       |
  601|       |#ifdef PRINTF_DEBUG
  602|       |	printf("socket returning fd: %d\n", fd);
  603|       |#endif
  604|       |
  605|  8.84k|	return fd;
  606|  13.7k|}
__wrap_shutdown:
  608|  91.9k|int __wrap_shutdown() {
  609|       |	//printf("Wrapped shutdown\n");
  610|  91.9k|	return 0;
  611|  91.9k|}
__wrap_timerfd_create:
  619|  13.8k|int __wrap_timerfd_create(int clockid, int flags) {
  620|       |
  621|  13.8k|	int fd = allocate_fd();
  622|       |
  623|  13.8k|	if (fd != -1) {
  ------------------
  |  Branch (623:6): [True: 13.8k, False: 0]
  ------------------
  624|  13.8k|		struct timer_file *tf = (struct timer_file *)malloc(sizeof(struct timer_file));
  625|       |
  626|       |		/* Init the file */
  627|       |
  628|       |
  629|  13.8k|		init_fd(fd, FD_TYPE_TIMER, (struct file *)tf);
  630|       |
  631|  13.8k|	}
  632|       |
  633|       |#ifdef PRINTF_DEBUG
  634|       |	printf("timerfd_create returning fd: %d\n", fd);
  635|       |#endif
  636|       |
  637|  13.8k|	return fd;
  638|  13.8k|}
__wrap_timerfd_settime:
  642|  13.8k|                    struct itimerspec *old_value) {
  643|       |	//printf("timerfd_settime: %d\n", fd);
  644|  13.8k|	return 0;
  645|  13.8k|}
__wrap_eventfd:
  653|  6.94k|int __wrap_eventfd() {
  654|       |
  655|  6.94k|	int fd = allocate_fd();
  656|       |
  657|  6.94k|	if (fd != -1) {
  ------------------
  |  Branch (657:6): [True: 6.94k, False: 0]
  ------------------
  658|  6.94k|		struct event_file *ef = (struct event_file *)malloc(sizeof(struct event_file));
  659|       |
  660|       |		/* Init the file */
  661|       |
  662|  6.94k|		init_fd(fd, FD_TYPE_EVENT, (struct file *)ef);
  663|       |
  664|       |		//printf("eventfd: %d\n", fd);
  665|  6.94k|	}
  666|       |
  667|       |#ifdef PRINTF_DEBUG
  668|       |	printf("eventfd returning fd: %d\n", fd);
  669|       |#endif
  670|       |
  671|  6.94k|	return fd;
  672|  6.94k|}
__wrap_close:
  678|  1.40M|int __wrap_close(int fd) {
  679|       |
  680|  1.40M|	if (fd < RESERVED_SYSTEM_FDS) {
  ------------------
  |  Branch (680:6): [True: 0, False: 1.40M]
  ------------------
  681|      0|		return __real_close(fd);
  682|      0|	}
  683|       |
  684|  1.40M|	struct file *f = map_fd(fd);
  685|       |
  686|  1.40M|	if (!f) {
  ------------------
  |  Branch (686:6): [True: 0, False: 1.40M]
  ------------------
  687|      0|		return -1;
  688|      0|	}
  689|       |
  690|  1.40M|	if (f->type == FD_TYPE_EPOLL) {
  ------------------
  |  Branch (690:6): [True: 6.94k, False: 1.40M]
  ------------------
  691|       |#ifdef PRINTF_DEBUG
  692|       |		printf("Closing epoll FD: %d\n", fd);
  693|       |#endif
  694|       |
  695|  6.94k|		free(f);
  696|       |
  697|  6.94k|		return free_fd(fd);
  698|       |
  699|  1.40M|	} else if (f->type == FD_TYPE_TIMER) {
  ------------------
  |  Branch (699:13): [True: 13.8k, False: 1.38M]
  ------------------
  700|       |#ifdef PRINTF_DEBUG
  701|       |		printf("Closing timer fd: %d\n", fd);
  702|       |#endif
  703|       |
  704|  13.8k|		free(f);
  705|       |
  706|  13.8k|		return free_fd(fd);
  707|  1.38M|	} else if (f->type == FD_TYPE_EVENT) {
  ------------------
  |  Branch (707:13): [True: 6.94k, False: 1.38M]
  ------------------
  708|       |#ifdef PRINTF_DEBUG
  709|       |		printf("Closing event fd: %d\n", fd);
  710|       |#endif
  711|       |
  712|  6.94k|		free(f);
  713|       |
  714|  6.94k|		return free_fd(fd);
  715|  1.38M|	} else if (f->type == FD_TYPE_SOCKET) {
  ------------------
  |  Branch (715:13): [True: 1.38M, False: 0]
  ------------------
  716|       |#ifdef PRINTF_DEBUG
  717|       |		printf("Closing socket fd: %d\n", fd);
  718|       |#endif
  719|       |
  720|       |		// we should call epoll_ctl remove here
  721|       |
  722|  1.38M|		free(f);
  723|       |
  724|  1.38M|		int ret = free_fd(fd);
  725|       |
  726|       |#ifdef PRINTF_DEBUG
  727|       |		printf("Ret: %d\n", ret);
  728|       |#endif
  729|       |
  730|       |		//free(-1);
  731|  1.38M|		return ret;
  732|  1.38M|	}
  733|       |
  734|      0|	return -1;
  735|  1.40M|}
LLVMFuzzerTestOneInput:
  737|  6.94k|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  738|  6.94k|	set_consumable_data(data, size);
  739|       |
  740|  6.94k|	test();
  741|       |
  742|  6.94k|	if (num_fds) {
  ------------------
  |  Branch (742:6): [True: 0, False: 6.94k]
  ------------------
  743|      0|		printf("ERROR! Cannot leave open FDs after test!\n");
  744|      0|	}
  745|       |
  746|  6.94k|	return 0;
  747|  6.94k|}

_ZN3uWS12TemplatedAppILb0EEC2ENS_20SocketContextOptionsE:
  232|  6.94k|    TemplatedApp(SocketContextOptions options = {}) {
  233|  6.94k|        httpContext = HttpContext<SSL>::create(Loop::get(), options);
  234|       |
  235|       |        /* Register default handler for 404 (can be overridden by user) */
  236|  6.94k|        this->any("/*", [](auto *res, auto */*req*/) {
  237|  6.94k|            res->writeStatus("404 File Not Found");
  238|  6.94k|            res->end("<html><body><h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i></body></html>");
  239|  6.94k|        });
  240|  6.94k|    }
_ZNK3uWS20SocketContextOptionscv27us_socket_context_options_tEv:
   73|  6.94k|        operator struct us_socket_context_options_t() const {
   74|  6.94k|            struct us_socket_context_options_t socket_context_options;
   75|  6.94k|            memcpy(&socket_context_options, this, sizeof(SocketContextOptions));
   76|  6.94k|            return socket_context_options;
   77|  6.94k|        }
_ZZN3uWS12TemplatedAppILb0EEC1ENS_20SocketContextOptionsEENKUlPT_PT0_E_clINS_12HttpResponseILb0EEENS_11HttpRequestEEEDaS4_S6_:
  236|  8.80k|        this->any("/*", [](auto *res, auto */*req*/) {
  237|  8.80k|            res->writeStatus("404 File Not Found");
  238|  8.80k|            res->end("<html><body><h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i></body></html>");
  239|  8.80k|        });
_ZN3uWS12TemplatedAppILb0EED2Ev:
  192|  13.8k|    ~TemplatedApp() {
  193|       |        /* Let's just put everything here */
  194|  13.8k|        if (httpContext) {
  ------------------
  |  Branch (194:13): [True: 6.94k, False: 6.94k]
  ------------------
  195|  6.94k|            httpContext->free();
  196|       |
  197|       |            /* Free all our webSocketContexts in a type less way */
  198|  13.8k|            for (auto &webSocketContextDeleter : webSocketContextDeleters) {
  ------------------
  |  Branch (198:48): [True: 13.8k, False: 6.94k]
  ------------------
  199|  13.8k|                webSocketContextDeleter();
  200|  13.8k|            }
  201|  6.94k|        }
  202|       |
  203|       |        /* Delete TopicTree */
  204|  13.8k|        if (topicTree) {
  ------------------
  |  Branch (204:13): [True: 6.94k, False: 6.94k]
  ------------------
  205|       |            /* And unregister loop callbacks */
  206|       |            /* We must unregister any loop post handler here */
  207|  6.94k|            Loop::get()->removePostHandler(topicTree);
  208|  6.94k|            Loop::get()->removePreHandler(topicTree);
  209|       |
  210|  6.94k|        delete topicTree;
  211|  6.94k|        }
  212|  13.8k|    }
EpollHelloWorld.cpp:_ZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EE:
  285|  13.8k|    TemplatedApp &&ws(std::string pattern, WebSocketBehavior<UserData> &&behavior) {
  286|       |        /* Don't compile if alignment rules cannot be satisfied */
  287|  13.8k|        static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
  288|  13.8k|        "µWebSockets cannot satisfy UserData alignment requirements. You need to recompile µSockets with LIBUS_EXT_ALIGNMENT adjusted accordingly.");
  289|       |
  290|  13.8k|        if (!httpContext) {
  ------------------
  |  Branch (290:13): [True: 0, False: 13.8k]
  ------------------
  291|      0|            return std::move(static_cast<TemplatedApp &&>(*this));
  292|      0|        }
  293|       |
  294|       |        /* Terminate on misleading idleTimeout values */
  295|  13.8k|        if (behavior.idleTimeout && behavior.idleTimeout < 8) {
  ------------------
  |  Branch (295:13): [True: 13.8k, False: 0]
  |  Branch (295:37): [True: 0, False: 13.8k]
  ------------------
  296|      0|            std::cerr << "Error: idleTimeout must be either 0 or greater than 8!" << std::endl;
  297|      0|            std::terminate();
  298|      0|        }
  299|       |
  300|       |        /* Maximum idleTimeout is 16 minutes */
  301|  13.8k|        if (behavior.idleTimeout > 240 * 4) {
  ------------------
  |  Branch (301:13): [True: 0, False: 13.8k]
  ------------------
  302|      0|            std::cerr << "Error: idleTimeout must not be greater than 960 seconds!" << std::endl;
  303|      0|            std::terminate();
  304|      0|        }
  305|       |
  306|       |        /* Maximum maxLifetime is 4 hours */
  307|  13.8k|        if (behavior.maxLifetime > 240) {
  ------------------
  |  Branch (307:13): [True: 0, False: 13.8k]
  ------------------
  308|      0|            std::cerr << "Error: maxLifetime must not be greater than 240 minutes!" << std::endl;
  309|      0|            std::terminate();
  310|      0|        }
  311|       |
  312|       |        /* If we don't have a TopicTree yet, create one now */
  313|  13.8k|        if (!topicTree) {
  ------------------
  |  Branch (313:13): [True: 6.94k, False: 6.94k]
  ------------------
  314|       |
  315|  6.94k|            bool needsUncork = false;
  316|  6.94k|            topicTree = new TopicTree<TopicTreeMessage, TopicTreeBigMessage>([needsUncork](Subscriber *s, TopicTreeMessage &message, TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags flags) mutable {
  317|       |                /* Subscriber's user is the socket */
  318|       |                /* Unfortunately we need to cast is to PerSocketData = int
  319|       |                 * since many different WebSocketContexts use the same
  320|       |                 * TopicTree now */
  321|  6.94k|                auto *ws = (WebSocket<SSL, true, int> *) s->user;
  322|       |
  323|       |                /* If this is the first message we try and cork */
  324|  6.94k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::FIRST) {
  325|  6.94k|                    if (ws->canCork() && !ws->isCorked()) {
  326|  6.94k|                        ((AsyncSocket<SSL> *)ws)->cork();
  327|  6.94k|                        needsUncork = true;
  328|  6.94k|                    }
  329|  6.94k|                }
  330|       |
  331|       |                /* If we ever overstep maxBackpresure, exit immediately */
  332|  6.94k|                if (WebSocket<SSL, true, int>::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) {
  333|  6.94k|                    if (needsUncork) {
  334|  6.94k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  335|  6.94k|                        needsUncork = false;
  336|  6.94k|                    }
  337|       |                    /* Stop draining */
  338|  6.94k|                    return true;
  339|  6.94k|                }
  340|       |
  341|       |                /* If this is the last message we uncork if we are corked */
  342|  6.94k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::LAST) {
  343|       |                    /* We should not uncork in all cases? */
  344|  6.94k|                    if (needsUncork) {
  345|  6.94k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  346|  6.94k|                    }
  347|  6.94k|                }
  348|       |
  349|       |                /* Success */
  350|  6.94k|                return false;
  351|  6.94k|            });
  352|       |
  353|       |            /* And hook it up with the loop */
  354|       |            /* We empty for both pre and post just to make sure */
  355|  6.94k|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  356|       |                /* Commit pub/sub batches every loop iteration */
  357|  6.94k|                topicTree->drain();
  358|  6.94k|            });
  359|       |
  360|  6.94k|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  361|       |                /* Commit pub/sub batches every loop iteration */
  362|  6.94k|                topicTree->drain();
  363|  6.94k|            });
  364|  6.94k|        }
  365|       |
  366|       |        /* Every route has its own websocket context with its own behavior and user data type */
  367|  13.8k|        auto *webSocketContext = WebSocketContext<SSL, true, UserData>::create(Loop::get(), (us_socket_context_t *) httpContext, topicTree);
  368|       |
  369|       |        /* We need to clear this later on */
  370|  13.8k|        webSocketContextDeleters.push_back([webSocketContext]() {
  371|  13.8k|            webSocketContext->free();
  372|  13.8k|        });
  373|       |
  374|       |        /* We also keep this list for easy closing */
  375|  13.8k|        webSocketContexts.push_back((void *)webSocketContext);
  376|       |
  377|       |        /* Quick fix to disable any compression if set */
  378|       |#ifdef UWS_NO_ZLIB
  379|       |        behavior.compression = DISABLED;
  380|       |#endif
  381|       |
  382|       |        /* If we are the first one to use compression, initialize it */
  383|  13.8k|        if (behavior.compression) {
  ------------------
  |  Branch (383:13): [True: 6.94k, False: 6.94k]
  ------------------
  384|  6.94k|            LoopData *loopData = (LoopData *) us_loop_ext(us_socket_context_loop(SSL, webSocketContext->getSocketContext()));
  385|       |
  386|       |            /* Initialize loop's deflate inflate streams */
  387|  6.94k|            if (!loopData->zlibContext) {
  ------------------
  |  Branch (387:17): [True: 6.94k, False: 0]
  ------------------
  388|  6.94k|                loopData->zlibContext = new ZlibContext;
  389|  6.94k|                loopData->inflationStream = new InflationStream(CompressOptions::DEDICATED_DECOMPRESSOR);
  390|  6.94k|                loopData->deflationStream = new DeflationStream(CompressOptions::DEDICATED_COMPRESSOR);
  391|  6.94k|            }
  392|  6.94k|        }
  393|       |
  394|       |        /* Copy all handlers */
  395|  13.8k|        webSocketContext->getExt()->openHandler = std::move(behavior.open);
  396|  13.8k|        webSocketContext->getExt()->messageHandler = std::move(behavior.message);
  397|  13.8k|        webSocketContext->getExt()->droppedHandler = std::move(behavior.dropped);
  398|  13.8k|        webSocketContext->getExt()->drainHandler = std::move(behavior.drain);
  399|  13.8k|        webSocketContext->getExt()->subscriptionHandler = std::move(behavior.subscription);
  400|  13.8k|        webSocketContext->getExt()->closeHandler = std::move(behavior.close);
  401|  13.8k|        webSocketContext->getExt()->pingHandler = std::move(behavior.ping);
  402|  13.8k|        webSocketContext->getExt()->pongHandler = std::move(behavior.pong);
  403|       |
  404|       |        /* Copy settings */
  405|  13.8k|        webSocketContext->getExt()->maxPayloadLength = behavior.maxPayloadLength;
  406|  13.8k|        webSocketContext->getExt()->maxBackpressure = behavior.maxBackpressure;
  407|  13.8k|        webSocketContext->getExt()->closeOnBackpressureLimit = behavior.closeOnBackpressureLimit;
  408|  13.8k|        webSocketContext->getExt()->resetIdleTimeoutOnSend = behavior.resetIdleTimeoutOnSend;
  409|  13.8k|        webSocketContext->getExt()->sendPingsAutomatically = behavior.sendPingsAutomatically;
  410|  13.8k|        webSocketContext->getExt()->maxLifetime = behavior.maxLifetime;
  411|  13.8k|        webSocketContext->getExt()->compression = behavior.compression;
  412|       |
  413|       |        /* Calculate idleTimeoutCompnents */
  414|  13.8k|        webSocketContext->getExt()->calculateIdleTimeoutCompnents(behavior.idleTimeout);
  415|       |
  416|  13.8k|        httpContext->onHttp("GET", pattern, [webSocketContext, behavior = std::move(behavior)](auto *res, auto *req) mutable {
  417|       |
  418|       |            /* If we have this header set, it's a websocket */
  419|  13.8k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  420|  13.8k|            if (secWebSocketKey.length() == 24) {
  421|       |
  422|       |                /* Emit upgrade handler */
  423|  13.8k|                if (behavior.upgrade) {
  424|       |
  425|       |                    /* Nasty, ugly Safari 15 hack */
  426|  13.8k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  427|  13.8k|                        std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  428|  13.8k|                        memset((void *) secWebSocketExtensions.data(), ' ', secWebSocketExtensions.length());
  429|  13.8k|                    }
  430|       |
  431|  13.8k|                    behavior.upgrade(res, req, (struct us_socket_context_t *) webSocketContext);
  432|  13.8k|                } else {
  433|       |                    /* Default handler upgrades to WebSocket */
  434|  13.8k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  435|  13.8k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  436|       |
  437|       |                    /* Safari 15 hack */
  438|  13.8k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  439|  13.8k|                        secWebSocketExtensions = "";
  440|  13.8k|                    }
  441|       |
  442|  13.8k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  443|  13.8k|                }
  444|       |
  445|       |                /* We are going to get uncorked by the Http get return */
  446|       |
  447|       |                /* We do not need to check for any close or shutdown here as we immediately return from get handler */
  448|       |
  449|  13.8k|            } else {
  450|       |                /* Tell the router that we did not handle this request */
  451|  13.8k|                req->setYield(true);
  452|  13.8k|            }
  453|  13.8k|        }, true);
  454|  13.8k|        return std::move(static_cast<TemplatedApp &&>(*this));
  455|  13.8k|    }
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE_clESH_:
  355|  3.36M|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  356|       |                /* Commit pub/sub batches every loop iteration */
  357|  3.36M|                topicTree->drain();
  358|  3.36M|            });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE0_clESH_:
  360|  3.36M|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  361|       |                /* Commit pub/sub batches every loop iteration */
  362|  3.36M|                topicTree->drain();
  363|  3.36M|            });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlvE_clEv:
  370|  13.8k|        webSocketContextDeleters.push_back([webSocketContext]() {
  371|  13.8k|            webSocketContext->free();
  372|  13.8k|        });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPSD_PT0_E_clINS_12HttpResponseILb0EEENS_11HttpRequestEEEDaSG_SI_:
  416|  52.6k|        httpContext->onHttp("GET", pattern, [webSocketContext, behavior = std::move(behavior)](auto *res, auto *req) mutable {
  417|       |
  418|       |            /* If we have this header set, it's a websocket */
  419|  52.6k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  420|  52.6k|            if (secWebSocketKey.length() == 24) {
  ------------------
  |  Branch (420:17): [True: 40.4k, False: 12.1k]
  ------------------
  421|       |
  422|       |                /* Emit upgrade handler */
  423|  40.4k|                if (behavior.upgrade) {
  ------------------
  |  Branch (423:21): [True: 0, False: 40.4k]
  ------------------
  424|       |
  425|       |                    /* Nasty, ugly Safari 15 hack */
  426|      0|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  ------------------
  |  Branch (426:25): [True: 0, False: 0]
  ------------------
  427|      0|                        std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  428|      0|                        memset((void *) secWebSocketExtensions.data(), ' ', secWebSocketExtensions.length());
  429|      0|                    }
  430|       |
  431|      0|                    behavior.upgrade(res, req, (struct us_socket_context_t *) webSocketContext);
  432|  40.4k|                } else {
  433|       |                    /* Default handler upgrades to WebSocket */
  434|  40.4k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  435|  40.4k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  436|       |
  437|       |                    /* Safari 15 hack */
  438|  40.4k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  ------------------
  |  Branch (438:25): [True: 205, False: 40.2k]
  ------------------
  439|    205|                        secWebSocketExtensions = "";
  440|    205|                    }
  441|       |
  442|  40.4k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  443|  40.4k|                }
  444|       |
  445|       |                /* We are going to get uncorked by the Http get return */
  446|       |
  447|       |                /* We do not need to check for any close or shutdown here as we immediately return from get handler */
  448|       |
  449|  40.4k|            } else {
  450|       |                /* Tell the router that we did not handle this request */
  451|  12.1k|                req->setYield(true);
  452|  12.1k|            }
  453|  52.6k|        }, true);
_ZN3uWS20hasBrokenCompressionENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   31|  40.4k|    inline bool hasBrokenCompression(std::string_view userAgent) {
   32|  40.4k|        size_t posStart = userAgent.find(" Version/15.");
   33|  40.4k|        if (posStart == std::string_view::npos) return false;
  ------------------
  |  Branch (33:13): [True: 27.3k, False: 13.1k]
  ------------------
   34|  13.1k|        posStart += 12;
   35|       |
   36|  13.1k|        size_t posEnd = userAgent.find(' ', posStart);
   37|  13.1k|        if (posEnd == std::string_view::npos) return false;
  ------------------
  |  Branch (37:13): [True: 448, False: 12.6k]
  ------------------
   38|       |
   39|  12.6k|        unsigned int minorVersion = 0;
   40|  12.6k|        auto result = std::from_chars(userAgent.data() + posStart, userAgent.data() + posEnd, minorVersion);
   41|  12.6k|        if (result.ec != std::errc()) return false;
  ------------------
  |  Branch (41:13): [True: 3.32k, False: 9.34k]
  ------------------
   42|  9.34k|        if (result.ptr != userAgent.data() + posEnd) return false; // do not accept trailing chars
  ------------------
  |  Branch (42:13): [True: 6.31k, False: 3.03k]
  ------------------
   43|  3.03k|        if (minorVersion > 3) return false; // we target just Safari 15.0 - 15.3
  ------------------
  |  Branch (43:13): [True: 2.05k, False: 985]
  ------------------
   44|       |
   45|    985|        if (userAgent.find(" Safari/", posEnd) == std::string_view::npos) return false;
  ------------------
  |  Branch (45:13): [True: 780, False: 205]
  ------------------
   46|       |
   47|    205|        return true;
   48|    985|    }
_ZN3uWS12TemplatedAppILb0EE3getENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  473|  6.94k|    TemplatedApp &&get(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  474|  6.94k|        if (httpContext) {
  ------------------
  |  Branch (474:13): [True: 6.94k, False: 0]
  ------------------
  475|  6.94k|            httpContext->onHttp("GET", pattern, std::move(handler));
  476|  6.94k|        }
  477|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  478|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE4postENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  480|  6.94k|    TemplatedApp &&post(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  481|  6.94k|        if (httpContext) {
  ------------------
  |  Branch (481:13): [True: 6.94k, False: 0]
  ------------------
  482|  6.94k|            httpContext->onHttp("POST", pattern, std::move(handler));
  483|  6.94k|        }
  484|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  485|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE3anyENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  537|  13.8k|    TemplatedApp &&any(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  538|  13.8k|        if (httpContext) {
  ------------------
  |  Branch (538:13): [True: 13.8k, False: 0]
  ------------------
  539|  13.8k|            httpContext->onHttp("*", pattern, std::move(handler));
  540|  13.8k|        }
  541|  13.8k|        return std::move(static_cast<TemplatedApp &&>(*this));
  542|  13.8k|    }
_ZN3uWS12TemplatedAppILb0EE6listenEiON5ofats13any_invocableIFvP18us_listen_socket_tEEE:
  563|  6.94k|    TemplatedApp &&listen(int port, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler) {
  564|  6.94k|        handler(httpContext ? httpContext->listen(nullptr, port, 0) : nullptr);
  ------------------
  |  Branch (564:17): [True: 6.94k, False: 0]
  ------------------
  565|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  566|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EEC2EOS1_:
  217|  6.94k|    TemplatedApp(TemplatedApp &&other) {
  218|       |        /* Move HttpContext */
  219|  6.94k|        httpContext = other.httpContext;
  220|  6.94k|        other.httpContext = nullptr;
  221|       |
  222|       |        /* Move webSocketContextDeleters */
  223|  6.94k|        webSocketContextDeleters = std::move(other.webSocketContextDeleters);
  224|       |
  225|  6.94k|        webSocketContexts = std::move(other.webSocketContexts);
  226|       |
  227|       |        /* Move TopicTree */
  228|  6.94k|        topicTree = other.topicTree;
  229|  6.94k|        other.topicTree = nullptr;
  230|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE13addServerNameENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_20SocketContextOptionsE:
   97|  6.94k|    TemplatedApp &&addServerName(std::string hostname_pattern, SocketContextOptions options = {}) {
   98|       |
   99|       |        /* Do nothing if not even on SSL */
  100|       |        if constexpr (SSL) {
  101|       |            /* First we create a new router for this domain */
  102|       |            auto *domainRouter = new HttpRouter<typename HttpContextData<SSL>::RouterData>();
  103|       |
  104|       |            us_socket_context_add_server_name(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str(), options, domainRouter);
  105|       |        }
  106|       |
  107|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  108|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE16removeServerNameENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  110|  6.94k|    TemplatedApp &&removeServerName(std::string hostname_pattern) {
  111|       |    
  112|       |        /* This will do for now, would be better if us_socket_context_remove_server_name returned the user data */
  113|  6.94k|        auto *domainRouter = us_socket_context_find_server_name_userdata(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str());
  114|  6.94k|        if (domainRouter) {
  ------------------
  |  Branch (114:13): [True: 0, False: 6.94k]
  ------------------
  115|      0|            delete (HttpRouter<typename HttpContextData<SSL>::RouterData> *) domainRouter;
  116|      0|        }
  117|       |
  118|  6.94k|        us_socket_context_remove_server_name(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str());
  119|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  120|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE17missingServerNameEN5ofats13any_invocableIFvPKcEEE:
  122|  6.94k|    TemplatedApp &&missingServerName(MoveOnlyFunction<void(const char *hostname)> handler) {
  123|       |
  124|  6.94k|        if (!constructorFailed()) {
  ------------------
  |  Branch (124:13): [True: 6.94k, False: 0]
  ------------------
  125|  6.94k|            httpContext->getSocketContextData()->missingServerNameHandler = std::move(handler);
  126|       |
  127|  6.94k|            us_socket_context_on_server_name(SSL, (struct us_socket_context_t *) httpContext, [](struct us_socket_context_t *context, const char *hostname) {
  128|       |
  129|       |                /* This is the only requirements of being friends with HttpContextData */
  130|  6.94k|                HttpContext<SSL> *httpContext = (HttpContext<SSL> *) context;
  131|  6.94k|                httpContext->getSocketContextData()->missingServerNameHandler(hostname);
  132|  6.94k|            });
  133|  6.94k|        }
  134|       |
  135|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  136|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE17constructorFailedEv:
  242|  6.94k|    bool constructorFailed() {
  243|  6.94k|        return !httpContext;
  244|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE15getNativeHandleEv:
  139|  6.94k|    void *getNativeHandle() {
  140|  6.94k|        return us_socket_context_get_native_handle(SSL, (struct us_socket_context_t *) httpContext);
  141|  6.94k|    }
_ZN3uWS12TemplatedAppILb0EE3runEv:
  649|  6.94k|    TemplatedApp &&run() {
  650|  6.94k|        uWS::run();
  651|  6.94k|        return std::move(static_cast<TemplatedApp &&>(*this));
  652|  6.94k|    }

_ZN3uWS11AsyncSocketILb0EE4corkEv:
  133|   263k|    void cork() {
  134|       |        /* Extra check for invalid corking of others */
  135|   263k|        if (getLoopData()->corkOffset && getLoopData()->corkedSocket != this) {
  ------------------
  |  Branch (135:13): [True: 0, False: 263k]
  |  Branch (135:42): [True: 0, False: 0]
  ------------------
  136|      0|            std::cerr << "Error: Cork buffer must not be acquired without checking canCork!" << std::endl;
  137|      0|            std::terminate();
  138|      0|        }
  139|       |
  140|       |        /* What if another socket is corked? */
  141|   263k|        getLoopData()->corkedSocket = this;
  142|   263k|    }
_ZN3uWS11AsyncSocketILb0EE11getLoopDataEv:
   85|  2.66M|    LoopData *getLoopData() {
   86|  2.66M|        return (LoopData *) us_loop_ext(us_socket_context_loop(SSL, us_socket_context(SSL, (us_socket_t *) this)));
   87|  2.66M|    }
_ZN3uWS11AsyncSocketILb0EE6uncorkEPKcib:
  327|   263k|    std::pair<int, bool> uncork(const char *src = nullptr, int length = 0, bool optionally = false) {
  328|   263k|        LoopData *loopData = getLoopData();
  329|       |
  330|   263k|        if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (330:13): [True: 263k, False: 0]
  ------------------
  331|   263k|            loopData->corkedSocket = nullptr;
  332|       |
  333|   263k|            if (loopData->corkOffset) {
  ------------------
  |  Branch (333:17): [True: 56.9k, False: 206k]
  ------------------
  334|       |                /* Corked data is already accounted for via its write call */
  335|  56.9k|                auto [written, failed] = write(loopData->corkBuffer, (int) loopData->corkOffset, false, length);
  336|  56.9k|                loopData->corkOffset = 0;
  337|       |
  338|  56.9k|                if (failed) {
  ------------------
  |  Branch (338:21): [True: 48.8k, False: 8.10k]
  ------------------
  339|       |                    /* We do not need to care for buffering here, write does that */
  340|  48.8k|                    return {0, true};
  341|  48.8k|                }
  342|  56.9k|            }
  343|       |
  344|       |            /* We should only return with new writes, not things written to cork already */
  345|   214k|            return write(src, length, optionally, 0);
  346|   263k|        } else {
  347|       |            /* We are not even corked! */
  348|      0|            return {0, false};
  349|      0|        }
  350|   263k|    }
_ZN3uWS11AsyncSocketILb0EE5writeEPKcibi:
  236|  1.70M|    std::pair<int, bool> write(const char *src, int length, bool optionally = false, int nextLength = 0) {
  237|       |        /* Fake success if closed, simple fix to allow uncork of closed socket to succeed */
  238|  1.70M|        if (us_socket_is_closed(SSL, (us_socket_t *) this)) {
  ------------------
  |  Branch (238:13): [True: 104k, False: 1.60M]
  ------------------
  239|   104k|            return {length, false};
  240|   104k|        }
  241|       |
  242|  1.60M|        LoopData *loopData = getLoopData();
  243|  1.60M|        AsyncSocketData<SSL> *asyncSocketData = getAsyncSocketData();
  244|       |
  245|       |        /* We are limited if we have a per-socket buffer */
  246|  1.60M|        if (asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (246:13): [True: 139k, False: 1.46M]
  ------------------
  247|       |            /* Write off as much as we can */
  248|   139k|            int written = us_socket_write(SSL, (us_socket_t *) this, asyncSocketData->buffer.data(), (int) asyncSocketData->buffer.length(), /*nextLength != 0 | */length);
  249|       |
  250|       |            /* On failure return, otherwise continue down the function */
  251|   139k|            if ((unsigned int) written < asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (251:17): [True: 134k, False: 5.68k]
  ------------------
  252|       |
  253|       |                /* Update buffering (todo: we can do better here if we keep track of what happens to this guy later on) */
  254|   134k|                asyncSocketData->buffer.erase((unsigned int) written);
  255|       |
  256|   134k|                if (optionally) {
  ------------------
  |  Branch (256:21): [True: 31.9k, False: 102k]
  ------------------
  257|       |                    /* Thankfully we can exit early here */
  258|  31.9k|                    return {0, true};
  259|   102k|                } else {
  260|       |                    /* This path is horrible and points towards erroneous usage */
  261|   102k|                    asyncSocketData->buffer.append(src, (unsigned int) length);
  262|       |
  263|   102k|                    return {length, true};
  264|   102k|                }
  265|   134k|            }
  266|       |
  267|       |            /* At this point we simply have no buffer and can continue as normal */
  268|  5.68k|            asyncSocketData->buffer.clear();
  269|  5.68k|        }
  270|       |
  271|  1.46M|        if (length) {
  ------------------
  |  Branch (271:13): [True: 1.40M, False: 60.2k]
  ------------------
  272|  1.40M|            if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (272:17): [True: 1.35M, False: 52.7k]
  ------------------
  273|       |                /* We are corked */
  274|  1.35M|                if (LoopData::CORK_BUFFER_SIZE - loopData->corkOffset >= (unsigned int) length) {
  ------------------
  |  Branch (274:21): [True: 1.35M, False: 0]
  ------------------
  275|       |                    /* If the entire chunk fits in cork buffer */
  276|  1.35M|                    memcpy(loopData->corkBuffer + loopData->corkOffset, src, (unsigned int) length);
  277|  1.35M|                    loopData->corkOffset += (unsigned int) length;
  278|       |                    /* Fall through to default return */
  279|  1.35M|                } else {
  280|       |                    /* Strategy differences between SSL and non-SSL regarding syscall minimizing */
  281|       |                    if constexpr (false) {
  282|       |                        /* Cork up as much as we can */
  283|       |                        unsigned int stripped = LoopData::CORK_BUFFER_SIZE - loopData->corkOffset;
  284|       |                        memcpy(loopData->corkBuffer + loopData->corkOffset, src, stripped);
  285|       |                        loopData->corkOffset = LoopData::CORK_BUFFER_SIZE;
  286|       |
  287|       |                        auto [written, failed] = uncork(src + stripped, length - (int) stripped, optionally);
  288|       |                        return {written + (int) stripped, failed};
  289|       |                    }
  290|       |
  291|       |                    /* For non-SSL we take the penalty of two syscalls */
  292|      0|                    return uncork(src, length, optionally);
  293|      0|                }
  294|  1.35M|            } else {
  295|       |                /* We are not corked */
  296|  52.7k|                int written = us_socket_write(SSL, (us_socket_t *) this, src, length, nextLength != 0);
  297|       |
  298|       |                /* Did we fail? */
  299|  52.7k|                if (written < length) {
  ------------------
  |  Branch (299:21): [True: 50.0k, False: 2.77k]
  ------------------
  300|       |                    /* If the write was optional then just bail out */
  301|  50.0k|                    if (optionally) {
  ------------------
  |  Branch (301:25): [True: 0, False: 50.0k]
  ------------------
  302|      0|                        return {written, true};
  303|      0|                    }
  304|       |
  305|       |                    /* Fall back to worst possible case (should be very rare for HTTP) */
  306|       |                    /* At least we can reserve room for next chunk if we know it up front */
  307|  50.0k|                    if (nextLength) {
  ------------------
  |  Branch (307:25): [True: 0, False: 50.0k]
  ------------------
  308|      0|                        asyncSocketData->buffer.reserve(asyncSocketData->buffer.length() + (size_t) (length - written + nextLength));
  309|      0|                    }
  310|       |
  311|       |                    /* Buffer this chunk */
  312|  50.0k|                    asyncSocketData->buffer.append(src + written, (size_t) (length - written));
  313|       |
  314|       |                    /* Return the failure */
  315|  50.0k|                    return {length, true};
  316|  50.0k|                }
  317|       |                /* Fall through to default return */
  318|  52.7k|            }
  319|  1.40M|        }
  320|       |
  321|       |        /* Default fall through return */
  322|  1.41M|        return {length, false};
  323|  1.46M|    }
_ZN3uWS11AsyncSocketILb0EE7timeoutEj:
   95|   210k|    void timeout(unsigned int seconds) {
   96|   210k|        us_socket_timeout(SSL, (us_socket_t *) this, seconds);
   97|   210k|    }
_ZN3uWS11AsyncSocketILb0EE17getBufferedAmountEv:
  193|   107k|    unsigned int getBufferedAmount() {
  194|       |        /* We return the actual amount of bytes in backbuffer, including pendingRemoval */
  195|   107k|        return (unsigned int) getAsyncSocketData()->buffer.totalLength();
  196|   107k|    }
_ZN3uWS11AsyncSocketILb0EE8shutdownEv:
  100|  1.98k|    void shutdown() {
  101|  1.98k|        us_socket_shutdown(SSL, (us_socket_t *) this);
  102|  1.98k|    }
_ZN3uWS11AsyncSocketILb0EE5closeEv:
  117|  34.3k|    us_socket_t *close() {
  118|  34.3k|        return us_socket_close(SSL, (us_socket_t *) this, 0, nullptr);
  119|  34.3k|    }
_ZN3uWS11AsyncSocketILb0EE18getAsyncSocketDataEv:
   90|  2.39M|    AsyncSocketData<SSL> *getAsyncSocketData() {
   91|  2.39M|        return (AsyncSocketData<SSL> *) us_socket_ext(SSL, (us_socket_t *) this);
   92|  2.39M|    }
_ZN3uWS11AsyncSocketILb0EE8isCorkedEv:
  145|   140k|    bool isCorked() {
  146|   140k|        return getLoopData()->corkedSocket == this;
  147|   140k|    }
_ZN3uWS11AsyncSocketILb0EE13getSendBufferEm:
  155|  23.5k|    std::pair<char *, SendBufferAttribute> getSendBuffer(size_t size) {
  156|       |        /* First step is to determine if we already have backpressure or not */
  157|  23.5k|        LoopData *loopData = getLoopData();
  158|  23.5k|        BackPressure &backPressure = getAsyncSocketData()->buffer;
  159|  23.5k|        size_t existingBackpressure = backPressure.length();
  160|  23.5k|        if ((!existingBackpressure) && (isCorked() || canCork()) && (loopData->corkOffset + size < LoopData::CORK_BUFFER_SIZE)) {
  ------------------
  |  Branch (160:13): [True: 5.76k, False: 17.7k]
  |  Branch (160:41): [True: 5.76k, False: 0]
  |  Branch (160:55): [True: 0, False: 0]
  |  Branch (160:69): [True: 5.62k, False: 138]
  ------------------
  161|       |            /* Cork automatically if we can */
  162|  5.62k|            if (isCorked()) {
  ------------------
  |  Branch (162:17): [True: 5.62k, False: 0]
  ------------------
  163|  5.62k|                char *sendBuffer = loopData->corkBuffer + loopData->corkOffset;
  164|  5.62k|                loopData->corkOffset += (unsigned int) size;
  165|  5.62k|                return {sendBuffer, SendBufferAttribute::NEEDS_NOTHING};
  166|  5.62k|            } else {
  167|      0|                cork();
  168|      0|                char *sendBuffer = loopData->corkBuffer + loopData->corkOffset;
  169|      0|                loopData->corkOffset += (unsigned int) size;
  170|      0|                return {sendBuffer, SendBufferAttribute::NEEDS_UNCORK};
  171|      0|            }
  172|  17.8k|        } else {
  173|       |
  174|       |            /* If we are corked and there is already data in the cork buffer,
  175|       |            mark how much is ours and reset it */
  176|  17.8k|            unsigned int ourCorkOffset = 0;
  177|  17.8k|            if (isCorked() && loopData->corkOffset) {
  ------------------
  |  Branch (177:17): [True: 17.8k, False: 0]
  |  Branch (177:31): [True: 74, False: 17.8k]
  ------------------
  178|     74|                ourCorkOffset = loopData->corkOffset;
  179|     74|                loopData->corkOffset = 0;
  180|     74|            }
  181|       |
  182|       |            /* Fallback is to use the backpressure as buffer */
  183|  17.8k|            backPressure.resize(ourCorkOffset + existingBackpressure + size);
  184|       |
  185|       |            /* And copy corkbuffer in front */
  186|  17.8k|            memcpy((char *) backPressure.data() + existingBackpressure, loopData->corkBuffer, ourCorkOffset);
  187|       |
  188|  17.8k|            return {(char *) backPressure.data() + ourCorkOffset + existingBackpressure, SendBufferAttribute::NEEDS_DRAIN};
  189|  17.8k|        }
  190|  23.5k|    }
_ZN3uWS11AsyncSocketILb0EE13corkUncheckedEv:
  121|  40.4k|    void corkUnchecked() {
  122|       |        /* What if another socket is corked? */
  123|  40.4k|        getLoopData()->corkedSocket = this;
  124|  40.4k|    }
_ZN3uWS11AsyncSocketILb0EE15getNativeHandleEv:
   80|  39.0k|    void *getNativeHandle() {
   81|  39.0k|        return us_socket_get_native_handle(SSL, (us_socket_t *) this);
   82|  39.0k|    }
_ZN3uWS11AsyncSocketILb0EE22getRemoteAddressAsTextEv:
  229|  39.0k|    std::string_view getRemoteAddressAsText() {
  230|  39.0k|        return addressAsText(getRemoteAddress());
  231|  39.0k|    }
_ZN3uWS11AsyncSocketILb0EE13addressAsTextENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  199|  39.0k|    std::string_view addressAsText(std::string_view binary) {
  200|  39.0k|        static thread_local char buf[64];
  201|  39.0k|        int ipLength = 0;
  202|       |
  203|  39.0k|        if (!binary.length()) {
  ------------------
  |  Branch (203:13): [True: 0, False: 39.0k]
  ------------------
  204|      0|            return {};
  205|      0|        }
  206|       |
  207|  39.0k|        unsigned char *b = (unsigned char *) binary.data();
  208|       |
  209|  39.0k|        if (binary.length() == 4) {
  ------------------
  |  Branch (209:13): [True: 22.2k, False: 16.8k]
  ------------------
  210|  22.2k|            ipLength = snprintf(buf, 64, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]);
  211|  22.2k|        } else {
  212|  16.8k|            ipLength = snprintf(buf, 64, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
  213|  16.8k|                b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11],
  214|  16.8k|                b[12], b[13], b[14], b[15]);
  215|  16.8k|        }
  216|       |
  217|  39.0k|        return {buf, (unsigned int) ipLength};
  218|  39.0k|    }
_ZN3uWS11AsyncSocketILb0EE16getRemoteAddressEv:
  221|  39.0k|    std::string_view getRemoteAddress() {
  222|  39.0k|        static thread_local char buf[16];
  223|  39.0k|        int ipLength = 16;
  224|  39.0k|        us_socket_remote_address(SSL, (us_socket_t *) this, buf, &ipLength);
  225|  39.0k|        return std::string_view(buf, (unsigned int) ipLength);
  226|  39.0k|    }

_ZN3uWS15AsyncSocketDataILb0EEC2Ev:
   83|  1.37M|    AsyncSocketData() = default;
_ZN3uWS12BackPressureC2Ev:
   32|  1.37M|    BackPressure() = default;
_ZN3uWS12BackPressure6lengthEv:
   44|  1.90M|    size_t length() {
   45|  1.90M|        return buffer.length() - pendingRemoval;
   46|  1.90M|    }
_ZN3uWS12BackPressure4dataEv:
   61|   175k|    const char *data() {
   62|   175k|        return buffer.data() + pendingRemoval;
   63|   175k|    }
_ZN3uWS12BackPressure5eraseEj:
   36|   134k|    void erase(unsigned int length) {
   37|   134k|        pendingRemoval += length;
   38|       |        /* Always erase a minimum of 1/32th the current backpressure */
   39|   134k|        if (pendingRemoval > (buffer.length() >> 5)) {
  ------------------
  |  Branch (39:13): [True: 73.3k, False: 60.7k]
  ------------------
   40|  73.3k|            std::string(buffer.begin() + pendingRemoval, buffer.end()).swap(buffer);
   41|  73.3k|            pendingRemoval = 0;
   42|  73.3k|        }
   43|   134k|    }
_ZN3uWS12BackPressure6appendEPKcm:
   33|   152k|    void append(const char *data, size_t length) {
   34|   152k|        buffer.append(data, length);
   35|   152k|    }
_ZN3uWS12BackPressure5clearEv:
   48|  5.68k|    void clear() {
   49|  5.68k|        pendingRemoval = 0;
   50|  5.68k|        buffer.clear();
   51|  5.68k|        buffer.shrink_to_fit();
   52|  5.68k|    }
_ZN3uWS12BackPressure11totalLengthEv:
   65|   107k|    size_t totalLength() {
   66|   107k|        return buffer.length();
   67|   107k|    }
_ZN3uWS12BackPressure6resizeEm:
   58|  17.8k|    void resize(size_t length) {
   59|  17.8k|        buffer.resize(length + pendingRemoval);
   60|  17.8k|    }
_ZN3uWS12BackPressureC2EOS0_:
   28|  80.9k|    BackPressure(BackPressure &&other) {
   29|  80.9k|        buffer = std::move(other.buffer);
   30|  80.9k|        pendingRemoval = other.pendingRemoval;
   31|  80.9k|    }
_ZN3uWS15AsyncSocketDataILb0EEC2EONS_12BackPressureE:
   78|  40.4k|    AsyncSocketData(BackPressure &&backpressure) : buffer(std::move(backpressure)) {
   79|       |
   80|  40.4k|    }

_ZN3uWS11BloomFilter5resetEv:
   76|  70.5k|    void reset() {
   77|  70.5k|        filter.reset();
   78|  70.5k|    }
_ZN3uWS11BloomFilter9mightHaveENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   52|   712k|    bool mightHave(std::string_view key) {
   53|   712k|        if (key.length() < 2) {
  ------------------
  |  Branch (53:13): [True: 3.47k, False: 709k]
  ------------------
   54|  3.47k|            return true;
   55|  3.47k|        }
   56|       |    
   57|   709k|        ScrambleArea s = getFeatures(key);
   58|   709k|        s.val = perfectHash(s.val);
   59|   709k|        return filter[s.p[0]] &&
  ------------------
  |  Branch (59:16): [True: 255k, False: 453k]
  ------------------
   60|   709k|        filter[s.p[1]] &&
  ------------------
  |  Branch (60:9): [True: 165k, False: 90.1k]
  ------------------
   61|   709k|        filter[s.p[2]] &&
  ------------------
  |  Branch (61:9): [True: 155k, False: 9.55k]
  ------------------
   62|   709k|        filter[s.p[3]];
  ------------------
  |  Branch (62:9): [True: 152k, False: 3.40k]
  ------------------
   63|   712k|    }
_ZN3uWS11BloomFilter11getFeaturesENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   42|   876k|    ScrambleArea getFeatures(std::string_view key) {
   43|   876k|        ScrambleArea s;
   44|   876k|        s.p[0] = reinterpret_cast<const unsigned char&>(key[0]);
   45|   876k|        s.p[1] = reinterpret_cast<const unsigned char&>(key[key.length() - 1]);
   46|   876k|        s.p[2] = reinterpret_cast<const unsigned char&>(key[key.length() - 2]);
   47|   876k|        s.p[3] = reinterpret_cast<const unsigned char&>(key[key.length() >> 1]);
   48|   876k|        return s;
   49|   876k|    }
_ZN3uWS11BloomFilter11perfectHashEj:
   33|   876k|    static inline uint32_t perfectHash(uint32_t features) {
   34|   876k|        return features * 1843993368;
   35|   876k|    }
_ZN3uWS11BloomFilter3addENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   65|   170k|    void add(std::string_view key) {
   66|   170k|        if (key.length() >= 2) {
  ------------------
  |  Branch (66:13): [True: 167k, False: 3.47k]
  ------------------
   67|   167k|            ScrambleArea s = getFeatures(key);
   68|   167k|            s.val = perfectHash(s.val);
   69|   167k|            filter[s.p[0]] = 1;
   70|   167k|            filter[s.p[1]] = 1;
   71|   167k|            filter[s.p[2]] = 1;
   72|   167k|            filter[s.p[3]] = 1;
   73|   167k|        }
   74|   170k|    }

_ZN3uWS24isParsingChunkedEncodingEm:
   95|  35.5k|    inline bool isParsingChunkedEncoding(uint64_t state) {
   96|  35.5k|        return state & ~STATE_SIZE_MASK;
   97|  35.5k|    }
_ZN3uWS13ChunkIteratorC2EPNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPmb:
  201|  36.1k|        ChunkIterator(std::string_view *data, uint64_t *state, bool trailer = false) : data(data), state(state), trailer(trailer) {
  202|  36.1k|            chunk = uWS::getNextChunk(*data, *state, trailer);
  203|  36.1k|        }
EpollHelloWorld.cpp:_ZN3uWSL12getNextChunkERNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERmb:
  104|  70.8k|    static std::optional<std::string_view> getNextChunk(std::string_view &data, uint64_t &state, bool trailer = false) {
  105|       |
  106|  75.9k|        while (data.length()) {
  ------------------
  |  Branch (106:16): [True: 41.5k, False: 34.4k]
  ------------------
  107|       |
  108|       |            // if in "drop trailer mode", just drop up to what we have as size
  109|  41.5k|            if (((state & STATE_IS_CHUNKED) == 0) && hasChunkSize(state) && chunkSize(state)) {
  ------------------
  |  Branch (109:17): [True: 796, False: 40.7k]
  |  Branch (109:54): [True: 796, False: 0]
  |  Branch (109:77): [True: 796, False: 0]
  ------------------
  110|       |
  111|       |                //printf("Parsing trailer now\n");
  112|       |
  113|  1.58k|                while(data.length() && chunkSize(state)) {
  ------------------
  |  Branch (113:23): [True: 1.16k, False: 419]
  |  Branch (113:40): [True: 1.16k, False: 0]
  ------------------
  114|  1.16k|                    data.remove_prefix(1);
  115|  1.16k|                    decChunkSize(state, 1);
  116|       |
  117|  1.16k|                    if (chunkSize(state) == 0) {
  ------------------
  |  Branch (117:25): [True: 377, False: 785]
  ------------------
  118|       |
  119|       |                        /* This is an actual place where we need 0 as state */
  120|    377|                        state = 0;
  121|       |
  122|       |                        /* The parser MUST stop consuming here */
  123|    377|                        return std::nullopt;
  124|    377|                    }
  125|  1.16k|                }
  126|    419|                continue;
  127|    796|            }
  128|       |
  129|  40.7k|            if (!hasChunkSize(state)) {
  ------------------
  |  Branch (129:17): [True: 6.08k, False: 34.6k]
  ------------------
  130|  6.08k|                consumeHexNumber(data, state);
  131|  6.08k|                if (isParsingInvalidChunkedEncoding(state)) {
  ------------------
  |  Branch (131:21): [True: 1.15k, False: 4.93k]
  ------------------
  132|  1.15k|                    return std::nullopt;
  133|  1.15k|                }
  134|  4.93k|                if (hasChunkSize(state) && chunkSize(state) == 2) {
  ------------------
  |  Branch (134:21): [True: 3.44k, False: 1.48k]
  |  Branch (134:44): [True: 831, False: 2.61k]
  ------------------
  135|       |
  136|       |                    //printf("Setting state to trailer-parsing and emitting empty chunk\n");
  137|       |
  138|       |                    // set trailer state and increase size to 4
  139|    831|                    if (trailer) {
  ------------------
  |  Branch (139:25): [True: 0, False: 831]
  ------------------
  140|      0|                        state = 4 /*| STATE_IS_CHUNKED*/ | STATE_HAS_SIZE;
  141|    831|                    } else {
  142|    831|                        state = 2 /*| STATE_IS_CHUNKED*/ | STATE_HAS_SIZE;
  143|    831|                    }
  144|       |
  145|    831|                    return std::string_view(nullptr, 0);
  146|    831|                }
  147|  4.10k|                continue;
  148|  4.93k|            }
  149|       |
  150|       |            // do we have data to emit all?
  151|  34.6k|            if (data.length() >= chunkSize(state)) {
  ------------------
  |  Branch (151:17): [True: 2.04k, False: 32.5k]
  ------------------
  152|       |                // emit all but 2 bytes then reset state to 0 and goto beginning
  153|       |                // not fin
  154|  2.04k|                std::string_view emitSoon;
  155|  2.04k|                bool shouldEmit = false;
  156|  2.04k|                if (chunkSize(state) > 2) {
  ------------------
  |  Branch (156:21): [True: 1.49k, False: 558]
  ------------------
  157|  1.49k|                    emitSoon = std::string_view(data.data(), chunkSize(state) - 2);
  158|  1.49k|                    shouldEmit = true;
  159|  1.49k|                }
  160|  2.04k|                data.remove_prefix(chunkSize(state));
  161|  2.04k|                state = STATE_IS_CHUNKED;
  162|  2.04k|                if (shouldEmit) {
  ------------------
  |  Branch (162:21): [True: 1.49k, False: 558]
  ------------------
  163|  1.49k|                    return emitSoon;
  164|  1.49k|                }
  165|    558|                continue;
  166|  32.5k|            } else {
  167|       |                /* We will consume all our input data */
  168|  32.5k|                std::string_view emitSoon;
  169|  32.5k|                if (chunkSize(state) > 2) {
  ------------------
  |  Branch (169:21): [True: 32.3k, False: 202]
  ------------------
  170|  32.3k|                    uint64_t maximalAppEmit = chunkSize(state) - 2;
  171|  32.3k|                    if (data.length() > maximalAppEmit) {
  ------------------
  |  Branch (171:25): [True: 527, False: 31.8k]
  ------------------
  172|    527|                        emitSoon = data.substr(0, maximalAppEmit);
  173|  31.8k|                    } else {
  174|       |                        //cb(data);
  175|  31.8k|                        emitSoon = data;
  176|  31.8k|                    }
  177|  32.3k|                }
  178|  32.5k|                decChunkSize(state, (unsigned int) data.length());
  179|  32.5k|                state |= STATE_IS_CHUNKED;
  180|       |                // new: decrease data by its size (bug)
  181|  32.5k|                data.remove_prefix(data.length()); // ny bug fix för getNextChunk
  182|  32.5k|                if (emitSoon.length()) {
  ------------------
  |  Branch (182:21): [True: 32.3k, False: 202]
  ------------------
  183|  32.3k|                    return emitSoon;
  184|  32.3k|                } else {
  185|    202|                    return std::nullopt;
  186|    202|                }
  187|  32.5k|            }
  188|  34.6k|        }
  189|       |
  190|  34.4k|        return std::nullopt;
  191|  70.8k|    }
_ZN3uWS12hasChunkSizeEm:
   90|  46.4k|    inline bool hasChunkSize(uint64_t state) {
   91|  46.4k|        return state & STATE_HAS_SIZE;
   92|  46.4k|    }
_ZN3uWS9chunkSizeEm:
   38|   166k|    inline uint64_t chunkSize(uint64_t state) {
   39|   166k|        return state & STATE_SIZE_MASK;
   40|   166k|    }
_ZN3uWS12decChunkSizeERmj:
   81|  33.7k|    inline void decChunkSize(uint64_t &state, unsigned int by) {
   82|       |
   83|       |        //unsigned int bits = state & STATE_IS_CHUNKED;
   84|       |
   85|  33.7k|        state = (state & ~STATE_SIZE_MASK) | (chunkSize(state) - by);
   86|       |
   87|       |        //state |= bits;
   88|  33.7k|    }
_ZN3uWS16consumeHexNumberERNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERm:
   43|  6.08k|    inline void consumeHexNumber(std::string_view &data, uint64_t &state) {
   44|       |        /* Consume everything higher than 32 */
   45|  26.6k|        while (data.length() && data.data()[0] > 32) {
  ------------------
  |  Branch (45:16): [True: 25.7k, False: 860]
  |  Branch (45:33): [True: 21.6k, False: 4.07k]
  ------------------
   46|       |
   47|  21.6k|            unsigned char digit = (unsigned char)data.data()[0];
   48|  21.6k|            if (digit >= 'a') {
  ------------------
  |  Branch (48:17): [True: 4.37k, False: 17.3k]
  ------------------
   49|  4.37k|                digit = (unsigned char) (digit - ('a' - ':'));
   50|  17.3k|            } else if (digit >= 'A') {
  ------------------
  |  Branch (50:24): [True: 11.6k, False: 5.68k]
  ------------------
   51|  11.6k|                digit = (unsigned char) (digit - ('A' - ':'));
   52|  11.6k|            }
   53|       |
   54|  21.6k|            unsigned int number = ((unsigned int) digit - (unsigned int) '0');
   55|       |
   56|  21.6k|            if (number > 16 || (chunkSize(state) & STATE_SIZE_OVERFLOW)) {
  ------------------
  |  Branch (56:17): [True: 901, False: 20.7k]
  |  Branch (56:32): [True: 249, False: 20.5k]
  ------------------
   57|  1.15k|                state = STATE_IS_ERROR;
   58|  1.15k|                return;
   59|  1.15k|            }
   60|       |
   61|       |            // extract state bits
   62|  20.5k|            uint64_t bits = /*state &*/ STATE_IS_CHUNKED;
   63|       |
   64|  20.5k|            state = (state & STATE_SIZE_MASK) * 16ull + number;
   65|       |
   66|  20.5k|            state |= bits;
   67|  20.5k|            data.remove_prefix(1);
   68|  20.5k|        }
   69|       |        /* Consume everything not /n */
   70|  22.4k|        while (data.length() && data.data()[0] != '\n') {
  ------------------
  |  Branch (70:16): [True: 21.0k, False: 1.48k]
  |  Branch (70:33): [True: 17.5k, False: 3.44k]
  ------------------
   71|  17.5k|            data.remove_prefix(1);
   72|  17.5k|        }
   73|       |        /* Now we stand on \n so consume it and enable size */
   74|  4.93k|        if (data.length()) {
  ------------------
  |  Branch (74:13): [True: 3.44k, False: 1.48k]
  ------------------
   75|  3.44k|            state += 2; // include the two last /r/n
   76|  3.44k|            state |= STATE_HAS_SIZE | STATE_IS_CHUNKED;
   77|  3.44k|            data.remove_prefix(1);
   78|  3.44k|        }
   79|  4.93k|    }
_ZN3uWS13ChunkIterator5beginEv:
  209|  36.1k|        ChunkIterator begin() {
  210|  36.1k|            return *this;
  211|  36.1k|        }
_ZN3uWS13ChunkIterator3endEv:
  213|  36.1k|        ChunkIterator end() {
  214|  36.1k|            return ChunkIterator();
  215|  36.1k|        }
_ZN3uWS13ChunkIteratorC2Ev:
  205|  36.1k|        ChunkIterator() {
  206|       |
  207|  36.1k|        }
_ZNK3uWS13ChunkIteratorneERKS0_:
  224|  70.8k|        bool operator!=(const ChunkIterator &other) const {
  225|  70.8k|            return other.chunk.has_value() != chunk.has_value();
  226|  70.8k|        }
_ZN3uWS13ChunkIteratordeEv:
  217|  34.7k|        std::string_view operator*() {
  218|  34.7k|            if (!chunk.has_value()) {
  ------------------
  |  Branch (218:17): [True: 0, False: 34.7k]
  ------------------
  219|      0|                std::abort();
  220|      0|            }
  221|  34.7k|            return chunk.value();
  222|  34.7k|        }
_ZN3uWS13ChunkIteratorppEv:
  228|  34.7k|        ChunkIterator &operator++() {
  229|  34.7k|            chunk = uWS::getNextChunk(*data, *state, trailer);
  230|  34.7k|            return *this;
  231|  34.7k|        }
_ZN3uWS31isParsingInvalidChunkedEncodingEm:
   99|  42.2k|    inline bool isParsingInvalidChunkedEncoding(uint64_t state) {
  100|  42.2k|        return state == STATE_IS_ERROR;
  101|  42.2k|    }

_ZN3uWS11HttpContextILb0EE6createEPNS_4LoopE27us_socket_context_options_t:
  396|  6.94k|    static HttpContext *create(Loop *loop, us_socket_context_options_t options = {}) {
  397|  6.94k|        HttpContext *httpContext;
  398|       |
  399|  6.94k|        httpContext = (HttpContext *) us_create_socket_context(SSL, (us_loop_t *) loop, sizeof(HttpContextData<SSL>), options);
  400|       |
  401|  6.94k|        if (!httpContext) {
  ------------------
  |  Branch (401:13): [True: 0, False: 6.94k]
  ------------------
  402|      0|            return nullptr;
  403|      0|        }
  404|       |
  405|       |        /* Init socket context data */
  406|  6.94k|        new ((HttpContextData<SSL> *) us_socket_context_ext(SSL, (us_socket_context_t *) httpContext)) HttpContextData<SSL>();
  407|  6.94k|        return httpContext->init();
  408|  6.94k|    }
_ZN3uWS11HttpContextILb0EE4initEv:
   70|  6.94k|    HttpContext<SSL> *init() {
   71|       |        /* Handle socket connections */
   72|  6.94k|        us_socket_context_on_open(SSL, getSocketContext(), [](us_socket_t *s, int /*is_client*/, char */*ip*/, int /*ip_length*/) {
   73|       |            /* Any connected socket should timeout until it has a request */
   74|  6.94k|            us_socket_timeout(SSL, s, HTTP_IDLE_TIMEOUT_S);
   75|       |
   76|       |            /* Init socket ext */
   77|  6.94k|            new (us_socket_ext(SSL, s)) HttpResponseData<SSL>;
   78|       |
   79|       |            /* Call filter */
   80|  6.94k|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
   81|  6.94k|            for (auto &f : httpContextData->filterHandlers) {
   82|  6.94k|                f((HttpResponse<SSL> *) s, 1);
   83|  6.94k|            }
   84|       |
   85|  6.94k|            return s;
   86|  6.94k|        });
   87|       |
   88|       |        /* Handle socket disconnections */
   89|  6.94k|        us_socket_context_on_close(SSL, getSocketContext(), [](us_socket_t *s, int /*code*/, void */*reason*/) {
   90|       |            /* Get socket ext */
   91|  6.94k|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, s);
   92|       |
   93|       |            /* Call filter */
   94|  6.94k|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
   95|  6.94k|            for (auto &f : httpContextData->filterHandlers) {
   96|  6.94k|                f((HttpResponse<SSL> *) s, -1);
   97|  6.94k|            }
   98|       |
   99|       |            /* Signal broken HTTP request only if we have a pending request */
  100|  6.94k|            if (httpResponseData->onAborted) {
  101|  6.94k|                httpResponseData->onAborted();
  102|  6.94k|            }
  103|       |
  104|       |            /* Destruct socket ext */
  105|  6.94k|            httpResponseData->~HttpResponseData<SSL>();
  106|       |
  107|  6.94k|            return s;
  108|  6.94k|        });
  109|       |
  110|       |        /* Handle HTTP data streams */
  111|  6.94k|        us_socket_context_on_data(SSL, getSocketContext(), [](us_socket_t *s, char *data, int length) {
  112|       |
  113|       |            // total overhead is about 210k down to 180k
  114|       |            // ~210k req/sec is the original perf with write in data
  115|       |            // ~200k req/sec is with cork and formatting
  116|       |            // ~190k req/sec is with http parsing
  117|       |            // ~180k - 190k req/sec is with varying routing
  118|       |
  119|  6.94k|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
  120|       |
  121|       |            /* Do not accept any data while in shutdown state */
  122|  6.94k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  123|  6.94k|                return s;
  124|  6.94k|            }
  125|       |
  126|  6.94k|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, s);
  127|       |
  128|       |            /* Cork this socket */
  129|  6.94k|            ((AsyncSocket<SSL> *) s)->cork();
  130|       |
  131|       |            /* Mark that we are inside the parser now */
  132|  6.94k|            httpContextData->isParsingHttp = true;
  133|       |
  134|       |            // clients need to know the cursor after http parse, not servers!
  135|       |            // how far did we read then? we need to know to continue with websocket parsing data? or?
  136|       |
  137|  6.94k|            void *proxyParser = nullptr;
  138|       |#ifdef UWS_WITH_PROXY
  139|       |            proxyParser = &httpResponseData->proxyParser;
  140|       |#endif
  141|       |
  142|       |            /* The return value is entirely up to us to interpret. The HttpParser only care for whether the returned value is DIFFERENT or not from passed user */
  143|  6.94k|            auto [err, returnedSocket] = httpResponseData->consumePostPadded(data, (unsigned int) length, s, proxyParser, [httpContextData](void *s, HttpRequest *httpRequest) -> void * {
  144|       |                /* For every request we reset the timeout and hang until user makes action */
  145|       |                /* Warning: if we are in shutdown state, resetting the timer is a security issue! */
  146|  6.94k|                us_socket_timeout(SSL, (us_socket_t *) s, 0);
  147|       |
  148|       |                /* Reset httpResponse */
  149|  6.94k|                HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, (us_socket_t *) s);
  150|  6.94k|                httpResponseData->offset = 0;
  151|       |
  152|       |                /* Are we not ready for another request yet? Terminate the connection.
  153|       |                 * Important for denying async pipelining until, if ever, we want to suppot it.
  154|       |                 * Otherwise requests can get mixed up on the same connection. We still support sync pipelining. */
  155|  6.94k|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) {
  156|  6.94k|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  157|  6.94k|                    return nullptr;
  158|  6.94k|                }
  159|       |
  160|       |                /* Mark pending request and emit it */
  161|  6.94k|                httpResponseData->state = HttpResponseData<SSL>::HTTP_RESPONSE_PENDING;
  162|       |
  163|       |                /* Mark this response as connectionClose if ancient or connection: close */
  164|  6.94k|                if (httpRequest->isAncient() || httpRequest->getHeader("connection").length() == 5) {
  165|  6.94k|                    httpResponseData->state |= HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE;
  166|  6.94k|                }
  167|       |
  168|       |                /* Select the router based on SNI (only possible for SSL) */
  169|  6.94k|                auto *selectedRouter = &httpContextData->router;
  170|  6.94k|                if constexpr (SSL) {
  171|  6.94k|                    void *domainRouter = us_socket_server_name_userdata(SSL, (struct us_socket_t *) s);
  172|  6.94k|                    if (domainRouter) {
  173|  6.94k|                        selectedRouter = (decltype(selectedRouter)) domainRouter;
  174|  6.94k|                    }
  175|  6.94k|                }
  176|       |
  177|       |                /* Route the method and URL */
  178|  6.94k|                selectedRouter->getUserData() = {(HttpResponse<SSL> *) s, httpRequest};
  179|  6.94k|                if (!selectedRouter->route(httpRequest->getCaseSensitiveMethod(), httpRequest->getUrl())) {
  180|       |                    /* We have to force close this socket as we have no handler for it */
  181|  6.94k|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  182|  6.94k|                    return nullptr;
  183|  6.94k|                }
  184|       |
  185|       |                /* First of all we need to check if this socket was deleted due to upgrade */
  186|  6.94k|                if (httpContextData->upgradedWebSocket) {
  187|       |                    /* We differ between closed and upgraded below */
  188|  6.94k|                    return nullptr;
  189|  6.94k|                }
  190|       |
  191|       |                /* Was the socket closed? */
  192|  6.94k|                if (us_socket_is_closed(SSL, (struct us_socket_t *) s)) {
  193|  6.94k|                    return nullptr;
  194|  6.94k|                }
  195|       |
  196|       |                /* We absolutely have to terminate parsing if shutdown */
  197|  6.94k|                if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  198|  6.94k|                    return nullptr;
  199|  6.94k|                }
  200|       |
  201|       |                /* Returning from a request handler without responding or attaching an onAborted handler is ill-use */
  202|  6.94k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && !httpResponseData->onAborted) {
  203|       |                    /* Throw exception here? */
  204|  6.94k|                    std::cerr << "Error: Returning from a request handler without responding or attaching an abort handler is forbidden!" << std::endl;
  205|  6.94k|                    std::terminate();
  206|  6.94k|                }
  207|       |
  208|       |                /* If we have not responded and we have a data handler, we need to timeout to enfore client sending the data */
  209|  6.94k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && httpResponseData->inStream) {
  210|  6.94k|                    us_socket_timeout(SSL, (us_socket_t *) s, HTTP_IDLE_TIMEOUT_S);
  211|  6.94k|                }
  212|       |
  213|       |                /* Continue parsing */
  214|  6.94k|                return s;
  215|       |
  216|  6.94k|            }, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
  217|       |                /* We always get an empty chunk even if there is no data */
  218|  6.94k|                if (httpResponseData->inStream) {
  219|       |
  220|       |                    /* Todo: can this handle timeout for non-post as well? */
  221|  6.94k|                    if (fin) {
  222|       |                        /* If we just got the last chunk (or empty chunk), disable timeout */
  223|  6.94k|                        us_socket_timeout(SSL, (struct us_socket_t *) user, 0);
  224|  6.94k|                    } else {
  225|       |                        /* We still have some more data coming in later, so reset timeout */
  226|       |                        /* Only reset timeout if we got enough bytes (16kb/sec) since last time we reset here */
  227|  6.94k|                        httpResponseData->received_bytes_per_timeout += (unsigned int) data.length();
  228|  6.94k|                        if (httpResponseData->received_bytes_per_timeout >= HTTP_RECEIVE_THROUGHPUT_BYTES * HTTP_IDLE_TIMEOUT_S) {
  229|  6.94k|                            us_socket_timeout(SSL, (struct us_socket_t *) user, HTTP_IDLE_TIMEOUT_S);
  230|  6.94k|                            httpResponseData->received_bytes_per_timeout = 0;
  231|  6.94k|                        }
  232|  6.94k|                    }
  233|       |
  234|       |                    /* We might respond in the handler, so do not change timeout after this */
  235|  6.94k|                    httpResponseData->inStream(data, fin);
  236|       |
  237|       |                    /* Was the socket closed? */
  238|  6.94k|                    if (us_socket_is_closed(SSL, (struct us_socket_t *) user)) {
  239|  6.94k|                        return nullptr;
  240|  6.94k|                    }
  241|       |
  242|       |                    /* We absolutely have to terminate parsing if shutdown */
  243|  6.94k|                    if (us_socket_is_shut_down(SSL, (us_socket_t *) user)) {
  244|  6.94k|                        return nullptr;
  245|  6.94k|                    }
  246|       |
  247|       |                    /* If we were given the last data chunk, reset data handler to ensure following
  248|       |                     * requests on the same socket won't trigger any previously registered behavior */
  249|  6.94k|                    if (fin) {
  250|  6.94k|                        httpResponseData->inStream = nullptr;
  251|  6.94k|                    }
  252|  6.94k|                }
  253|  6.94k|                return user;
  254|  6.94k|            });
  255|       |
  256|       |            /* Mark that we are no longer parsing Http */
  257|  6.94k|            httpContextData->isParsingHttp = false;
  258|       |
  259|       |            /* If we got fullptr that means the parser wants us to close the socket from error (same as calling the errorHandler) */
  260|  6.94k|            if (returnedSocket == FULLPTR) {
  261|       |                /* For errors, we only deliver them "at most once". We don't care if they get halfways delivered or not. */
  262|  6.94k|                us_socket_write(SSL, s, httpErrorResponses[err].data(), (int) httpErrorResponses[err].length(), false);
  263|  6.94k|                us_socket_shutdown(SSL, s);
  264|       |                /* Close any socket on HTTP errors */
  265|  6.94k|                us_socket_close(SSL, s, 0, nullptr);
  266|       |                /* This just makes the following code act as if the socket was closed from error inside the parser. */
  267|  6.94k|                returnedSocket = nullptr;
  268|  6.94k|            }
  269|       |
  270|       |            /* We need to uncork in all cases, except for nullptr (closed socket, or upgraded socket) */
  271|  6.94k|            if (returnedSocket != nullptr) {
  272|       |                /* Timeout on uncork failure */
  273|  6.94k|                auto [written, failed] = ((AsyncSocket<SSL> *) returnedSocket)->uncork();
  274|  6.94k|                if (failed) {
  275|       |                    /* All Http sockets timeout by this, and this behavior match the one in HttpResponse::cork */
  276|       |                    /* Warning: both HTTP_IDLE_TIMEOUT_S and HTTP_TIMEOUT_S are 10 seconds and both are used the same */
  277|  6.94k|                    ((AsyncSocket<SSL> *) s)->timeout(HTTP_IDLE_TIMEOUT_S);
  278|  6.94k|                }
  279|       |
  280|       |                /* We need to check if we should close this socket here now */
  281|  6.94k|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  282|  6.94k|                    if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  283|  6.94k|                        if (((AsyncSocket<SSL> *) s)->getBufferedAmount() == 0) {
  284|  6.94k|                            ((AsyncSocket<SSL> *) s)->shutdown();
  285|       |                            /* We need to force close after sending FIN since we want to hinder
  286|       |                             * clients from keeping to send their huge data */
  287|  6.94k|                            ((AsyncSocket<SSL> *) s)->close();
  288|  6.94k|                        }
  289|  6.94k|                    }
  290|  6.94k|                }
  291|       |
  292|  6.94k|                return (us_socket_t *) returnedSocket;
  293|  6.94k|            }
  294|       |
  295|       |            /* If we upgraded, check here (differ between nullptr close and nullptr upgrade) */
  296|  6.94k|            if (httpContextData->upgradedWebSocket) {
  297|       |                /* This path is only for upgraded websockets */
  298|  6.94k|                AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) httpContextData->upgradedWebSocket;
  299|       |
  300|       |                /* Uncork here as well (note: what if we failed to uncork and we then pub/sub before we even upgraded?) */
  301|  6.94k|                auto [written, failed] = asyncSocket->uncork();
  302|       |
  303|       |                /* If we succeeded in uncorking, check if we have sent WebSocket FIN */
  304|  6.94k|                if (!failed) {
  305|  6.94k|                    WebSocketData *webSocketData = (WebSocketData *) asyncSocket->getAsyncSocketData();
  306|  6.94k|                    if (webSocketData->isShuttingDown) {
  307|       |                        /* In that case, also send TCP FIN (this is similar to what we have in ws drain handler) */
  308|  6.94k|                        asyncSocket->shutdown();
  309|  6.94k|                    }
  310|  6.94k|                }
  311|       |
  312|       |                /* Reset upgradedWebSocket before we return */
  313|  6.94k|                httpContextData->upgradedWebSocket = nullptr;
  314|       |
  315|       |                /* Return the new upgraded websocket */
  316|  6.94k|                return (us_socket_t *) asyncSocket;
  317|  6.94k|            }
  318|       |
  319|       |            /* It is okay to uncork a closed socket and we need to */
  320|  6.94k|            ((AsyncSocket<SSL> *) s)->uncork();
  321|       |
  322|       |            /* We cannot return nullptr to the underlying stack in any case */
  323|  6.94k|            return s;
  324|  6.94k|        });
  325|       |
  326|       |        /* Handle HTTP write out (note: SSL_read may trigger this spuriously, the app need to handle spurious calls) */
  327|  6.94k|        us_socket_context_on_writable(SSL, getSocketContext(), [](us_socket_t *s) {
  328|       |
  329|  6.94k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  330|  6.94k|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) asyncSocket->getAsyncSocketData();
  331|       |
  332|       |            /* Ask the developer to write data and return success (true) or failure (false), OR skip sending anything and return success (true). */
  333|  6.94k|            if (httpResponseData->onWritable) {
  334|       |                /* We are now writable, so hang timeout again, the user does not have to do anything so we should hang until end or tryEnd rearms timeout */
  335|  6.94k|                us_socket_timeout(SSL, s, 0);
  336|       |
  337|       |                /* We expect the developer to return whether or not write was successful (true).
  338|       |                 * If write was never called, the developer should still return true so that we may drain. */
  339|  6.94k|                bool success = httpResponseData->callOnWritable(httpResponseData->offset);
  340|       |
  341|       |                /* The developer indicated that their onWritable failed. */
  342|  6.94k|                if (!success) {
  343|       |                    /* Skip testing if we can drain anything since that might perform an extra syscall */
  344|  6.94k|                    return s;
  345|  6.94k|                }
  346|       |
  347|       |                /* We don't want to fall through since we don't want to mess with timeout.
  348|       |                 * It makes little sense to drain any backpressure when the user has registered onWritable. */
  349|  6.94k|                return s;
  350|  6.94k|            }
  351|       |
  352|       |            /* Drain any socket buffer, this might empty our backpressure and thus finish the request */
  353|       |            /*auto [written, failed] = */asyncSocket->write(nullptr, 0, true, 0);
  354|       |
  355|       |            /* Should we close this connection after a response - and is this response really done? */
  356|  6.94k|            if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  357|  6.94k|                if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  358|  6.94k|                    if (asyncSocket->getBufferedAmount() == 0) {
  359|  6.94k|                        asyncSocket->shutdown();
  360|       |                        /* We need to force close after sending FIN since we want to hinder
  361|       |                         * clients from keeping to send their huge data */
  362|  6.94k|                        asyncSocket->close();
  363|  6.94k|                    }
  364|  6.94k|                }
  365|  6.94k|            }
  366|       |
  367|       |            /* Expect another writable event, or another request within the timeout */
  368|  6.94k|            asyncSocket->timeout(HTTP_IDLE_TIMEOUT_S);
  369|       |
  370|  6.94k|            return s;
  371|  6.94k|        });
  372|       |
  373|       |        /* Handle FIN, HTTP does not support half-closed sockets, so simply close */
  374|  6.94k|        us_socket_context_on_end(SSL, getSocketContext(), [](us_socket_t *s) {
  375|       |
  376|       |            /* We do not care for half closed sockets */
  377|  6.94k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  378|  6.94k|            return asyncSocket->close();
  379|       |
  380|  6.94k|        });
  381|       |
  382|       |        /* Handle socket timeouts, simply close them so to not confuse client with FIN */
  383|  6.94k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](us_socket_t *s) {
  384|       |
  385|       |            /* Force close rather than gracefully shutdown and risk confusing the client with a complete download */
  386|  6.94k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  387|  6.94k|            return asyncSocket->close();
  388|       |
  389|  6.94k|        });
  390|       |
  391|  6.94k|        return this;
  392|  6.94k|    }
_ZN3uWS11HttpContextILb0EE16getSocketContextEv:
   53|   151k|    us_socket_context_t *getSocketContext() {
   54|   151k|        return (us_socket_context_t *) this;
   55|   151k|    }
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tiPciE_clES3_iS4_i:
   72|  1.37M|        us_socket_context_on_open(SSL, getSocketContext(), [](us_socket_t *s, int /*is_client*/, char */*ip*/, int /*ip_length*/) {
   73|       |            /* Any connected socket should timeout until it has a request */
   74|  1.37M|            us_socket_timeout(SSL, s, HTTP_IDLE_TIMEOUT_S);
   75|       |
   76|       |            /* Init socket ext */
   77|  1.37M|            new (us_socket_ext(SSL, s)) HttpResponseData<SSL>;
   78|       |
   79|       |            /* Call filter */
   80|  1.37M|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
   81|  1.37M|            for (auto &f : httpContextData->filterHandlers) {
  ------------------
  |  Branch (81:26): [True: 0, False: 1.37M]
  ------------------
   82|      0|                f((HttpResponse<SSL> *) s, 1);
   83|      0|            }
   84|       |
   85|  1.37M|            return s;
   86|  1.37M|        });
_ZN3uWS11HttpContextILb0EE21getSocketContextDataSEP11us_socket_t:
   65|  2.90M|    static HttpContextData<SSL> *getSocketContextDataS(us_socket_t *s) {
   66|  2.90M|        return (HttpContextData<SSL> *) us_socket_context_ext(SSL, getSocketContext(s));
   67|  2.90M|    }
_ZN3uWS11HttpContextILb0EE16getSocketContextEP11us_socket_t:
   57|  2.90M|    static us_socket_context_t *getSocketContext(us_socket_t *s) {
   58|  2.90M|        return (us_socket_context_t *) us_socket_context(SSL, s);
   59|  2.90M|    }
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tiPvE_clES3_iS4_:
   89|  1.33M|        us_socket_context_on_close(SSL, getSocketContext(), [](us_socket_t *s, int /*code*/, void */*reason*/) {
   90|       |            /* Get socket ext */
   91|  1.33M|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, s);
   92|       |
   93|       |            /* Call filter */
   94|  1.33M|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
   95|  1.33M|            for (auto &f : httpContextData->filterHandlers) {
  ------------------
  |  Branch (95:26): [True: 0, False: 1.33M]
  ------------------
   96|      0|                f((HttpResponse<SSL> *) s, -1);
   97|      0|            }
   98|       |
   99|       |            /* Signal broken HTTP request only if we have a pending request */
  100|  1.33M|            if (httpResponseData->onAborted) {
  ------------------
  |  Branch (100:17): [True: 3.00k, False: 1.32M]
  ------------------
  101|  3.00k|                httpResponseData->onAborted();
  102|  3.00k|            }
  103|       |
  104|       |            /* Destruct socket ext */
  105|  1.33M|            httpResponseData->~HttpResponseData<SSL>();
  106|       |
  107|  1.33M|            return s;
  108|  1.33M|        });
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clES3_S4_i:
  111|   203k|        us_socket_context_on_data(SSL, getSocketContext(), [](us_socket_t *s, char *data, int length) {
  112|       |
  113|       |            // total overhead is about 210k down to 180k
  114|       |            // ~210k req/sec is the original perf with write in data
  115|       |            // ~200k req/sec is with cork and formatting
  116|       |            // ~190k req/sec is with http parsing
  117|       |            // ~180k - 190k req/sec is with varying routing
  118|       |
  119|   203k|            HttpContextData<SSL> *httpContextData = getSocketContextDataS(s);
  120|       |
  121|       |            /* Do not accept any data while in shutdown state */
  122|   203k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  ------------------
  |  Branch (122:17): [True: 0, False: 203k]
  ------------------
  123|      0|                return s;
  124|      0|            }
  125|       |
  126|   203k|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, s);
  127|       |
  128|       |            /* Cork this socket */
  129|   203k|            ((AsyncSocket<SSL> *) s)->cork();
  130|       |
  131|       |            /* Mark that we are inside the parser now */
  132|   203k|            httpContextData->isParsingHttp = true;
  133|       |
  134|       |            // clients need to know the cursor after http parse, not servers!
  135|       |            // how far did we read then? we need to know to continue with websocket parsing data? or?
  136|       |
  137|   203k|            void *proxyParser = nullptr;
  138|       |#ifdef UWS_WITH_PROXY
  139|       |            proxyParser = &httpResponseData->proxyParser;
  140|       |#endif
  141|       |
  142|       |            /* The return value is entirely up to us to interpret. The HttpParser only care for whether the returned value is DIFFERENT or not from passed user */
  143|   203k|            auto [err, returnedSocket] = httpResponseData->consumePostPadded(data, (unsigned int) length, s, proxyParser, [httpContextData](void *s, HttpRequest *httpRequest) -> void * {
  144|       |                /* For every request we reset the timeout and hang until user makes action */
  145|       |                /* Warning: if we are in shutdown state, resetting the timer is a security issue! */
  146|   203k|                us_socket_timeout(SSL, (us_socket_t *) s, 0);
  147|       |
  148|       |                /* Reset httpResponse */
  149|   203k|                HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, (us_socket_t *) s);
  150|   203k|                httpResponseData->offset = 0;
  151|       |
  152|       |                /* Are we not ready for another request yet? Terminate the connection.
  153|       |                 * Important for denying async pipelining until, if ever, we want to suppot it.
  154|       |                 * Otherwise requests can get mixed up on the same connection. We still support sync pipelining. */
  155|   203k|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) {
  156|   203k|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  157|   203k|                    return nullptr;
  158|   203k|                }
  159|       |
  160|       |                /* Mark pending request and emit it */
  161|   203k|                httpResponseData->state = HttpResponseData<SSL>::HTTP_RESPONSE_PENDING;
  162|       |
  163|       |                /* Mark this response as connectionClose if ancient or connection: close */
  164|   203k|                if (httpRequest->isAncient() || httpRequest->getHeader("connection").length() == 5) {
  165|   203k|                    httpResponseData->state |= HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE;
  166|   203k|                }
  167|       |
  168|       |                /* Select the router based on SNI (only possible for SSL) */
  169|   203k|                auto *selectedRouter = &httpContextData->router;
  170|   203k|                if constexpr (SSL) {
  171|   203k|                    void *domainRouter = us_socket_server_name_userdata(SSL, (struct us_socket_t *) s);
  172|   203k|                    if (domainRouter) {
  173|   203k|                        selectedRouter = (decltype(selectedRouter)) domainRouter;
  174|   203k|                    }
  175|   203k|                }
  176|       |
  177|       |                /* Route the method and URL */
  178|   203k|                selectedRouter->getUserData() = {(HttpResponse<SSL> *) s, httpRequest};
  179|   203k|                if (!selectedRouter->route(httpRequest->getCaseSensitiveMethod(), httpRequest->getUrl())) {
  180|       |                    /* We have to force close this socket as we have no handler for it */
  181|   203k|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  182|   203k|                    return nullptr;
  183|   203k|                }
  184|       |
  185|       |                /* First of all we need to check if this socket was deleted due to upgrade */
  186|   203k|                if (httpContextData->upgradedWebSocket) {
  187|       |                    /* We differ between closed and upgraded below */
  188|   203k|                    return nullptr;
  189|   203k|                }
  190|       |
  191|       |                /* Was the socket closed? */
  192|   203k|                if (us_socket_is_closed(SSL, (struct us_socket_t *) s)) {
  193|   203k|                    return nullptr;
  194|   203k|                }
  195|       |
  196|       |                /* We absolutely have to terminate parsing if shutdown */
  197|   203k|                if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  198|   203k|                    return nullptr;
  199|   203k|                }
  200|       |
  201|       |                /* Returning from a request handler without responding or attaching an onAborted handler is ill-use */
  202|   203k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && !httpResponseData->onAborted) {
  203|       |                    /* Throw exception here? */
  204|   203k|                    std::cerr << "Error: Returning from a request handler without responding or attaching an abort handler is forbidden!" << std::endl;
  205|   203k|                    std::terminate();
  206|   203k|                }
  207|       |
  208|       |                /* If we have not responded and we have a data handler, we need to timeout to enfore client sending the data */
  209|   203k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && httpResponseData->inStream) {
  210|   203k|                    us_socket_timeout(SSL, (us_socket_t *) s, HTTP_IDLE_TIMEOUT_S);
  211|   203k|                }
  212|       |
  213|       |                /* Continue parsing */
  214|   203k|                return s;
  215|       |
  216|   203k|            }, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
  217|       |                /* We always get an empty chunk even if there is no data */
  218|   203k|                if (httpResponseData->inStream) {
  219|       |
  220|       |                    /* Todo: can this handle timeout for non-post as well? */
  221|   203k|                    if (fin) {
  222|       |                        /* If we just got the last chunk (or empty chunk), disable timeout */
  223|   203k|                        us_socket_timeout(SSL, (struct us_socket_t *) user, 0);
  224|   203k|                    } else {
  225|       |                        /* We still have some more data coming in later, so reset timeout */
  226|       |                        /* Only reset timeout if we got enough bytes (16kb/sec) since last time we reset here */
  227|   203k|                        httpResponseData->received_bytes_per_timeout += (unsigned int) data.length();
  228|   203k|                        if (httpResponseData->received_bytes_per_timeout >= HTTP_RECEIVE_THROUGHPUT_BYTES * HTTP_IDLE_TIMEOUT_S) {
  229|   203k|                            us_socket_timeout(SSL, (struct us_socket_t *) user, HTTP_IDLE_TIMEOUT_S);
  230|   203k|                            httpResponseData->received_bytes_per_timeout = 0;
  231|   203k|                        }
  232|   203k|                    }
  233|       |
  234|       |                    /* We might respond in the handler, so do not change timeout after this */
  235|   203k|                    httpResponseData->inStream(data, fin);
  236|       |
  237|       |                    /* Was the socket closed? */
  238|   203k|                    if (us_socket_is_closed(SSL, (struct us_socket_t *) user)) {
  239|   203k|                        return nullptr;
  240|   203k|                    }
  241|       |
  242|       |                    /* We absolutely have to terminate parsing if shutdown */
  243|   203k|                    if (us_socket_is_shut_down(SSL, (us_socket_t *) user)) {
  244|   203k|                        return nullptr;
  245|   203k|                    }
  246|       |
  247|       |                    /* If we were given the last data chunk, reset data handler to ensure following
  248|       |                     * requests on the same socket won't trigger any previously registered behavior */
  249|   203k|                    if (fin) {
  250|   203k|                        httpResponseData->inStream = nullptr;
  251|   203k|                    }
  252|   203k|                }
  253|   203k|                return user;
  254|   203k|            });
  255|       |
  256|       |            /* Mark that we are no longer parsing Http */
  257|   203k|            httpContextData->isParsingHttp = false;
  258|       |
  259|       |            /* If we got fullptr that means the parser wants us to close the socket from error (same as calling the errorHandler) */
  260|   203k|            if (returnedSocket == FULLPTR) {
  ------------------
  |  Branch (260:17): [True: 89.1k, False: 114k]
  ------------------
  261|       |                /* For errors, we only deliver them "at most once". We don't care if they get halfways delivered or not. */
  262|  89.1k|                us_socket_write(SSL, s, httpErrorResponses[err].data(), (int) httpErrorResponses[err].length(), false);
  263|  89.1k|                us_socket_shutdown(SSL, s);
  264|       |                /* Close any socket on HTTP errors */
  265|  89.1k|                us_socket_close(SSL, s, 0, nullptr);
  266|       |                /* This just makes the following code act as if the socket was closed from error inside the parser. */
  267|  89.1k|                returnedSocket = nullptr;
  268|  89.1k|            }
  269|       |
  270|       |            /* We need to uncork in all cases, except for nullptr (closed socket, or upgraded socket) */
  271|   203k|            if (returnedSocket != nullptr) {
  ------------------
  |  Branch (271:17): [True: 72.3k, False: 131k]
  ------------------
  272|       |                /* Timeout on uncork failure */
  273|  72.3k|                auto [written, failed] = ((AsyncSocket<SSL> *) returnedSocket)->uncork();
  274|  72.3k|                if (failed) {
  ------------------
  |  Branch (274:21): [True: 43.2k, False: 29.1k]
  ------------------
  275|       |                    /* All Http sockets timeout by this, and this behavior match the one in HttpResponse::cork */
  276|       |                    /* Warning: both HTTP_IDLE_TIMEOUT_S and HTTP_TIMEOUT_S are 10 seconds and both are used the same */
  277|  43.2k|                    ((AsyncSocket<SSL> *) s)->timeout(HTTP_IDLE_TIMEOUT_S);
  278|  43.2k|                }
  279|       |
  280|       |                /* We need to check if we should close this socket here now */
  281|  72.3k|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (281:21): [True: 1.17k, False: 71.2k]
  ------------------
  282|  1.17k|                    if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (282:25): [True: 970, False: 203]
  ------------------
  283|    970|                        if (((AsyncSocket<SSL> *) s)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (283:29): [True: 194, False: 776]
  ------------------
  284|    194|                            ((AsyncSocket<SSL> *) s)->shutdown();
  285|       |                            /* We need to force close after sending FIN since we want to hinder
  286|       |                             * clients from keeping to send their huge data */
  287|    194|                            ((AsyncSocket<SSL> *) s)->close();
  288|    194|                        }
  289|    970|                    }
  290|  1.17k|                }
  291|       |
  292|  72.3k|                return (us_socket_t *) returnedSocket;
  293|  72.3k|            }
  294|       |
  295|       |            /* If we upgraded, check here (differ between nullptr close and nullptr upgrade) */
  296|   131k|            if (httpContextData->upgradedWebSocket) {
  ------------------
  |  Branch (296:17): [True: 40.4k, False: 90.6k]
  ------------------
  297|       |                /* This path is only for upgraded websockets */
  298|  40.4k|                AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) httpContextData->upgradedWebSocket;
  299|       |
  300|       |                /* Uncork here as well (note: what if we failed to uncork and we then pub/sub before we even upgraded?) */
  301|  40.4k|                auto [written, failed] = asyncSocket->uncork();
  302|       |
  303|       |                /* If we succeeded in uncorking, check if we have sent WebSocket FIN */
  304|  40.4k|                if (!failed) {
  ------------------
  |  Branch (304:21): [True: 1.79k, False: 38.6k]
  ------------------
  305|  1.79k|                    WebSocketData *webSocketData = (WebSocketData *) asyncSocket->getAsyncSocketData();
  306|  1.79k|                    if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (306:25): [True: 0, False: 1.79k]
  ------------------
  307|       |                        /* In that case, also send TCP FIN (this is similar to what we have in ws drain handler) */
  308|      0|                        asyncSocket->shutdown();
  309|      0|                    }
  310|  1.79k|                }
  311|       |
  312|       |                /* Reset upgradedWebSocket before we return */
  313|  40.4k|                httpContextData->upgradedWebSocket = nullptr;
  314|       |
  315|       |                /* Return the new upgraded websocket */
  316|  40.4k|                return (us_socket_t *) asyncSocket;
  317|  40.4k|            }
  318|       |
  319|       |            /* It is okay to uncork a closed socket and we need to */
  320|  90.6k|            ((AsyncSocket<SSL> *) s)->uncork();
  321|       |
  322|       |            /* We cannot return nullptr to the underlying stack in any case */
  323|  90.6k|            return s;
  324|   131k|        });
_ZZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clES3_S4_iENKUlPvPNS_11HttpRequestEE_clES6_S8_:
  143|  67.8k|            auto [err, returnedSocket] = httpResponseData->consumePostPadded(data, (unsigned int) length, s, proxyParser, [httpContextData](void *s, HttpRequest *httpRequest) -> void * {
  144|       |                /* For every request we reset the timeout and hang until user makes action */
  145|       |                /* Warning: if we are in shutdown state, resetting the timer is a security issue! */
  146|  67.8k|                us_socket_timeout(SSL, (us_socket_t *) s, 0);
  147|       |
  148|       |                /* Reset httpResponse */
  149|  67.8k|                HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) us_socket_ext(SSL, (us_socket_t *) s);
  150|  67.8k|                httpResponseData->offset = 0;
  151|       |
  152|       |                /* Are we not ready for another request yet? Terminate the connection.
  153|       |                 * Important for denying async pipelining until, if ever, we want to suppot it.
  154|       |                 * Otherwise requests can get mixed up on the same connection. We still support sync pipelining. */
  155|  67.8k|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) {
  ------------------
  |  Branch (155:21): [True: 556, False: 67.2k]
  ------------------
  156|    556|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  157|    556|                    return nullptr;
  158|    556|                }
  159|       |
  160|       |                /* Mark pending request and emit it */
  161|  67.2k|                httpResponseData->state = HttpResponseData<SSL>::HTTP_RESPONSE_PENDING;
  162|       |
  163|       |                /* Mark this response as connectionClose if ancient or connection: close */
  164|  67.2k|                if (httpRequest->isAncient() || httpRequest->getHeader("connection").length() == 5) {
  ------------------
  |  Branch (164:21): [True: 0, False: 67.2k]
  |  Branch (164:21): [True: 2.65k, False: 64.5k]
  |  Branch (164:49): [True: 2.65k, False: 64.5k]
  ------------------
  165|  2.65k|                    httpResponseData->state |= HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE;
  166|  2.65k|                }
  167|       |
  168|       |                /* Select the router based on SNI (only possible for SSL) */
  169|  67.2k|                auto *selectedRouter = &httpContextData->router;
  170|       |                if constexpr (SSL) {
  171|       |                    void *domainRouter = us_socket_server_name_userdata(SSL, (struct us_socket_t *) s);
  172|       |                    if (domainRouter) {
  173|       |                        selectedRouter = (decltype(selectedRouter)) domainRouter;
  174|       |                    }
  175|       |                }
  176|       |
  177|       |                /* Route the method and URL */
  178|  67.2k|                selectedRouter->getUserData() = {(HttpResponse<SSL> *) s, httpRequest};
  179|  67.2k|                if (!selectedRouter->route(httpRequest->getCaseSensitiveMethod(), httpRequest->getUrl())) {
  ------------------
  |  Branch (179:21): [True: 0, False: 67.2k]
  ------------------
  180|       |                    /* We have to force close this socket as we have no handler for it */
  181|      0|                    us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  182|      0|                    return nullptr;
  183|      0|                }
  184|       |
  185|       |                /* First of all we need to check if this socket was deleted due to upgrade */
  186|  67.2k|                if (httpContextData->upgradedWebSocket) {
  ------------------
  |  Branch (186:21): [True: 40.4k, False: 26.7k]
  ------------------
  187|       |                    /* We differ between closed and upgraded below */
  188|  40.4k|                    return nullptr;
  189|  40.4k|                }
  190|       |
  191|       |                /* Was the socket closed? */
  192|  26.7k|                if (us_socket_is_closed(SSL, (struct us_socket_t *) s)) {
  ------------------
  |  Branch (192:21): [True: 953, False: 25.8k]
  ------------------
  193|    953|                    return nullptr;
  194|    953|                }
  195|       |
  196|       |                /* We absolutely have to terminate parsing if shutdown */
  197|  25.8k|                if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  ------------------
  |  Branch (197:21): [True: 0, False: 25.8k]
  ------------------
  198|      0|                    return nullptr;
  199|      0|                }
  200|       |
  201|       |                /* Returning from a request handler without responding or attaching an onAborted handler is ill-use */
  202|  25.8k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && !httpResponseData->onAborted) {
  ------------------
  |  Branch (202:21): [True: 4.44k, False: 21.3k]
  |  Branch (202:67): [True: 0, False: 4.44k]
  ------------------
  203|       |                    /* Throw exception here? */
  204|      0|                    std::cerr << "Error: Returning from a request handler without responding or attaching an abort handler is forbidden!" << std::endl;
  205|      0|                    std::terminate();
  206|      0|                }
  207|       |
  208|       |                /* If we have not responded and we have a data handler, we need to timeout to enfore client sending the data */
  209|  25.8k|                if (!((HttpResponse<SSL> *) s)->hasResponded() && httpResponseData->inStream) {
  ------------------
  |  Branch (209:21): [True: 4.44k, False: 21.3k]
  |  Branch (209:67): [True: 4.44k, False: 0]
  ------------------
  210|  4.44k|                    us_socket_timeout(SSL, (us_socket_t *) s, HTTP_IDLE_TIMEOUT_S);
  211|  4.44k|                }
  212|       |
  213|       |                /* Continue parsing */
  214|  25.8k|                return s;
  215|       |
  216|  25.8k|            }, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
_ZZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clES3_S4_iENKUlPvNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEbE_clES6_SB_b:
  216|  55.0k|            }, [httpResponseData](void *user, std::string_view data, bool fin) -> void * {
  217|       |                /* We always get an empty chunk even if there is no data */
  218|  55.0k|                if (httpResponseData->inStream) {
  ------------------
  |  Branch (218:21): [True: 33.5k, False: 21.4k]
  ------------------
  219|       |
  220|       |                    /* Todo: can this handle timeout for non-post as well? */
  221|  33.5k|                    if (fin) {
  ------------------
  |  Branch (221:25): [True: 1.43k, False: 32.1k]
  ------------------
  222|       |                        /* If we just got the last chunk (or empty chunk), disable timeout */
  223|  1.43k|                        us_socket_timeout(SSL, (struct us_socket_t *) user, 0);
  224|  32.1k|                    } else {
  225|       |                        /* We still have some more data coming in later, so reset timeout */
  226|       |                        /* Only reset timeout if we got enough bytes (16kb/sec) since last time we reset here */
  227|  32.1k|                        httpResponseData->received_bytes_per_timeout += (unsigned int) data.length();
  228|  32.1k|                        if (httpResponseData->received_bytes_per_timeout >= HTTP_RECEIVE_THROUGHPUT_BYTES * HTTP_IDLE_TIMEOUT_S) {
  ------------------
  |  Branch (228:29): [True: 11, False: 32.1k]
  ------------------
  229|     11|                            us_socket_timeout(SSL, (struct us_socket_t *) user, HTTP_IDLE_TIMEOUT_S);
  230|     11|                            httpResponseData->received_bytes_per_timeout = 0;
  231|     11|                        }
  232|  32.1k|                    }
  233|       |
  234|       |                    /* We might respond in the handler, so do not change timeout after this */
  235|  33.5k|                    httpResponseData->inStream(data, fin);
  236|       |
  237|       |                    /* Was the socket closed? */
  238|  33.5k|                    if (us_socket_is_closed(SSL, (struct us_socket_t *) user)) {
  ------------------
  |  Branch (238:25): [True: 0, False: 33.5k]
  ------------------
  239|      0|                        return nullptr;
  240|      0|                    }
  241|       |
  242|       |                    /* We absolutely have to terminate parsing if shutdown */
  243|  33.5k|                    if (us_socket_is_shut_down(SSL, (us_socket_t *) user)) {
  ------------------
  |  Branch (243:25): [True: 0, False: 33.5k]
  ------------------
  244|      0|                        return nullptr;
  245|      0|                    }
  246|       |
  247|       |                    /* If we were given the last data chunk, reset data handler to ensure following
  248|       |                     * requests on the same socket won't trigger any previously registered behavior */
  249|  33.5k|                    if (fin) {
  ------------------
  |  Branch (249:25): [True: 1.43k, False: 32.1k]
  ------------------
  250|  1.43k|                        httpResponseData->inStream = nullptr;
  251|  1.43k|                    }
  252|  33.5k|                }
  253|  55.0k|                return user;
  254|  55.0k|            });
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tE_clES3_:
  327|  32.1k|        us_socket_context_on_writable(SSL, getSocketContext(), [](us_socket_t *s) {
  328|       |
  329|  32.1k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  330|  32.1k|            HttpResponseData<SSL> *httpResponseData = (HttpResponseData<SSL> *) asyncSocket->getAsyncSocketData();
  331|       |
  332|       |            /* Ask the developer to write data and return success (true) or failure (false), OR skip sending anything and return success (true). */
  333|  32.1k|            if (httpResponseData->onWritable) {
  ------------------
  |  Branch (333:17): [True: 0, False: 32.1k]
  ------------------
  334|       |                /* We are now writable, so hang timeout again, the user does not have to do anything so we should hang until end or tryEnd rearms timeout */
  335|      0|                us_socket_timeout(SSL, s, 0);
  336|       |
  337|       |                /* We expect the developer to return whether or not write was successful (true).
  338|       |                 * If write was never called, the developer should still return true so that we may drain. */
  339|      0|                bool success = httpResponseData->callOnWritable(httpResponseData->offset);
  340|       |
  341|       |                /* The developer indicated that their onWritable failed. */
  342|      0|                if (!success) {
  ------------------
  |  Branch (342:21): [True: 0, False: 0]
  ------------------
  343|       |                    /* Skip testing if we can drain anything since that might perform an extra syscall */
  344|      0|                    return s;
  345|      0|                }
  346|       |
  347|       |                /* We don't want to fall through since we don't want to mess with timeout.
  348|       |                 * It makes little sense to drain any backpressure when the user has registered onWritable. */
  349|      0|                return s;
  350|      0|            }
  351|       |
  352|       |            /* Drain any socket buffer, this might empty our backpressure and thus finish the request */
  353|  32.1k|            /*auto [written, failed] = */asyncSocket->write(nullptr, 0, true, 0);
  354|       |
  355|       |            /* Should we close this connection after a response - and is this response really done? */
  356|  32.1k|            if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (356:17): [True: 898, False: 31.2k]
  ------------------
  357|    898|                if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (357:21): [True: 703, False: 195]
  ------------------
  358|    703|                    if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (358:25): [True: 195, False: 508]
  ------------------
  359|    195|                        asyncSocket->shutdown();
  360|       |                        /* We need to force close after sending FIN since we want to hinder
  361|       |                         * clients from keeping to send their huge data */
  362|    195|                        asyncSocket->close();
  363|    195|                    }
  364|    703|                }
  365|    898|            }
  366|       |
  367|       |            /* Expect another writable event, or another request within the timeout */
  368|  32.1k|            asyncSocket->timeout(HTTP_IDLE_TIMEOUT_S);
  369|       |
  370|  32.1k|            return s;
  371|  32.1k|        });
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tE0_clES3_:
  374|  26.9k|        us_socket_context_on_end(SSL, getSocketContext(), [](us_socket_t *s) {
  375|       |
  376|       |            /* We do not care for half closed sockets */
  377|  26.9k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  378|  26.9k|            return asyncSocket->close();
  379|       |
  380|  26.9k|        });
_ZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tE1_clES3_:
  383|  6.04k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](us_socket_t *s) {
  384|       |
  385|       |            /* Force close rather than gracefully shutdown and risk confusing the client with a complete download */
  386|  6.04k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  387|  6.04k|            return asyncSocket->close();
  388|       |
  389|  6.04k|        });
_ZN3uWS11HttpContextILb0EE4freeEv:
  411|  6.94k|    void free() {
  412|       |        /* Destruct socket context data */
  413|  6.94k|        HttpContextData<SSL> *httpContextData = getSocketContextData();
  414|  6.94k|        httpContextData->~HttpContextData<SSL>();
  415|       |
  416|       |        /* Free the socket context in whole */
  417|  6.94k|        us_socket_context_free(SSL, getSocketContext());
  418|  6.94k|    }
_ZN3uWS11HttpContextILb0EE20getSocketContextDataEv:
   61|  96.0k|    HttpContextData<SSL> *getSocketContextData() {
   62|  96.0k|        return (HttpContextData<SSL> *) us_socket_context_ext(SSL, getSocketContext());
   63|  96.0k|    }
_ZN3uWS11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_ON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEEb:
  425|  41.6k|    void onHttp(std::string method, std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler, bool upgrade = false) {
  426|  41.6k|        HttpContextData<SSL> *httpContextData = getSocketContextData();
  427|       |
  428|       |        /* Todo: This is ugly, fix */
  429|  41.6k|        std::vector<std::string> methods;
  430|  41.6k|        if (method == "*") {
  ------------------
  |  Branch (430:13): [True: 13.8k, False: 27.7k]
  ------------------
  431|  13.8k|            methods = {"*"};
  432|  27.7k|        } else {
  433|  27.7k|            methods = {method};
  434|  27.7k|        }
  435|       |
  436|  41.6k|        uint32_t priority = method == "*" ? httpContextData->currentRouter->LOW_PRIORITY : (upgrade ? httpContextData->currentRouter->HIGH_PRIORITY : httpContextData->currentRouter->MEDIUM_PRIORITY);
  ------------------
  |  Branch (436:29): [True: 13.8k, False: 27.7k]
  |  Branch (436:93): [True: 13.8k, False: 13.8k]
  ------------------
  437|       |
  438|       |        /* If we are passed nullptr then remove this */
  439|  41.6k|        if (!handler) {
  ------------------
  |  Branch (439:13): [True: 0, False: 41.6k]
  ------------------
  440|      0|            httpContextData->currentRouter->remove(methods[0], pattern, priority);
  441|      0|            return;
  442|      0|        }
  443|       |
  444|       |        /* Record this route's parameter offsets */
  445|  41.6k|        std::map<std::string, unsigned short, std::less<>> parameterOffsets;
  446|  41.6k|        unsigned short offset = 0;
  447|   159k|        for (unsigned int i = 0; i < pattern.length(); i++) {
  ------------------
  |  Branch (447:34): [True: 118k, False: 41.6k]
  ------------------
  448|   118k|            if (pattern[i] == ':') {
  ------------------
  |  Branch (448:17): [True: 6.94k, False: 111k]
  ------------------
  449|  6.94k|                i++;
  450|  6.94k|                unsigned int start = i;
  451|  41.6k|                while (i < pattern.length() && pattern[i] != '/') {
  ------------------
  |  Branch (451:24): [True: 41.6k, False: 0]
  |  Branch (451:48): [True: 34.7k, False: 6.94k]
  ------------------
  452|  34.7k|                    i++;
  453|  34.7k|                }
  454|  6.94k|                parameterOffsets[std::string(pattern.data() + start, i - start)] = offset;
  455|       |                //std::cout << "<" << std::string(pattern.data() + start, i - start) << "> is offset " << offset;
  456|  6.94k|                offset++;
  457|  6.94k|            }
  458|   118k|        }
  459|       |
  460|  41.6k|        httpContextData->currentRouter->add(methods, pattern, [handler = std::move(handler), parameterOffsets = std::move(parameterOffsets)](auto *r) mutable {
  461|  41.6k|            auto user = r->getUserData();
  462|  41.6k|            user.httpRequest->setYield(false);
  463|  41.6k|            user.httpRequest->setParameters(r->getParameters());
  464|  41.6k|            user.httpRequest->setParameterOffsets(&parameterOffsets);
  465|       |
  466|       |            /* Middleware? Automatically respond to expectations */
  467|  41.6k|            std::string_view expect = user.httpRequest->getHeader("expect");
  468|  41.6k|            if (expect.length() && expect == "100-continue") {
  469|  41.6k|                user.httpResponse->writeContinue();
  470|  41.6k|            }
  471|       |
  472|  41.6k|            handler(user.httpResponse, user.httpRequest);
  473|       |
  474|       |            /* If any handler yielded, the router will keep looking for a suitable handler. */
  475|  41.6k|            if (user.httpRequest->getYield()) {
  476|  41.6k|                return false;
  477|  41.6k|            }
  478|  41.6k|            return true;
  479|  41.6k|        }, priority);
  480|  41.6k|    }
_ZZN3uWS11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_ON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEEbENUlPT_E_clINS_10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEEEEEDaSK_:
  460|  79.4k|        httpContextData->currentRouter->add(methods, pattern, [handler = std::move(handler), parameterOffsets = std::move(parameterOffsets)](auto *r) mutable {
  461|  79.4k|            auto user = r->getUserData();
  462|  79.4k|            user.httpRequest->setYield(false);
  463|  79.4k|            user.httpRequest->setParameters(r->getParameters());
  464|  79.4k|            user.httpRequest->setParameterOffsets(&parameterOffsets);
  465|       |
  466|       |            /* Middleware? Automatically respond to expectations */
  467|  79.4k|            std::string_view expect = user.httpRequest->getHeader("expect");
  468|  79.4k|            if (expect.length() && expect == "100-continue") {
  ------------------
  |  Branch (468:17): [True: 1.14k, False: 78.3k]
  |  Branch (468:36): [True: 532, False: 613]
  ------------------
  469|    532|                user.httpResponse->writeContinue();
  470|    532|            }
  471|       |
  472|  79.4k|            handler(user.httpResponse, user.httpRequest);
  473|       |
  474|       |            /* If any handler yielded, the router will keep looking for a suitable handler. */
  475|  79.4k|            if (user.httpRequest->getYield()) {
  ------------------
  |  Branch (475:17): [True: 12.1k, False: 67.2k]
  ------------------
  476|  12.1k|                return false;
  477|  12.1k|            }
  478|  67.2k|            return true;
  479|  79.4k|        }, priority);
_ZN3uWS11HttpContextILb0EE6listenEPKcii:
  483|  6.94k|    us_listen_socket_t *listen(const char *host, int port, int options) {
  484|  6.94k|        return us_socket_context_listen(SSL, getSocketContext(), host, port, options, sizeof(HttpResponseData<SSL>));
  485|  6.94k|    }

_ZN3uWS12optional_ptrIcEENSt3__18optionalIPT_EES4_:
   47|      2|std::optional<T *> optional_ptr(T *ptr) {
   48|      2|    return ptr ? std::optional<T *>(ptr) : std::nullopt;
  ------------------
  |  Branch (48:12): [True: 0, False: 2]
  ------------------
   49|      2|}
_ZN3uWS10HttpParser17consumePostPaddedEPcjPvS2_ON5ofats13any_invocableIFS2_S2_PNS_11HttpRequestEEEEONS4_IFS2_S2_NSt3__117basic_string_viewIcNSA_11char_traitsIcEEEEbEEE:
  618|   203k|    std::pair<unsigned int, void *> consumePostPadded(char *data, unsigned int length, void *user, void *reserved, MoveOnlyFunction<void *(void *, HttpRequest *)> &&requestHandler, MoveOnlyFunction<void *(void *, std::string_view, bool)> &&dataHandler) {
  619|       |
  620|       |        /* This resets BloomFilter by construction, but later we also reset it again.
  621|       |         * Optimize this to skip resetting twice (req could be made global) */
  622|   203k|        HttpRequest req;
  623|       |
  624|   203k|        if (remainingStreamingBytes) {
  ------------------
  |  Branch (624:13): [True: 34.0k, False: 169k]
  ------------------
  625|       |
  626|       |            /* It's either chunked or with a content-length */
  627|  34.0k|            if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (627:17): [True: 33.2k, False: 828]
  ------------------
  628|  33.2k|                std::string_view dataToConsume(data, length);
  629|  33.2k|                for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (629:33): [True: 32.3k, False: 33.2k]
  ------------------
  630|  32.3k|                    dataHandler(user, chunk, chunk.length() == 0);
  631|  32.3k|                }
  632|  33.2k|                if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (632:21): [True: 259, False: 32.9k]
  ------------------
  633|    259|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  634|    259|                }
  635|  32.9k|                data = (char *) dataToConsume.data();
  636|  32.9k|                length = (unsigned int) dataToConsume.length();
  637|  32.9k|            } else {
  638|       |                // this is exactly the same as below!
  639|       |                // todo: refactor this
  640|    828|                if (remainingStreamingBytes >= length) {
  ------------------
  |  Branch (640:21): [True: 630, False: 198]
  ------------------
  641|    630|                    void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
  642|    630|                    remainingStreamingBytes -= length;
  643|    630|                    return {0, returnedUser};
  644|    630|                } else {
  645|    198|                    void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  646|       |
  647|    198|                    data += (unsigned int) remainingStreamingBytes;
  648|    198|                    length -= (unsigned int) remainingStreamingBytes;
  649|       |
  650|    198|                    remainingStreamingBytes = 0;
  651|       |
  652|    198|                    if (returnedUser != user) {
  ------------------
  |  Branch (652:25): [True: 0, False: 198]
  ------------------
  653|      0|                        return {0, returnedUser};
  654|      0|                    }
  655|    198|                }
  656|    828|            }
  657|       |
  658|   169k|        } else if (fallback.length()) {
  ------------------
  |  Branch (658:20): [True: 22.0k, False: 147k]
  ------------------
  659|  22.0k|            unsigned int had = (unsigned int) fallback.length();
  660|       |
  661|  22.0k|            size_t maxCopyDistance = std::min<size_t>(MAX_FALLBACK_SIZE - fallback.length(), (size_t) length);
  662|       |
  663|       |            /* We don't want fallback to be short string optimized, since we want to move it */
  664|  22.0k|            fallback.reserve(fallback.length() + maxCopyDistance + std::max<unsigned int>(MINIMUM_HTTP_POST_PADDING, sizeof(std::string)));
  665|  22.0k|            fallback.append(data, maxCopyDistance);
  666|       |
  667|       |            // break here on break
  668|  22.0k|            std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<true>(fallback.data(), (unsigned int) fallback.length(), user, reserved, &req, requestHandler, dataHandler);
  669|  22.0k|            if (consumed.second != user) {
  ------------------
  |  Branch (669:17): [True: 6.12k, False: 15.8k]
  ------------------
  670|  6.12k|                return consumed;
  671|  6.12k|            }
  672|       |
  673|  15.8k|            if (consumed.first) {
  ------------------
  |  Branch (673:17): [True: 3.47k, False: 12.3k]
  ------------------
  674|       |
  675|       |                /* This logic assumes that we consumed everything in fallback buffer.
  676|       |                 * This is critically important, as we will get an integer overflow in case
  677|       |                 * of "had" being larger than what we consumed, and that we would drop data */
  678|  3.47k|                fallback.clear();
  679|  3.47k|                data += consumed.first - had;
  680|  3.47k|                length -= consumed.first - had;
  681|       |
  682|  3.47k|                if (remainingStreamingBytes) {
  ------------------
  |  Branch (682:21): [True: 1.46k, False: 2.01k]
  ------------------
  683|       |                    /* It's either chunked or with a content-length */
  684|  1.46k|                    if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (684:25): [True: 618, False: 843]
  ------------------
  685|    618|                        std::string_view dataToConsume(data, length);
  686|    618|                        for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (686:41): [True: 539, False: 618]
  ------------------
  687|    539|                            dataHandler(user, chunk, chunk.length() == 0);
  688|    539|                        }
  689|    618|                        if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (689:29): [True: 196, False: 422]
  ------------------
  690|    196|                            return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  691|    196|                        }
  692|    422|                        data = (char *) dataToConsume.data();
  693|    422|                        length = (unsigned int) dataToConsume.length();
  694|    843|                    } else {
  695|       |                        // this is exactly the same as above!
  696|    843|                        if (remainingStreamingBytes >= (unsigned int) length) {
  ------------------
  |  Branch (696:29): [True: 645, False: 198]
  ------------------
  697|    645|                            void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
  698|    645|                            remainingStreamingBytes -= length;
  699|    645|                            return {0, returnedUser};
  700|    645|                        } else {
  701|    198|                            void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  702|       |
  703|    198|                            data += (unsigned int) remainingStreamingBytes;
  704|    198|                            length -= (unsigned int) remainingStreamingBytes;
  705|       |
  706|    198|                            remainingStreamingBytes = 0;
  707|       |
  708|    198|                            if (returnedUser != user) {
  ------------------
  |  Branch (708:33): [True: 0, False: 198]
  ------------------
  709|      0|                                return {0, returnedUser};
  710|      0|                            }
  711|    198|                        }
  712|    843|                    }
  713|  1.46k|                }
  714|       |
  715|  12.3k|            } else {
  716|  12.3k|                if (fallback.length() == MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (716:21): [True: 195, False: 12.2k]
  ------------------
  717|    195|                    return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  718|    195|                }
  719|  12.2k|                return {0, user};
  720|  12.3k|            }
  721|  15.8k|        }
  722|       |
  723|   183k|        std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<false>(data, length, user, reserved, &req, requestHandler, dataHandler);
  724|   183k|        if (consumed.second != user) {
  ------------------
  |  Branch (724:13): [True: 124k, False: 58.9k]
  ------------------
  725|   124k|            return consumed;
  726|   124k|        }
  727|       |
  728|  58.9k|        data += consumed.first;
  729|  58.9k|        length -= consumed.first;
  730|       |
  731|  58.9k|        if (length) {
  ------------------
  |  Branch (731:13): [True: 20.9k, False: 37.9k]
  ------------------
  732|  20.9k|            if (length < MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (732:17): [True: 20.9k, False: 0]
  ------------------
  733|  20.9k|                fallback.append(data, length);
  734|  20.9k|            } else {
  735|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  736|      0|            }
  737|  20.9k|        }
  738|       |
  739|       |        // added for now
  740|  58.9k|        return {0, user};
  741|  58.9k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi1EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  477|  22.0k|    std::pair<unsigned int, void *> fenceAndConsumePostPadded(char *data, unsigned int length, void *user, void *reserved, HttpRequest *req, MoveOnlyFunction<void *(void *, HttpRequest *)> &requestHandler, MoveOnlyFunction<void *(void *, std::string_view, bool)> &dataHandler) {
  478|       |
  479|       |        /* How much data we CONSUMED (to throw away) */
  480|  22.0k|        unsigned int consumedTotal = 0;
  481|  22.0k|        unsigned int err = 0;
  482|       |
  483|       |        /* Fence two bytes past end of our buffer (buffer has post padded margins).
  484|       |         * This is to always catch scan for \r but not for \r\n. */
  485|  22.0k|        data[length] = '\r';
  486|  22.0k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  487|       |
  488|  22.0k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (488:37): [True: 22.0k, False: 0]
  |  Branch (488:47): [True: 8.11k, False: 13.8k]
  ------------------
  489|  8.11k|            data += consumed;
  490|  8.11k|            length -= consumed;
  491|  8.11k|            consumedTotal += consumed;
  492|       |
  493|       |            /* Even if we could parse it, check for length here as well */
  494|  8.11k|            if (consumed > MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (494:17): [True: 0, False: 8.11k]
  ------------------
  495|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  496|      0|            }
  497|       |
  498|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  499|  8.11k|            req->ancientHttp = false;
  500|       |
  501|       |            /* Add all headers to bloom filter */
  502|  8.11k|            req->bf.reset();
  503|  34.2k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (503:57): [True: 26.4k, False: 7.80k]
  ------------------
  504|  26.4k|                if (req->bf.mightHave(h->key)) [[unlikely]] {
  ------------------
  |  Branch (504:21): [True: 3.23k, False: 23.2k]
  ------------------
  505|       |                    /* Host header is not allowed twice */
  506|  3.23k|                    if (h->key == "host" && req->getHeader("host").data()) {
  ------------------
  |  Branch (506:25): [True: 314, False: 2.91k]
  |  Branch (506:25): [True: 314, False: 2.91k]
  |  Branch (506:45): [True: 314, False: 0]
  ------------------
  507|    314|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  508|    314|                    }
  509|  3.23k|                }
  510|  26.1k|                req->bf.add(h->key);
  511|  26.1k|            }
  512|       |            
  513|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  514|  7.80k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (514:17): [True: 1.03k, False: 6.77k]
  ------------------
  515|  1.03k|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  516|  1.03k|            }
  517|       |
  518|       |            /* RFC 9112 6.3
  519|       |            * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  520|       |            * the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt
  521|       |            * to perform request smuggling (Section 11.2) or response splitting (Section 11.1) and
  522|       |            * ought to be handled as an error. */
  523|  6.77k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  524|  6.77k|            std::string_view contentLengthString = req->getHeader("content-length");
  525|  6.77k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (525:17): [True: 865, False: 5.90k]
  |  Branch (525:52): [True: 244, False: 621]
  ------------------
  526|       |                /* Returning fullptr is the same as calling the errorHandler */
  527|       |                /* We could be smart and set an error in the context along with this, to indicate what 
  528|       |                 * http error response we might want to return */
  529|    244|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  530|    244|            }
  531|       |
  532|       |            /* Parse query */
  533|  6.52k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  534|  6.52k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (534:52): [True: 508, False: 6.02k]
  ------------------
  535|       |
  536|       |            /* If returned socket is not what we put in we need
  537|       |             * to break here as we either have upgraded to
  538|       |             * WebSockets or otherwise closed the socket. */
  539|  6.52k|            void *returnedUser = requestHandler(user, req);
  540|  6.52k|            if (returnedUser != user) {
  ------------------
  |  Branch (540:17): [True: 2.62k, False: 3.89k]
  ------------------
  541|       |                /* We are upgraded to WebSocket or otherwise broken */
  542|  2.62k|                return {consumedTotal, returnedUser};
  543|  2.62k|            }
  544|       |
  545|       |            /* The rules at play here according to RFC 9112 for requests are essentially:
  546|       |             * If both content-length and transfer-encoding then invalid message; must break.
  547|       |             * If has transfer-encoding then must be chunked regardless of value.
  548|       |             * If content-length then fixed length even if 0.
  549|       |             * If none of the above then fixed length is 0. */
  550|       |
  551|       |            /* RFC 9112 6.3
  552|       |             * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  553|       |             * the Transfer-Encoding overrides the Content-Length. */
  554|  3.89k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (554:17): [True: 618, False: 3.28k]
  ------------------
  555|       |
  556|       |                /* If a proxy sent us the transfer-encoding header that 100% means it must be chunked or else the proxy is
  557|       |                 * not RFC 9112 compliant. Therefore it is always better to assume this is the case, since that entirely eliminates 
  558|       |                 * all forms of transfer-encoding obfuscation tricks. We just rely on the header. */
  559|       |
  560|       |                /* RFC 9112 6.3
  561|       |                 * If a Transfer-Encoding header field is present in a request and the chunked transfer coding is not the
  562|       |                 * final encoding, the message body length cannot be determined reliably; the server MUST respond with the
  563|       |                 * 400 (Bad Request) status code and then close the connection. */
  564|       |
  565|       |                /* In this case we fail later by having the wrong interpretation (assuming chunked).
  566|       |                 * This could be made stricter but makes no difference either way, unless forwarding the identical message as a proxy. */
  567|       |
  568|    618|                remainingStreamingBytes = STATE_IS_CHUNKED;
  569|       |                /* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */
  570|    618|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (570:21): [Folded - Ignored]
  ------------------
  571|       |                    /* Go ahead and parse it (todo: better heuristics for emitting FIN to the app level) */
  572|      0|                    std::string_view dataToConsume(data, length);
  573|      0|                    for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (573:37): [True: 0, False: 0]
  ------------------
  574|      0|                        dataHandler(user, chunk, chunk.length() == 0);
  575|      0|                    }
  576|      0|                    if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (576:25): [True: 0, False: 0]
  ------------------
  577|      0|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  578|      0|                    }
  579|      0|                    unsigned int consumed = (length - (unsigned int) dataToConsume.length());
  580|      0|                    data = (char *) dataToConsume.data();
  581|      0|                    length = (unsigned int) dataToConsume.length();
  582|      0|                    consumedTotal += consumed;
  583|      0|                }
  584|  3.28k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (584:24): [True: 1.86k, False: 1.41k]
  ------------------
  585|  1.86k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  586|  1.86k|                if (remainingStreamingBytes == UINT64_MAX) {
  ------------------
  |  Branch (586:21): [True: 425, False: 1.43k]
  ------------------
  587|       |                    /* Parser error */
  588|    425|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  589|    425|                }
  590|       |
  591|  1.43k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (591:21): [Folded - Ignored]
  ------------------
  592|      0|                    unsigned int emittable = (unsigned int) std::min<uint64_t>(remainingStreamingBytes, length);
  593|      0|                    dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
  594|      0|                    remainingStreamingBytes -= emittable;
  595|       |
  596|      0|                    data += emittable;
  597|      0|                    length -= emittable;
  598|      0|                    consumedTotal += emittable;
  599|      0|                }
  600|  1.43k|            } else {
  601|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  602|  1.41k|                dataHandler(user, {}, true);
  603|  1.41k|            }
  604|       |
  605|       |            /* Consume minimally should break as easrly as possible */
  606|  3.47k|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (606:17): [Folded - Ignored]
  ------------------
  607|  3.47k|                break;
  608|  3.47k|            }
  609|  3.47k|        }
  610|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  611|  17.3k|        if (err) {
  ------------------
  |  Branch (611:13): [True: 1.48k, False: 15.8k]
  ------------------
  612|  1.48k|            return {err, FULLPTR};
  613|  1.48k|        }
  614|  15.8k|        return {consumedTotal, user};
  615|  17.3k|    }
_ZN3uWS10HttpParser10getHeadersEPcS1_PNS_11HttpRequest6HeaderEPvRj:
  356|   186k|    static unsigned int getHeaders(char *postPaddedBuffer, char *end, struct HttpRequest::Header *headers, void *reserved, unsigned int &err) {
  357|   186k|        char *preliminaryKey, *preliminaryValue, *start = postPaddedBuffer;
  358|       |
  359|       |        #ifdef UWS_WITH_PROXY
  360|       |            /* ProxyParser is passed as reserved parameter */
  361|       |            ProxyParser *pp = (ProxyParser *) reserved;
  362|       |
  363|       |            /* Parse PROXY protocol */
  364|       |            auto [done, offset] = pp->parse({postPaddedBuffer, (size_t) (end - postPaddedBuffer)});
  365|       |            if (!done) {
  366|       |                /* We do not reset the ProxyParser (on filure) since it is tied to this
  367|       |                * connection, which is really only supposed to ever get one PROXY frame
  368|       |                * anyways. We do however allow multiple PROXY frames to be sent (overwrites former). */
  369|       |                return 0;
  370|       |            } else {
  371|       |                /* We have consumed this data so skip it */
  372|       |                postPaddedBuffer += offset;
  373|       |            }
  374|       |        #else
  375|       |            /* This one is unused */
  376|   186k|            (void) reserved;
  377|   186k|            (void) end;
  378|   186k|        #endif
  379|       |
  380|       |        /* It is critical for fallback buffering logic that we only return with success
  381|       |         * if we managed to parse a complete HTTP request (minus data). Returning success
  382|       |         * for PROXY means we can end up succeeding, yet leaving bytes in the fallback buffer
  383|       |         * which is then removed, and our counters to flip due to overflow and we end up with a crash */
  384|       |
  385|       |        /* The request line is different from the field names / field values */
  386|   186k|        if ((char *) 2 > (postPaddedBuffer = consumeRequestLine(postPaddedBuffer, end, headers[0]))) {
  ------------------
  |  Branch (386:13): [True: 85.9k, False: 100k]
  ------------------
  387|       |            /* Error - invalid request line */
  388|       |            /* Assuming it is 505 HTTP Version Not Supported */
  389|  85.9k|            err = postPaddedBuffer ? HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED : 0;
  ------------------
  |  Branch (389:19): [True: 76.7k, False: 9.25k]
  ------------------
  390|  85.9k|            return 0;
  391|  85.9k|        }
  392|   100k|        headers++;
  393|       |
  394|   288k|        for (unsigned int i = 1; i < UWS_HTTP_MAX_HEADERS_COUNT - 1; i++) {
  ------------------
  |  |   53|   288k|#define UWS_HTTP_MAX_HEADERS_COUNT 100
  ------------------
  |  Branch (394:34): [True: 287k, False: 194]
  ------------------
  395|       |            /* Lower case and consume the field name */
  396|   287k|            preliminaryKey = postPaddedBuffer;
  397|   287k|            postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
  398|   287k|            headers->key = std::string_view(preliminaryKey, (size_t) (postPaddedBuffer - preliminaryKey));
  399|       |
  400|       |            /* We should not accept whitespace between key and colon, so colon must foloow immediately */
  401|   287k|            if (postPaddedBuffer[0] != ':') {
  ------------------
  |  Branch (401:17): [True: 6.03k, False: 281k]
  ------------------
  402|       |                /* If we stand at the end, we are fragmented */
  403|  6.03k|                if (postPaddedBuffer == end) {
  ------------------
  |  Branch (403:21): [True: 2.84k, False: 3.18k]
  ------------------
  404|  2.84k|                    return 0;
  405|  2.84k|                }
  406|       |                /* Error: invalid chars in field name */
  407|  3.18k|                err = HTTP_ERROR_400_BAD_REQUEST;
  408|  3.18k|                return 0;
  409|  6.03k|            }
  410|   281k|            postPaddedBuffer++;
  411|       |
  412|   281k|            preliminaryValue = postPaddedBuffer;
  413|       |            /* The goal of this call is to find next "\r\n", or any invalid field value chars, fast */
  414|   282k|            while (true) {
  ------------------
  |  Branch (414:20): [Folded - Ignored]
  ------------------
  415|   282k|                postPaddedBuffer = (char *) tryConsumeFieldValue(postPaddedBuffer);
  416|       |                /* If this is not CR then we caught some stinky invalid char on the way */
  417|   282k|                if (postPaddedBuffer[0] != '\r') {
  ------------------
  |  Branch (417:21): [True: 2.78k, False: 279k]
  ------------------
  418|       |                    /* If TAB then keep searching */
  419|  2.78k|                    if (postPaddedBuffer[0] == '\t') {
  ------------------
  |  Branch (419:25): [True: 819, False: 1.96k]
  ------------------
  420|    819|                        postPaddedBuffer++;
  421|    819|                        continue;
  422|    819|                    }
  423|       |                    /* Error - invalid chars in field value */
  424|  1.96k|                    err = HTTP_ERROR_400_BAD_REQUEST;
  425|  1.96k|                    return 0;
  426|  2.78k|                }
  427|   279k|                break;
  428|   282k|            }
  429|       |            /* We fence end[0] with \r, followed by end[1] being something that is "not \n", to signify "not found".
  430|       |                * This way we can have this one single check to see if we found \r\n WITHIN our allowed search space. */
  431|   279k|            if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (431:17): [True: 261k, False: 18.4k]
  ------------------
  432|       |                /* Store this header, it is valid */
  433|   261k|                headers->value = std::string_view(preliminaryValue, (size_t) (postPaddedBuffer - preliminaryValue));
  434|   261k|                postPaddedBuffer += 2;
  435|       |
  436|       |                /* Trim trailing whitespace (SP, HTAB) */
  437|   324k|                while (headers->value.length() && headers->value.back() < 33) {
  ------------------
  |  Branch (437:24): [True: 204k, False: 120k]
  |  Branch (437:51): [True: 63.0k, False: 141k]
  ------------------
  438|  63.0k|                    headers->value.remove_suffix(1);
  439|  63.0k|                }
  440|       |
  441|       |                /* Trim initial whitespace (SP, HTAB) */
  442|   291k|                while (headers->value.length() && headers->value.front() < 33) {
  ------------------
  |  Branch (442:24): [True: 171k, False: 120k]
  |  Branch (442:51): [True: 30.2k, False: 141k]
  ------------------
  443|  30.2k|                    headers->value.remove_prefix(1);
  444|  30.2k|                }
  445|       |                
  446|   261k|                headers++;
  447|       |
  448|       |                /* We definitely have at least one header (or request line), so check if we are done */
  449|   261k|                if (*postPaddedBuffer == '\r') {
  ------------------
  |  Branch (449:21): [True: 73.6k, False: 187k]
  ------------------
  450|  73.6k|                    if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (450:25): [True: 70.5k, False: 3.06k]
  ------------------
  451|       |                        /* This cann take the very last header space */
  452|  70.5k|                        headers->key = std::string_view(nullptr, 0);
  453|  70.5k|                        return (unsigned int) ((postPaddedBuffer + 2) - start);
  454|  70.5k|                    } else {
  455|       |                        /* \r\n\r plus non-\n letter is malformed request, or simply out of search space */
  456|  3.06k|                        if (postPaddedBuffer + 1 < end) {
  ------------------
  |  Branch (456:29): [True: 268, False: 2.79k]
  ------------------
  457|    268|                            err = HTTP_ERROR_400_BAD_REQUEST;
  458|    268|                        }
  459|  3.06k|                        return 0;
  460|  3.06k|                    }
  461|  73.6k|                }
  462|   261k|            } else {
  463|       |                /* We are either out of search space or this is a malformed request */
  464|  18.4k|                return 0;
  465|  18.4k|            }
  466|   279k|        }
  467|       |        /* We ran out of header space, too large request */
  468|    194|        err = HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE;
  469|    194|        return 0;
  470|   100k|    }
_ZN3uWS10HttpParser18consumeRequestLineEPcS1_RNS_11HttpRequest6HeaderE:
  293|   186k|    static inline char *consumeRequestLine(char *data, char *end, HttpRequest::Header &header) {
  294|       |        /* Scan until single SP, assume next is / (origin request) */
  295|   186k|        char *start = data;
  296|       |        /* This catches the post padded CR and fails */
  297|   747k|        while (data[0] > 32) data++;
  ------------------
  |  Branch (297:16): [True: 561k, False: 186k]
  ------------------
  298|   186k|        if (&data[1] == end) [[unlikely]] {
  ------------------
  |  Branch (298:13): [True: 1.34k, False: 184k]
  ------------------
  299|  1.34k|            return nullptr;
  300|  1.34k|        }
  301|   184k|        if (data[0] == 32 && data[1] == '/') [[likely]] {
  ------------------
  |  Branch (301:13): [True: 110k, False: 74.0k]
  |  Branch (301:30): [True: 107k, False: 3.66k]
  ------------------
  302|   107k|            header.key = {start, (size_t) (data - start)};
  303|   107k|            data++;
  304|       |            /* Scan for less than 33 (catches post padded CR and fails) */
  305|   107k|            start = data;
  306|   263k|            for (; true; data += 8) {
  ------------------
  |  Branch (306:20): [Folded - Ignored]
  ------------------
  307|   263k|                uint64_t word;
  308|   263k|                memcpy(&word, data, sizeof(uint64_t));
  309|   263k|                if (hasLess(word, 33)) {
  ------------------
  |  Branch (309:21): [True: 107k, False: 156k]
  ------------------
  310|   388k|                    while (*(unsigned char *)data > 32) data++;
  ------------------
  |  Branch (310:28): [True: 281k, False: 107k]
  ------------------
  311|       |                    /* Now we stand on space */
  312|   107k|                    header.value = {start, (size_t) (data - start)};
  313|       |                    /* Check that the following is http 1.1 */
  314|   107k|                    if (data + 11 >= end) {
  ------------------
  |  Branch (314:25): [True: 1.54k, False: 105k]
  ------------------
  315|       |                        /* Whatever we have must be part of the version string */
  316|  1.54k|                        if (memcmp(" HTTP/1.1\r\n", data, std::min<unsigned int>(11, (unsigned int) (end - data))) == 0) {
  ------------------
  |  Branch (316:29): [True: 1.10k, False: 443]
  ------------------
  317|  1.10k|                            return nullptr;
  318|  1.10k|                        }
  319|    443|                        return (char *) 0x1;
  320|  1.54k|                    }
  321|   105k|                    if (memcmp(" HTTP/1.1\r\n", data, 11) == 0) {
  ------------------
  |  Branch (321:25): [True: 100k, False: 5.31k]
  ------------------
  322|   100k|                        return data + 11;
  323|   100k|                    }
  324|       |                    /* If we stand at the post padded CR, we have fragmented input so try again later */
  325|  5.31k|                    if (data[0] == '\r') {
  ------------------
  |  Branch (325:25): [True: 530, False: 4.78k]
  ------------------
  326|    530|                        return nullptr;
  327|    530|                    }
  328|       |                    /* This is an error */
  329|  4.78k|                    return (char *) 0x1;
  330|  5.31k|                }
  331|   263k|            }
  332|   107k|        }
  333|       |        /* If we stand at the post padded CR, we have fragmented input so try again later */
  334|  77.7k|        if (data[0] == '\r') {
  ------------------
  |  Branch (334:13): [True: 6.27k, False: 71.4k]
  ------------------
  335|  6.27k|            return nullptr;
  336|  6.27k|        }
  337|  71.4k|        return (char *) 0x1;
  338|  77.7k|    }
_ZN3uWS10HttpParser7hasLessEmm:
  220|   849k|    static inline uint64_t hasLess(uint64_t x, uint64_t n) {
  221|   849k|        return (((x)-~0ULL/255*(n))&~(x)&~0ULL/255*128);
  222|   849k|    }
_ZN3uWS10HttpParser16consumeFieldNameEPc:
  264|   287k|    static inline void *consumeFieldName(char *p) {
  265|       |        /* Best case fast path (particularly useful with clang) */
  266|   525k|        while (true) {
  ------------------
  |  Branch (266:16): [Folded - Ignored]
  ------------------
  267|   620k|            while ((*p >= 65) & (*p <= 90)) [[likely]] {
  ------------------
  |  Branch (267:20): [True: 95.7k, False: 525k]
  ------------------
  268|  95.7k|                *p |= 32;
  269|  95.7k|                p++;
  270|  95.7k|            }
  271|  2.37M|            while (((*p >= 97) & (*p <= 122))) [[likely]] {
  ------------------
  |  Branch (271:20): [True: 1.85M, False: 525k]
  ------------------
  272|  1.85M|                p++;
  273|  1.85M|            }
  274|   525k|            if (*p == ':') {
  ------------------
  |  Branch (274:17): [True: 272k, False: 252k]
  ------------------
  275|   272k|                return (void *)p;
  276|   272k|            }
  277|   252k|            if (*p == '-') {
  ------------------
  |  Branch (277:17): [True: 155k, False: 96.8k]
  ------------------
  278|   155k|                p++;
  279|   155k|            } else if (!((*p >= 65) & (*p <= 90))) {
  ------------------
  |  Branch (279:24): [True: 15.4k, False: 81.4k]
  ------------------
  280|       |                /* Exit fast path parsing */
  281|  15.4k|                break;
  282|  15.4k|            }
  283|   252k|        }
  284|       |
  285|       |        /* Generic */
  286|   202k|        while (isFieldNameByteFastLowercased(*(unsigned char *)p)) {
  ------------------
  |  Branch (286:16): [True: 187k, False: 15.4k]
  ------------------
  287|   187k|            p++;
  288|   187k|        }
  289|  15.4k|        return (void *)p;
  290|   287k|    }
_ZN3uWS10HttpParser29isFieldNameByteFastLowercasedERh:
  249|   202k|    static inline bool isFieldNameByteFastLowercased(unsigned char &in) {
  250|       |        /* Most common is lowercase alpha and hyphen */
  251|   202k|        if (((in >= 97) & (in <= 122)) | (in == '-')) [[likely]] {
  ------------------
  |  Branch (251:13): [True: 159k, False: 43.5k]
  ------------------
  252|   159k|            return true;
  253|       |        /* Second is upper case alpha */
  254|   159k|        } else if ((in >= 65) & (in <= 90)) [[unlikely]] {
  ------------------
  |  Branch (254:20): [True: 7.83k, False: 35.6k]
  ------------------
  255|  7.83k|            in |= 32;
  256|  7.83k|            return true;
  257|       |        /* These are rarely used but still valid */
  258|  35.6k|        } else if (isUnlikelyFieldNameByte(in)) [[unlikely]] {
  ------------------
  |  Branch (258:20): [True: 20.2k, False: 15.4k]
  ------------------
  259|  20.2k|            return true;
  260|  20.2k|        }
  261|  15.4k|        return false;
  262|   202k|    }
_ZN3uWS10HttpParser23isUnlikelyFieldNameByteEh:
  243|  35.6k|    {
  244|       |        /* Digits and 14 of the 15 non-alphanum characters (lacking hyphen) */
  245|  35.6k|        return ((c == '~') | (c == '|') | (c == '`') | (c == '_') | (c == '^') | (c == '.') | (c == '+')
  ------------------
  |  Branch (245:16): [True: 4.58k, False: 31.1k]
  ------------------
  246|  35.6k|            | (c == '*') | (c == '!')) || ((c >= 48) & (c <= 57)) || ((c <= 39) & (c >= 35));
  ------------------
  |  Branch (246:43): [True: 8.32k, False: 22.7k]
  |  Branch (246:70): [True: 7.32k, False: 15.4k]
  ------------------
  247|  35.6k|    }
_ZN3uWS10HttpParser20tryConsumeFieldValueEPc:
  344|   282k|    static inline void *tryConsumeFieldValue(char *p) {
  345|   586k|        for (; true; p += 8) {
  ------------------
  |  Branch (345:16): [Folded - Ignored]
  ------------------
  346|   586k|            uint64_t word;
  347|   586k|            memcpy(&word, p, sizeof(uint64_t));
  348|   586k|            if (hasLess(word, 32)) {
  ------------------
  |  Branch (348:17): [True: 282k, False: 303k]
  ------------------
  349|   684k|                while (*(unsigned char *)p > 31) p++;
  ------------------
  |  Branch (349:24): [True: 401k, False: 282k]
  ------------------
  350|   282k|                return (void *)p;
  351|   282k|            }
  352|   586k|        }
  353|   282k|    }
_ZN3uWS11HttpRequest9getHeaderENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  115|   541k|    std::string_view getHeader(std::string_view lowerCasedHeader) {
  116|   541k|        if (bf.mightHave(lowerCasedHeader)) {
  ------------------
  |  Branch (116:13): [True: 149k, False: 391k]
  ------------------
  117|   281k|            for (Header *h = headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (117:39): [True: 278k, False: 2.81k]
  ------------------
  118|   278k|                if (h->key.length() == lowerCasedHeader.length() && !strncmp(h->key.data(), lowerCasedHeader.data(), lowerCasedHeader.length())) {
  ------------------
  |  Branch (118:21): [True: 152k, False: 126k]
  |  Branch (118:69): [True: 146k, False: 5.61k]
  ------------------
  119|   146k|                    return h->value;
  120|   146k|                }
  121|   278k|            }
  122|   149k|        }
  123|   394k|        return std::string_view(nullptr, 0);
  124|   541k|    }
_ZN3uWS10HttpParser17toUnsignedIntegerENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  203|  5.77k|    static uint64_t toUnsignedInteger(std::string_view str) {
  204|       |        /* We assume at least 64-bit integer giving us safely 999999999999999999 (18 number of 9s) */
  205|  5.77k|        if (str.length() > 18) {
  ------------------
  |  Branch (205:13): [True: 406, False: 5.36k]
  ------------------
  206|    406|            return UINT64_MAX;
  207|    406|        }
  208|       |
  209|  5.36k|        uint64_t unsignedIntegerValue = 0;
  210|  13.2k|        for (char c : str) {
  ------------------
  |  Branch (210:21): [True: 13.2k, False: 3.02k]
  ------------------
  211|       |            /* As long as the letter is 0-9 we cannot overflow. */
  212|  13.2k|            if (c < '0' || c > '9') {
  ------------------
  |  Branch (212:17): [True: 2.11k, False: 11.1k]
  |  Branch (212:28): [True: 231, False: 10.9k]
  ------------------
  213|  2.34k|                return UINT64_MAX;
  214|  2.34k|            }
  215|  10.9k|            unsignedIntegerValue = unsignedIntegerValue * 10ull + ((unsigned int) c - (unsigned int) '0');
  216|  10.9k|        }
  217|  3.02k|        return unsignedIntegerValue;
  218|  5.36k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi0EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  477|   183k|    std::pair<unsigned int, void *> fenceAndConsumePostPadded(char *data, unsigned int length, void *user, void *reserved, HttpRequest *req, MoveOnlyFunction<void *(void *, HttpRequest *)> &requestHandler, MoveOnlyFunction<void *(void *, std::string_view, bool)> &dataHandler) {
  478|       |
  479|       |        /* How much data we CONSUMED (to throw away) */
  480|   183k|        unsigned int consumedTotal = 0;
  481|   183k|        unsigned int err = 0;
  482|       |
  483|       |        /* Fence two bytes past end of our buffer (buffer has post padded margins).
  484|       |         * This is to always catch scan for \r but not for \r\n. */
  485|   183k|        data[length] = '\r';
  486|   183k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  487|       |
  488|   202k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (488:37): [True: 164k, False: 37.9k]
  |  Branch (488:47): [True: 62.4k, False: 101k]
  ------------------
  489|  62.4k|            data += consumed;
  490|  62.4k|            length -= consumed;
  491|  62.4k|            consumedTotal += consumed;
  492|       |
  493|       |            /* Even if we could parse it, check for length here as well */
  494|  62.4k|            if (consumed > MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (494:17): [True: 0, False: 62.4k]
  ------------------
  495|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  496|      0|            }
  497|       |
  498|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  499|  62.4k|            req->ancientHttp = false;
  500|       |
  501|       |            /* Add all headers to bloom filter */
  502|  62.4k|            req->bf.reset();
  503|   207k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (503:57): [True: 144k, False: 62.1k]
  ------------------
  504|   144k|                if (req->bf.mightHave(h->key)) [[unlikely]] {
  ------------------
  |  Branch (504:21): [True: 2.94k, False: 142k]
  ------------------
  505|       |                    /* Host header is not allowed twice */
  506|  2.94k|                    if (h->key == "host" && req->getHeader("host").data()) {
  ------------------
  |  Branch (506:25): [True: 227, False: 2.72k]
  |  Branch (506:25): [True: 227, False: 2.72k]
  |  Branch (506:45): [True: 227, False: 0]
  ------------------
  507|    227|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  508|    227|                    }
  509|  2.94k|                }
  510|   144k|                req->bf.add(h->key);
  511|   144k|            }
  512|       |            
  513|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  514|  62.1k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (514:17): [True: 718, False: 61.4k]
  ------------------
  515|    718|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  516|    718|            }
  517|       |
  518|       |            /* RFC 9112 6.3
  519|       |            * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  520|       |            * the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt
  521|       |            * to perform request smuggling (Section 11.2) or response splitting (Section 11.1) and
  522|       |            * ought to be handled as an error. */
  523|  61.4k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  524|  61.4k|            std::string_view contentLengthString = req->getHeader("content-length");
  525|  61.4k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (525:17): [True: 2.51k, False: 58.9k]
  |  Branch (525:52): [True: 194, False: 2.32k]
  ------------------
  526|       |                /* Returning fullptr is the same as calling the errorHandler */
  527|       |                /* We could be smart and set an error in the context along with this, to indicate what 
  528|       |                 * http error response we might want to return */
  529|    194|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  530|    194|            }
  531|       |
  532|       |            /* Parse query */
  533|  61.2k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  534|  61.2k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (534:52): [True: 6.44k, False: 54.8k]
  ------------------
  535|       |
  536|       |            /* If returned socket is not what we put in we need
  537|       |             * to break here as we either have upgraded to
  538|       |             * WebSockets or otherwise closed the socket. */
  539|  61.2k|            void *returnedUser = requestHandler(user, req);
  540|  61.2k|            if (returnedUser != user) {
  ------------------
  |  Branch (540:17): [True: 39.3k, False: 21.9k]
  ------------------
  541|       |                /* We are upgraded to WebSocket or otherwise broken */
  542|  39.3k|                return {consumedTotal, returnedUser};
  543|  39.3k|            }
  544|       |
  545|       |            /* The rules at play here according to RFC 9112 for requests are essentially:
  546|       |             * If both content-length and transfer-encoding then invalid message; must break.
  547|       |             * If has transfer-encoding then must be chunked regardless of value.
  548|       |             * If content-length then fixed length even if 0.
  549|       |             * If none of the above then fixed length is 0. */
  550|       |
  551|       |            /* RFC 9112 6.3
  552|       |             * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  553|       |             * the Transfer-Encoding overrides the Content-Length. */
  554|  21.9k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (554:17): [True: 2.32k, False: 19.5k]
  ------------------
  555|       |
  556|       |                /* If a proxy sent us the transfer-encoding header that 100% means it must be chunked or else the proxy is
  557|       |                 * not RFC 9112 compliant. Therefore it is always better to assume this is the case, since that entirely eliminates 
  558|       |                 * all forms of transfer-encoding obfuscation tricks. We just rely on the header. */
  559|       |
  560|       |                /* RFC 9112 6.3
  561|       |                 * If a Transfer-Encoding header field is present in a request and the chunked transfer coding is not the
  562|       |                 * final encoding, the message body length cannot be determined reliably; the server MUST respond with the
  563|       |                 * 400 (Bad Request) status code and then close the connection. */
  564|       |
  565|       |                /* In this case we fail later by having the wrong interpretation (assuming chunked).
  566|       |                 * This could be made stricter but makes no difference either way, unless forwarding the identical message as a proxy. */
  567|       |
  568|  2.32k|                remainingStreamingBytes = STATE_IS_CHUNKED;
  569|       |                /* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */
  570|  2.32k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (570:21): [Folded - Ignored]
  ------------------
  571|       |                    /* Go ahead and parse it (todo: better heuristics for emitting FIN to the app level) */
  572|  2.32k|                    std::string_view dataToConsume(data, length);
  573|  2.32k|                    for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (573:37): [True: 1.79k, False: 2.32k]
  ------------------
  574|  1.79k|                        dataHandler(user, chunk, chunk.length() == 0);
  575|  1.79k|                    }
  576|  2.32k|                    if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (576:25): [True: 695, False: 1.63k]
  ------------------
  577|    695|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  578|    695|                    }
  579|  1.63k|                    unsigned int consumed = (length - (unsigned int) dataToConsume.length());
  580|  1.63k|                    data = (char *) dataToConsume.data();
  581|  1.63k|                    length = (unsigned int) dataToConsume.length();
  582|  1.63k|                    consumedTotal += consumed;
  583|  1.63k|                }
  584|  19.5k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (584:24): [True: 3.90k, False: 15.6k]
  ------------------
  585|  3.90k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  586|  3.90k|                if (remainingStreamingBytes == UINT64_MAX) {
  ------------------
  |  Branch (586:21): [True: 2.32k, False: 1.58k]
  ------------------
  587|       |                    /* Parser error */
  588|  2.32k|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  589|  2.32k|                }
  590|       |
  591|  1.58k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (591:21): [Folded - Ignored]
  ------------------
  592|  1.58k|                    unsigned int emittable = (unsigned int) std::min<uint64_t>(remainingStreamingBytes, length);
  593|  1.58k|                    dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
  594|  1.58k|                    remainingStreamingBytes -= emittable;
  595|       |
  596|  1.58k|                    data += emittable;
  597|  1.58k|                    length -= emittable;
  598|  1.58k|                    consumedTotal += emittable;
  599|  1.58k|                }
  600|  15.6k|            } else {
  601|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  602|  15.6k|                dataHandler(user, {}, true);
  603|  15.6k|            }
  604|       |
  605|       |            /* Consume minimally should break as easrly as possible */
  606|  18.8k|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (606:17): [Folded - Ignored]
  ------------------
  607|      0|                break;
  608|      0|            }
  609|  18.8k|        }
  610|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  611|   139k|        if (err) {
  ------------------
  |  Branch (611:13): [True: 80.8k, False: 58.9k]
  ------------------
  612|  80.8k|            return {err, FULLPTR};
  613|  80.8k|        }
  614|  58.9k|        return {consumedTotal, user};
  615|   139k|    }
_ZN3uWS11HttpRequest9isAncientEv:
   72|  67.2k|    bool isAncient() {
   73|  67.2k|        return ancientHttp;
   74|  67.2k|    }
_ZN3uWS11HttpRequest22getCaseSensitiveMethodEv:
  135|  67.2k|    std::string_view getCaseSensitiveMethod() {
  136|  67.2k|        return std::string_view(headers->key.data(), headers->key.length());
  137|  67.2k|    }
_ZN3uWS11HttpRequest6getUrlEv:
  126|  67.2k|    std::string_view getUrl() {
  127|  67.2k|        return std::string_view(headers->value.data(), querySeparator);
  128|  67.2k|    }
_ZN3uWS11HttpRequest8setYieldEb:
  111|  91.6k|    void setYield(bool yield) {
  112|  91.6k|        didYield = yield;
  113|  91.6k|    }
_ZN3uWS11HttpRequest13setParametersENSt3__14pairIiPNS1_17basic_string_viewIcNS1_11char_traitsIcEEEEEE:
  166|  79.4k|    void setParameters(std::pair<int, std::string_view *> parameters) {
  167|  79.4k|        currentParameters = parameters;
  168|  79.4k|    }
_ZN3uWS11HttpRequest19setParameterOffsetsEPNSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEtNS1_4lessIvEENS6_INS1_4pairIKS8_tEEEEEE:
  170|  79.4k|    void setParameterOffsets(std::map<std::string, unsigned short, std::less<>> *offsets) {
  171|  79.4k|        currentParameterOffsets = offsets;
  172|  79.4k|    }
_ZN3uWS11HttpRequest8getYieldEv:
   76|  79.4k|    bool getYield() {
   77|  79.4k|        return didYield;
   78|  79.4k|    }
_ZN3uWS11HttpRequest8getQueryEv:
  149|  10.9k|    std::string_view getQuery() {
  150|  10.9k|        if (querySeparator < headers->value.length()) {
  ------------------
  |  Branch (150:13): [True: 3.03k, False: 7.91k]
  ------------------
  151|       |            /* Strip the initial ? */
  152|  3.03k|            return std::string_view(headers->value.data() + querySeparator + 1, headers->value.length() - querySeparator - 1);
  153|  7.91k|        } else {
  154|  7.91k|            return std::string_view(nullptr, 0);
  155|  7.91k|        }
  156|  10.9k|    }
_ZN3uWS11HttpRequest12getParameterEt:
  185|  6.94k|    std::string_view getParameter(unsigned short index) {
  186|  6.94k|        if (currentParameters.first < (int) index) {
  ------------------
  |  Branch (186:13): [True: 4.63k, False: 2.31k]
  ------------------
  187|  4.63k|            return {};
  188|  4.63k|        } else {
  189|  2.31k|            return currentParameters.second[index];
  190|  2.31k|        }
  191|  6.94k|    }
_ZN3uWS11HttpRequest8getQueryENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  159|  2.31k|    std::string_view getQuery(std::string_view key) {
  160|       |        /* Raw querystring including initial '?' sign */
  161|  2.31k|        std::string_view queryString = std::string_view(headers->value.data() + querySeparator, headers->value.length() - querySeparator);
  162|       |
  163|  2.31k|        return getDecodedQueryValue(key, queryString);
  164|  2.31k|    }

_ZN3uWS12HttpResponseILb0EE12hasRespondedEv:
  494|  51.6k|    bool hasResponded() {
  495|  51.6k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  496|       |
  497|  51.6k|        return !(httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING);
  498|  51.6k|    }
_ZN3uWS12HttpResponseILb0EE19getHttpResponseDataEv:
   52|   592k|    HttpResponseData<SSL> *getHttpResponseData() {
   53|   592k|        return (HttpResponseData<SSL> *) Super::getAsyncSocketData();
   54|   592k|    }
_ZN3uWS12HttpResponseILb0EE11writeStatusENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  386|   381k|    HttpResponse *writeStatus(std::string_view status) {
  387|   381k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  388|       |
  389|       |        /* Do not allow writing more than one status */
  390|   381k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_STATUS_CALLED) {
  ------------------
  |  Branch (390:13): [True: 317k, False: 63.2k]
  ------------------
  391|   317k|            return this;
  392|   317k|        }
  393|       |
  394|       |        /* Update status */
  395|  63.2k|        httpResponseData->state |= HttpResponseData<SSL>::HTTP_STATUS_CALLED;
  396|       |
  397|  63.2k|        Super::write("HTTP/1.1 ", 9);
  398|  63.2k|        Super::write(status.data(), (int) status.length());
  399|  63.2k|        Super::write("\r\n", 2);
  400|  63.2k|        return this;
  401|   381k|    }
_ZN3uWS12HttpResponseILb0EE3endENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEb:
  435|  22.7k|    void end(std::string_view data = {}, bool closeConnection = false) {
  436|  22.7k|        internalEnd(data, data.length(), false, true, closeConnection);
  437|  22.7k|    }
_ZN3uWS12HttpResponseILb0EE11internalEndENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEmbbb:
   92|  63.2k|    bool internalEnd(std::string_view data, uintmax_t totalSize, bool optional, bool allowContentLength = true, bool closeConnection = false) {
   93|       |        /* Write status if not already done */
   94|  63.2k|        writeStatus(HTTP_200_OK);
   95|       |
   96|       |        /* If no total size given then assume this chunk is everything */
   97|  63.2k|        if (!totalSize) {
  ------------------
  |  Branch (97:13): [True: 43.7k, False: 19.5k]
  ------------------
   98|  43.7k|            totalSize = data.length();
   99|  43.7k|        }
  100|       |
  101|  63.2k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  102|       |
  103|       |        /* In some cases, such as when refusing huge data we want to close the connection when drained */
  104|  63.2k|        if (closeConnection) {
  ------------------
  |  Branch (104:13): [True: 0, False: 63.2k]
  ------------------
  105|       |
  106|       |            /* HTTP 1.1 must send this back unless the client already sent it to us.
  107|       |             * It is a connection close when either of the two parties say so but the
  108|       |             * one party must tell the other one so.
  109|       |             *
  110|       |             * This check also serves to limit writing the header only once. */
  111|      0|            if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) == 0) {
  ------------------
  |  Branch (111:17): [True: 0, False: 0]
  ------------------
  112|      0|                writeHeader("Connection", "close");
  113|      0|            }
  114|       |
  115|      0|            httpResponseData->state |= HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE;
  116|      0|        }
  117|       |
  118|  63.2k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED) {
  ------------------
  |  Branch (118:13): [True: 3.99k, False: 59.2k]
  ------------------
  119|       |
  120|       |            /* We do not have tryWrite-like functionalities, so ignore optional in this path */
  121|       |
  122|       |            /* Do not allow sending 0 chunk here */
  123|  3.99k|            if (data.length()) {
  ------------------
  |  Branch (123:17): [True: 699, False: 3.29k]
  ------------------
  124|    699|                Super::write("\r\n", 2);
  125|    699|                writeUnsignedHex((unsigned int) data.length());
  126|    699|                Super::write("\r\n", 2);
  127|       |
  128|       |                /* Ignoring optional for now */
  129|    699|                Super::write(data.data(), (int) data.length());
  130|    699|            }
  131|       |
  132|       |            /* Terminating 0 chunk */
  133|  3.99k|            Super::write("\r\n0\r\n\r\n", 7);
  134|       |
  135|  3.99k|            httpResponseData->markDone();
  136|       |
  137|       |            /* We need to check if we should close this socket here now */
  138|  3.99k|            if (!Super::isCorked()) {
  ------------------
  |  Branch (138:17): [True: 0, False: 3.99k]
  ------------------
  139|      0|                if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (139:21): [True: 0, False: 0]
  ------------------
  140|      0|                    if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (140:25): [True: 0, False: 0]
  ------------------
  141|      0|                        if (((AsyncSocket<SSL> *) this)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (141:29): [True: 0, False: 0]
  ------------------
  142|      0|                            ((AsyncSocket<SSL> *) this)->shutdown();
  143|       |                            /* We need to force close after sending FIN since we want to hinder
  144|       |                                * clients from keeping to send their huge data */
  145|      0|                            ((AsyncSocket<SSL> *) this)->close();
  146|      0|                            return true;
  147|      0|                        }
  148|      0|                    }
  149|      0|                }
  150|      0|            }
  151|       |
  152|       |            /* tryEnd can never fail when in chunked mode, since we do not have tryWrite (yet), only write */
  153|  3.99k|            Super::timeout(HTTP_TIMEOUT_S);
  154|  3.99k|            return true;
  155|  59.2k|        } else {
  156|       |            /* Write content-length on first call */
  157|  59.2k|            if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_END_CALLED)) {
  ------------------
  |  Branch (157:17): [True: 59.2k, False: 0]
  ------------------
  158|       |                /* Write mark, this propagates to WebSockets too */
  159|  59.2k|                writeMark();
  160|       |
  161|       |                /* WebSocket upgrades does not allow content-length */
  162|  59.2k|                if (allowContentLength) {
  ------------------
  |  Branch (162:21): [True: 18.8k, False: 40.4k]
  ------------------
  163|       |                    /* Even zero is a valid content-length */
  164|  18.8k|                    Super::write("Content-Length: ", 16);
  165|  18.8k|                    writeUnsigned64(totalSize);
  166|  18.8k|                    Super::write("\r\n\r\n", 4);
  167|  40.4k|                } else {
  168|  40.4k|                    Super::write("\r\n", 2);
  169|  40.4k|                }
  170|       |
  171|       |                /* Mark end called */
  172|  59.2k|                httpResponseData->state |= HttpResponseData<SSL>::HTTP_END_CALLED;
  173|  59.2k|            }
  174|       |
  175|       |            /* Even if we supply no new data to write, its failed boolean is useful to know
  176|       |             * if it failed to drain any prior failed header writes */
  177|       |
  178|       |            /* Write as much as possible without causing backpressure */
  179|  59.2k|            size_t written = 0;
  180|  59.2k|            bool failed = false;
  181|  78.1k|            while (written < data.length() && !failed) {
  ------------------
  |  Branch (181:20): [True: 18.8k, False: 59.2k]
  |  Branch (181:47): [True: 18.8k, False: 0]
  ------------------
  182|       |                /* uSockets only deals with int sizes, so pass chunks of max signed int size */
  183|  18.8k|                auto writtenFailed = Super::write(data.data() + written, (int) std::min<size_t>(data.length() - written, INT_MAX), optional);
  184|       |
  185|  18.8k|                written += (size_t) writtenFailed.first;
  186|  18.8k|                failed = writtenFailed.second;
  187|  18.8k|            }
  188|       |
  189|  59.2k|            httpResponseData->offset += written;
  190|       |
  191|       |            /* Success is when we wrote the entire thing without any failures */
  192|  59.2k|            bool success = written == data.length() && !failed;
  ------------------
  |  Branch (192:28): [True: 59.2k, False: 0]
  |  Branch (192:56): [True: 58.7k, False: 509]
  ------------------
  193|       |
  194|       |            /* If we are now at the end, start a timeout. Also start a timeout if we failed. */
  195|  59.2k|            if (!success || httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (195:17): [True: 509, False: 58.7k]
  |  Branch (195:29): [True: 58.7k, False: 0]
  ------------------
  196|  59.2k|                Super::timeout(HTTP_TIMEOUT_S);
  197|  59.2k|            }
  198|       |
  199|       |            /* Remove onAborted, onWritable function and mark done if we reach the end, or if we were given no data (faked size like in HEAD response) */
  200|       |            /* I need to figure out if this line should rather be simply httpResponseData->offset == data.length() */
  201|       |            /* No that can't be right, tryEnd with fake length should not complete the response even if the smaller chunk wrote in one go */
  202|       |            /* Possibly need  to separate endWithoutBody and tryEnd with fake length into two separate calls with a boolean that explicitly marks isHeadOnly */
  203|  59.2k|            if (httpResponseData->offset == totalSize || !data.length()) {
  ------------------
  |  Branch (203:17): [True: 59.2k, False: 0]
  |  Branch (203:58): [True: 0, False: 0]
  ------------------
  204|  59.2k|                httpResponseData->markDone();
  205|       |
  206|       |                /* We need to check if we should close this socket here now */
  207|  59.2k|                if (!Super::isCorked()) {
  ------------------
  |  Branch (207:21): [True: 0, False: 59.2k]
  ------------------
  208|      0|                    if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (208:25): [True: 0, False: 0]
  ------------------
  209|      0|                        if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (209:29): [True: 0, False: 0]
  ------------------
  210|      0|                            if (((AsyncSocket<SSL> *) this)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (210:33): [True: 0, False: 0]
  ------------------
  211|      0|                                ((AsyncSocket<SSL> *) this)->shutdown();
  212|       |                                /* We need to force close after sending FIN since we want to hinder
  213|       |                                * clients from keeping to send their huge data */
  214|      0|                                ((AsyncSocket<SSL> *) this)->close();
  215|      0|                            }
  216|      0|                        }
  217|      0|                    }
  218|      0|                }
  219|  59.2k|            }
  220|       |
  221|  59.2k|            return success;
  222|  59.2k|        }
  223|  63.2k|    }
_ZN3uWS12HttpResponseILb0EE11writeHeaderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_:
  404|   259k|    HttpResponse *writeHeader(std::string_view key, std::string_view value) {
  405|   259k|        writeStatus(HTTP_200_OK);
  406|       |
  407|   259k|        Super::write(key.data(), (int) key.length());
  408|   259k|        Super::write(": ", 2);
  409|   259k|        Super::write(value.data(), (int) value.length());
  410|   259k|        Super::write("\r\n", 2);
  411|   259k|        return this;
  412|   259k|    }
_ZN3uWS12HttpResponseILb0EE16writeUnsignedHexEj:
   57|  7.24k|    void writeUnsignedHex(unsigned int value) {
   58|       |        /* Buf really only needs to be 8 long but building with
   59|       |         * -mavx2, GCC still wants to overstep it so made it 16 */
   60|  7.24k|        char buf[16];
   61|  7.24k|        int length = utils::u32toaHex(value, buf);
   62|       |
   63|       |        /* For now we do this copy */
   64|  7.24k|        Super::write(buf, length);
   65|  7.24k|    }
_ZN3uWS12HttpResponseILb0EE9writeMarkEv:
   77|  63.2k|    void writeMark() {
   78|       |        /* Date is always written */
   79|  63.2k|        writeHeader("Date", std::string_view(((LoopData *) us_loop_ext(us_socket_context_loop(SSL, (us_socket_context(SSL, (us_socket_t *) this)))))->date, 29));
   80|       |
   81|       |        /* You can disable this altogether */
   82|  63.2k|#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
   83|  63.2k|        if (!Super::getLoopData()->noMark) {
  ------------------
  |  Branch (83:13): [True: 63.2k, False: 0]
  ------------------
   84|       |            /* We only expose major version */
   85|  63.2k|            writeHeader("uWebSockets", "20");
   86|  63.2k|        }
   87|  63.2k|#endif
   88|  63.2k|    }
_ZN3uWS12HttpResponseILb0EE15writeUnsigned64Em:
   68|  18.8k|    void writeUnsigned64(uint64_t value) {
   69|  18.8k|        char buf[20];
   70|  18.8k|        int length = utils::u64toa(value, buf);
   71|       |
   72|       |        /* For now we do this copy */
   73|  18.8k|        Super::write(buf, length);
   74|  18.8k|    }
_ZN3uWS12HttpResponseILb0EE13writeContinueEv:
  380|    532|    HttpResponse *writeContinue() {
  381|    532|        Super::write("HTTP/1.1 100 Continue\r\n\r\n", 25);
  382|    532|        return this;
  383|    532|    }
EpollHelloWorld.cpp:_ZN3uWS12HttpResponseILb0EE7upgradeIZ4testvE13PerSocketDataEEvOT_NSt3__117basic_string_viewIcNS6_11char_traitsIcEEEESA_SA_P19us_socket_context_t:
  242|  40.4k|            struct us_socket_context_t *webSocketContext) {
  243|       |
  244|       |        /* Extract needed parameters from WebSocketContextData */
  245|  40.4k|        WebSocketContextData<SSL, UserData> *webSocketContextData = (WebSocketContextData<SSL, UserData> *) us_socket_context_ext(SSL, webSocketContext);
  246|       |
  247|       |        /* Note: OpenSSL can be used here to speed this up somewhat */
  248|  40.4k|        char secWebSocketAccept[29] = {};
  249|  40.4k|        WebSocketHandshake::generate(secWebSocketKey.data(), secWebSocketAccept);
  250|       |
  251|  40.4k|        writeStatus("101 Switching Protocols")
  252|  40.4k|            ->writeHeader("Upgrade", "websocket")
  253|  40.4k|            ->writeHeader("Connection", "Upgrade")
  254|  40.4k|            ->writeHeader("Sec-WebSocket-Accept", secWebSocketAccept);
  255|       |
  256|       |        /* Select first subprotocol if present */
  257|  40.4k|        if (secWebSocketProtocol.length()) {
  ------------------
  |  Branch (257:13): [True: 970, False: 39.5k]
  ------------------
  258|    970|            writeHeader("Sec-WebSocket-Protocol", secWebSocketProtocol.substr(0, secWebSocketProtocol.find(',')));
  259|    970|        }
  260|       |
  261|       |        /* Negotiate compression */
  262|  40.4k|        bool perMessageDeflate = false;
  263|  40.4k|        CompressOptions compressOptions = CompressOptions::DISABLED;
  264|  40.4k|        if (secWebSocketExtensions.length() && webSocketContextData->compression != DISABLED) {
  ------------------
  |  Branch (264:13): [True: 6.21k, False: 34.2k]
  |  Branch (264:48): [True: 6.02k, False: 196]
  ------------------
  265|       |
  266|       |            /* Make sure to map SHARED_DECOMPRESSOR to windowBits = 0, not 1  */
  267|  6.02k|            int wantedInflationWindow = 0;
  268|  6.02k|            if ((webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) != CompressOptions::SHARED_DECOMPRESSOR) {
  ------------------
  |  Branch (268:17): [True: 6.02k, False: 0]
  ------------------
  269|  6.02k|                wantedInflationWindow = (webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) >> 8;
  270|  6.02k|            }
  271|       |
  272|       |            /* Map from selected compressor (this automatically maps SHARED_COMPRESSOR to windowBits 0, not 1) */
  273|  6.02k|            int wantedCompressionWindow = (webSocketContextData->compression & CompressOptions::_COMPRESSOR_MASK) >> 4;
  274|       |
  275|  6.02k|            auto [negCompression, negCompressionWindow, negInflationWindow, negResponse] =
  276|  6.02k|            negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
  277|  6.02k|                                        secWebSocketExtensions);
  278|       |
  279|  6.02k|            if (negCompression) {
  ------------------
  |  Branch (279:17): [True: 3.74k, False: 2.27k]
  ------------------
  280|  3.74k|                perMessageDeflate = true;
  281|       |
  282|       |                /* Map from negotiated windowBits to compressor and decompressor */
  283|  3.74k|                if (negCompressionWindow == 0) {
  ------------------
  |  Branch (283:21): [True: 3.74k, False: 0]
  ------------------
  284|  3.74k|                    compressOptions = CompressOptions::SHARED_COMPRESSOR;
  285|  3.74k|                } else {
  286|      0|                    compressOptions = (CompressOptions) ((uint32_t) (negCompressionWindow << 4)
  287|      0|                                                        | (uint32_t) (negCompressionWindow - 7));
  288|       |
  289|       |                    /* If we are dedicated and have the 3kb then correct any 4kb to 3kb,
  290|       |                     * (they both share the windowBits = 9) */
  291|      0|                    if (webSocketContextData->compression & DEDICATED_COMPRESSOR_3KB) {
  ------------------
  |  Branch (291:25): [True: 0, False: 0]
  ------------------
  292|      0|                        compressOptions = DEDICATED_COMPRESSOR_3KB;
  293|      0|                    }
  294|      0|                }
  295|       |
  296|       |                /* Here we modify the above compression with negotiated decompressor */
  297|  3.74k|                if (negInflationWindow == 0) {
  ------------------
  |  Branch (297:21): [True: 3.74k, False: 0]
  ------------------
  298|  3.74k|                    compressOptions = CompressOptions(compressOptions | CompressOptions::SHARED_DECOMPRESSOR);
  299|  3.74k|                } else {
  300|      0|                    compressOptions = CompressOptions(compressOptions | (negInflationWindow << 8));
  301|      0|                }
  302|       |
  303|  3.74k|                writeHeader("Sec-WebSocket-Extensions", negResponse);
  304|  3.74k|            }
  305|  6.02k|        }
  306|       |
  307|  40.4k|        internalEnd({nullptr, 0}, 0, false, false);
  308|       |
  309|       |        /* Grab the httpContext from res */
  310|  40.4k|        HttpContext<SSL> *httpContext = (HttpContext<SSL> *) us_socket_context(SSL, (struct us_socket_t *) this);
  311|       |
  312|       |        /* Move any backpressure out of HttpResponse */
  313|  40.4k|        BackPressure backpressure(std::move(((AsyncSocketData<SSL> *) getHttpResponseData())->buffer));
  314|       |
  315|       |        /* Destroy HttpResponseData */
  316|  40.4k|        getHttpResponseData()->~HttpResponseData();
  317|       |
  318|       |        /* Before we adopt and potentially change socket, check if we are corked */
  319|  40.4k|        bool wasCorked = Super::isCorked();
  320|       |
  321|       |        /* Adopting a socket invalidates it, do not rely on it directly to carry any data */
  322|  40.4k|        WebSocket<SSL, true, UserData> *webSocket = (WebSocket<SSL, true, UserData> *) us_socket_context_adopt_socket(SSL,
  323|  40.4k|                    (us_socket_context_t *) webSocketContext, (us_socket_t *) this, sizeof(WebSocketData) + sizeof(UserData));
  324|       |
  325|       |        /* For whatever reason we were corked, update cork to the new socket */
  326|  40.4k|        if (wasCorked) {
  ------------------
  |  Branch (326:13): [True: 40.4k, False: 0]
  ------------------
  327|  40.4k|            webSocket->AsyncSocket<SSL>::corkUnchecked();
  328|  40.4k|        }
  329|       |
  330|       |        /* Initialize websocket with any moved backpressure intact */
  331|  40.4k|        webSocket->init(perMessageDeflate, compressOptions, std::move(backpressure));
  332|       |
  333|       |        /* We should only mark this if inside the parser; if upgrading "async" we cannot set this */
  334|  40.4k|        HttpContextData<SSL> *httpContextData = httpContext->getSocketContextData();
  335|  40.4k|        if (httpContextData->isParsingHttp) {
  ------------------
  |  Branch (335:13): [True: 40.4k, False: 0]
  ------------------
  336|       |            /* We need to tell the Http parser that we changed socket */
  337|  40.4k|            httpContextData->upgradedWebSocket = webSocket;
  338|  40.4k|        }
  339|       |
  340|       |        /* Arm maxLifetime timeout */
  341|  40.4k|        us_socket_long_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->maxLifetime);
  342|       |
  343|       |        /* Arm idleTimeout */
  344|  40.4k|        us_socket_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->idleTimeoutComponents.first);
  345|       |
  346|       |        /* Move construct the UserData right before calling open handler */
  347|  40.4k|        new (webSocket->getUserData()) UserData(std::move(userData));
  348|       |
  349|       |        /* Emit open event and start the timeout */
  350|  40.4k|        if (webSocketContextData->openHandler) {
  ------------------
  |  Branch (350:13): [True: 39.0k, False: 1.42k]
  ------------------
  351|  39.0k|            webSocketContextData->openHandler(webSocket);
  352|  39.0k|        }
  353|  40.4k|    }
_ZN3uWS12HttpResponseILb0EE5writeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  447|  6.54k|    bool write(std::string_view data) {
  448|  6.54k|        writeStatus(HTTP_200_OK);
  449|       |
  450|       |        /* Do not allow sending 0 chunks, they mark end of response */
  451|  6.54k|        if (!data.length()) {
  ------------------
  |  Branch (451:13): [True: 0, False: 6.54k]
  ------------------
  452|       |            /* If you called us, then according to you it was fine to call us so it's fine to still call us */
  453|      0|            return true;
  454|      0|        }
  455|       |
  456|  6.54k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  457|       |
  458|  6.54k|        if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED)) {
  ------------------
  |  Branch (458:13): [True: 3.99k, False: 2.55k]
  ------------------
  459|       |            /* Write mark on first call to write */
  460|  3.99k|            writeMark();
  461|       |
  462|  3.99k|            writeHeader("Transfer-Encoding", "chunked");
  463|  3.99k|            httpResponseData->state |= HttpResponseData<SSL>::HTTP_WRITE_CALLED;
  464|  3.99k|        }
  465|       |
  466|  6.54k|        Super::write("\r\n", 2);
  467|  6.54k|        writeUnsignedHex((unsigned int) data.length());
  468|  6.54k|        Super::write("\r\n", 2);
  469|       |
  470|  6.54k|        auto [written, failed] = Super::write(data.data(), (int) data.length());
  471|  6.54k|        if (failed) {
  ------------------
  |  Branch (471:13): [True: 834, False: 5.71k]
  ------------------
  472|    834|            Super::timeout(HTTP_TIMEOUT_S);
  473|    834|        }
  474|       |
  475|       |        /* If we did not fail the write, accept more */
  476|  6.54k|        return !failed;
  477|  6.54k|    }
_ZN3uWS12HttpResponseILb0EE9onAbortedEON5ofats13any_invocableIFvvEEE:
  563|  4.44k|    HttpResponse *onAborted(MoveOnlyFunction<void()> &&handler) {
  564|  4.44k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  565|       |
  566|  4.44k|        httpResponseData->onAborted = std::move(handler);
  567|  4.44k|        return this;
  568|  4.44k|    }
_ZN3uWS12HttpResponseILb0EE6onDataEON5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEbEEE:
  571|  4.44k|    void onData(MoveOnlyFunction<void(std::string_view, bool)> &&handler) {
  572|  4.44k|        HttpResponseData<SSL> *data = getHttpResponseData();
  573|  4.44k|        data->inStream = std::move(handler);
  574|       |
  575|       |        /* Always reset this counter here */
  576|  4.44k|        data->received_bytes_per_timeout = 0;
  577|  4.44k|    }
_ZN3uWS12HttpResponseILb0EE4corkEON5ofats13any_invocableIFvvEEE:
  501|  1.43k|    HttpResponse *cork(MoveOnlyFunction<void()> &&handler) {
  502|  1.43k|        if (!Super::isCorked() && Super::canCork()) {
  ------------------
  |  Branch (502:13): [True: 0, False: 1.43k]
  |  Branch (502:35): [True: 0, False: 0]
  ------------------
  503|      0|            LoopData *loopData = Super::getLoopData();
  504|      0|            Super::cork();
  505|      0|            handler();
  506|       |
  507|       |            /* The only way we could possibly have changed the corked socket during handler call, would be if 
  508|       |             * the HTTP socket was upgraded to WebSocket and caused a realloc. Because of this we cannot use "this"
  509|       |             * from here downwards. The corking is done with corkUnchecked() in upgrade. It steals cork. */
  510|      0|            auto *newCorkedSocket = loopData->corkedSocket;
  511|       |
  512|       |            /* If nobody is corked, it means most probably that large amounts of data has
  513|       |             * been written and the cork buffer has already been sent off and uncorked.
  514|       |             * We are done here, if that is the case. */
  515|      0|            if (!newCorkedSocket) {
  ------------------
  |  Branch (515:17): [True: 0, False: 0]
  ------------------
  516|      0|                return this;
  517|      0|            }
  518|       |
  519|       |            /* Timeout on uncork failure, since most writes will succeed while corked */
  520|      0|            auto [written, failed] = static_cast<Super *>(newCorkedSocket)->uncork();
  521|       |
  522|       |            /* If we are no longer an HTTP socket then early return the new "this".
  523|       |             * We don't want to even overwrite timeout as it is set in upgrade already. */
  524|      0|            if (this != newCorkedSocket) {
  ------------------
  |  Branch (524:17): [True: 0, False: 0]
  ------------------
  525|      0|                return static_cast<HttpResponse *>(newCorkedSocket);
  526|      0|            }
  527|       |
  528|      0|            if (failed) {
  ------------------
  |  Branch (528:17): [True: 0, False: 0]
  ------------------
  529|       |                /* For now we only have one single timeout so let's use it */
  530|       |                /* This behavior should equal the behavior in HttpContext when uncorking fails */
  531|      0|                Super::timeout(HTTP_TIMEOUT_S);
  532|      0|            }
  533|       |
  534|       |            /* If we have no backbuffer and we are connection close and we responded fully then close */
  535|      0|            HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  536|      0|            if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (536:17): [True: 0, False: 0]
  ------------------
  537|      0|                if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (537:21): [True: 0, False: 0]
  ------------------
  538|      0|                    if (((AsyncSocket<SSL> *) this)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (538:25): [True: 0, False: 0]
  ------------------
  539|      0|                        ((AsyncSocket<SSL> *) this)->shutdown();
  540|       |                        /* We need to force close after sending FIN since we want to hinder
  541|       |                        * clients from keeping to send their huge data */
  542|      0|                        ((AsyncSocket<SSL> *) this)->close();
  543|      0|                    }
  544|      0|                }
  545|      0|            }
  546|  1.43k|        } else {
  547|       |            /* We are already corked, or can't cork so let's just call the handler */
  548|  1.43k|            handler();
  549|  1.43k|        }
  550|       |
  551|  1.43k|        return this;
  552|  1.43k|    }

_ZN3uWS16HttpResponseDataILb0EE8markDoneEv:
   37|  63.2k|    void markDone() {
   38|  63.2k|        onAborted = nullptr;
   39|       |        /* Also remove onWritable so that we do not emit when draining behind the scenes. */
   40|  63.2k|        onWritable = nullptr;
   41|       |
   42|       |        /* We are done with this request */
   43|  63.2k|        state &= ~HttpResponseData<SSL>::HTTP_RESPONSE_PENDING;
   44|  63.2k|    }

_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEEC2Ev:
  243|  6.94k|    HttpRouter() {
  244|       |        /* Always have ANY route */
  245|  6.94k|        getNode(&root, std::string(ANY_METHOD_TOKEN.data(), ANY_METHOD_TOKEN.length()), false);
  246|  6.94k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE4NodeC2ENSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
   63|  76.3k|        Node(std::string name) : name(name) {}
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE7getNodeEPNS4_4NodeENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEb:
   81|  97.1k|    Node *getNode(Node *parent, std::string child, bool isHighPriority) {
   82|  97.1k|        for (std::unique_ptr<Node> &node : parent->children) {
  ------------------
  |  Branch (82:42): [True: 90.2k, False: 69.4k]
  ------------------
   83|  90.2k|            if (node->name == child && node->isHighPriority == isHighPriority) {
  ------------------
  |  Branch (83:17): [True: 34.7k, False: 55.5k]
  |  Branch (83:40): [True: 27.7k, False: 6.94k]
  ------------------
   84|  27.7k|                return node.get();
   85|  27.7k|            }
   86|  90.2k|        }
   87|       |
   88|       |        /* Insert sorted, but keep order if parent is root (we sort methods by priority elsewhere) */
   89|  69.4k|        std::unique_ptr<Node> newNode(new Node(child));
   90|  69.4k|        newNode->isHighPriority = isHighPriority;
   91|  69.4k|        return parent->children.emplace(std::upper_bound(parent->children.begin(), parent->children.end(), newNode, [parent, this](auto &a, auto &b) {
   92|       |
   93|  69.4k|            if (a->isHighPriority != b->isHighPriority) {
   94|  69.4k|                return a->isHighPriority;
   95|  69.4k|            }
   96|       |
   97|  69.4k|            return b->name.length() && (parent != &root) && (lexicalOrder(b->name) < lexicalOrder(a->name));
   98|  69.4k|        }), std::move(newNode))->get();
   99|  97.1k|    }
_ZZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE7getNodeEPNS4_4NodeENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEbENKUlRT_RT0_E_clIKNS7_10unique_ptrIS5_NS7_14default_deleteIS5_EEEESN_EEDaSF_SH_:
   91|  41.6k|        return parent->children.emplace(std::upper_bound(parent->children.begin(), parent->children.end(), newNode, [parent, this](auto &a, auto &b) {
   92|       |
   93|  41.6k|            if (a->isHighPriority != b->isHighPriority) {
  ------------------
  |  Branch (93:17): [True: 13.8k, False: 27.7k]
  ------------------
   94|  13.8k|                return a->isHighPriority;
   95|  13.8k|            }
   96|       |
   97|  27.7k|            return b->name.length() && (parent != &root) && (lexicalOrder(b->name) < lexicalOrder(a->name));
  ------------------
  |  Branch (97:20): [True: 27.7k, False: 0]
  |  Branch (97:40): [True: 13.8k, False: 13.8k]
  |  Branch (97:61): [True: 6.94k, False: 6.94k]
  ------------------
   98|  41.6k|        }), std::move(newNode))->get();
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE12lexicalOrderERNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
   67|  27.7k|    int lexicalOrder(std::string &name) {
   68|  27.7k|        if (!name.length()) {
  ------------------
  |  Branch (68:13): [True: 0, False: 27.7k]
  ------------------
   69|      0|            return 2;
   70|      0|        }
   71|  27.7k|        if (name[0] == ':') {
  ------------------
  |  Branch (71:13): [True: 6.94k, False: 20.8k]
  ------------------
   72|  6.94k|            return 1;
   73|  6.94k|        }
   74|  20.8k|        if (name[0] == '*') {
  ------------------
  |  Branch (74:13): [True: 13.8k, False: 6.94k]
  ------------------
   75|  13.8k|            return 0;
   76|  13.8k|        }
   77|  6.94k|        return 2;
   78|  20.8k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE11getUserDataEv:
  252|   146k|    USERDATA &getUserData() {
  253|   146k|        return userData;
  254|   146k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE5routeENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEES9_:
  257|  67.2k|    bool route(std::string_view method, std::string_view url) {
  258|       |        /* Reset url parsing cache */
  259|  67.2k|        setUrl(url);
  260|  67.2k|        routeParameters.reset();
  261|       |
  262|       |        /* Begin by finding the method node */
  263|  93.9k|        for (auto &p : root.children) {
  ------------------
  |  Branch (263:22): [True: 93.9k, False: 11.1k]
  ------------------
  264|  93.9k|            if (p->name == method) {
  ------------------
  |  Branch (264:17): [True: 56.1k, False: 37.8k]
  ------------------
  265|       |                /* Then route the url */
  266|  56.1k|                if (executeHandlers(p.get(), 0, userData)) {
  ------------------
  |  Branch (266:21): [True: 56.1k, False: 0]
  ------------------
  267|  56.1k|                    return true;
  268|  56.1k|                } else {
  269|      0|                    break;
  270|      0|                }
  271|  56.1k|            }
  272|  93.9k|        }
  273|       |
  274|       |        /* Always test any route last (this check should not be necessary if we always have at least one handler) */
  275|  11.1k|        if (root.children.empty()) [[unlikely]] {
  ------------------
  |  Branch (275:13): [True: 0, False: 11.1k]
  ------------------
  276|      0|            return false;
  277|      0|        }
  278|  11.1k|        return executeHandlers(root.children.back().get(), 0, userData);
  279|  11.1k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE6setUrlENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  124|   136k|    inline void setUrl(std::string_view url) {
  125|       |
  126|       |        /* Todo: URL may also start with "http://domain/" or "*", not only "/" */
  127|       |
  128|       |        /* We expect to stand on a slash */
  129|   136k|        currentUrl = url;
  130|   136k|        urlSegmentTop = -1;
  131|   136k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters5resetEv:
  108|  67.2k|        void reset() {
  109|  67.2k|            paramsTop = -1;
  110|  67.2k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15executeHandlersEPNS4_4NodeEiRS3_:
  168|  73.2k|    bool executeHandlers(Node *parent, int urlSegment, USERDATA &userData) {
  169|       |
  170|  73.2k|        auto [segment, isStop] = getUrlSegment(urlSegment);
  171|       |
  172|       |        /* If we are on STOP, return where we may stand */
  173|  73.2k|        if (isStop) {
  ------------------
  |  Branch (173:13): [True: 3.44k, False: 69.7k]
  ------------------
  174|       |            /* We have reached accross the entire URL with no stoppage, execute */
  175|  3.44k|            for (uint32_t handler : parent->handlers) {
  ------------------
  |  Branch (175:35): [True: 2.42k, False: 2.01k]
  ------------------
  176|  2.42k|                if (handlers[handler & HANDLER_MASK](this)) {
  ------------------
  |  Branch (176:21): [True: 1.42k, False: 1.00k]
  ------------------
  177|  1.42k|                    return true;
  178|  1.42k|                }
  179|  2.42k|            }
  180|       |            /* We reached the end, so go back */
  181|  2.01k|            return false;
  182|  3.44k|        }
  183|       |
  184|   139k|        for (auto &p : parent->children) {
  ------------------
  |  Branch (184:22): [True: 139k, False: 195]
  ------------------
  185|   139k|            if (p->name.length() && p->name[0] == '*') {
  ------------------
  |  Branch (185:17): [True: 139k, False: 0]
  |  Branch (185:37): [True: 77.0k, False: 62.8k]
  ------------------
  186|       |                /* Wildcard match (can be seen as a shortcut) */
  187|  77.0k|                for (uint32_t handler : p->handlers) {
  ------------------
  |  Branch (187:39): [True: 77.0k, False: 11.1k]
  ------------------
  188|  77.0k|                    if (handlers[handler & HANDLER_MASK](this)) {
  ------------------
  |  Branch (188:25): [True: 65.8k, False: 11.1k]
  ------------------
  189|  65.8k|                        return true;
  190|  65.8k|                    }
  191|  77.0k|                }
  192|  77.0k|            } else if (p->name.length() && p->name[0] == ':' && segment.length()) {
  ------------------
  |  Branch (192:24): [True: 62.8k, False: 0]
  |  Branch (192:44): [True: 11.1k, False: 51.6k]
  |  Branch (192:65): [True: 3.32k, False: 7.79k]
  ------------------
  193|       |                /* Parameter match */
  194|  3.32k|                routeParameters.push(segment);
  195|  3.32k|                if (executeHandlers(p.get(), urlSegment + 1, userData)) {
  ------------------
  |  Branch (195:21): [True: 2.31k, False: 1.01k]
  ------------------
  196|  2.31k|                    return true;
  197|  2.31k|                }
  198|  1.01k|                routeParameters.pop();
  199|  59.4k|            } else if (p->name == segment) {
  ------------------
  |  Branch (199:24): [True: 2.62k, False: 56.8k]
  ------------------
  200|       |                /* Static match */
  201|  2.62k|                if (executeHandlers(p.get(), urlSegment + 1, userData)) {
  ------------------
  |  Branch (201:21): [True: 1.42k, False: 1.20k]
  ------------------
  202|  1.42k|                    return true;
  203|  1.42k|                }
  204|  2.62k|            }
  205|   139k|        }
  206|    195|        return false;
  207|  69.7k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE13getUrlSegmentEi:
  134|   267k|    inline std::pair<std::string_view, bool> getUrlSegment(int urlSegment) {
  135|   267k|        if (urlSegment > urlSegmentTop) {
  ------------------
  |  Branch (135:13): [True: 191k, False: 76.3k]
  ------------------
  136|       |            /* Signal as STOP when we have no more URL or stack space */
  137|   191k|            if (!currentUrl.length() || urlSegment > int(MAX_URL_SEGMENTS - 1)) {
  ------------------
  |  Branch (137:17): [True: 45.0k, False: 146k]
  |  Branch (137:41): [True: 0, False: 146k]
  ------------------
  138|  45.0k|                return {{}, true};
  139|  45.0k|            }
  140|       |
  141|       |            /* We always stand on a slash here, so step over it */
  142|   146k|            currentUrl.remove_prefix(1);
  143|       |
  144|   146k|            auto segmentLength = currentUrl.find('/');
  145|   146k|            if (segmentLength == std::string::npos) {
  ------------------
  |  Branch (145:17): [True: 127k, False: 18.4k]
  ------------------
  146|   127k|                segmentLength = currentUrl.length();
  147|       |
  148|       |                /* Push to url segment vector */
  149|   127k|                urlSegmentVector[urlSegment] = currentUrl.substr(0, segmentLength);
  150|   127k|                urlSegmentTop++;
  151|       |
  152|       |                /* Update currentUrl */
  153|   127k|                currentUrl = currentUrl.substr(segmentLength);
  154|   127k|            } else {
  155|       |                /* Push to url segment vector */
  156|  18.4k|                urlSegmentVector[urlSegment] = currentUrl.substr(0, segmentLength);
  157|  18.4k|                urlSegmentTop++;
  158|       |
  159|       |                /* Update currentUrl */
  160|  18.4k|                currentUrl = currentUrl.substr(segmentLength);
  161|  18.4k|            }
  162|   146k|        }
  163|       |        /* In any case we return it */
  164|   222k|        return {urlSegmentVector[urlSegment], false};
  165|   267k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters4pushENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  112|  3.32k|        void push(std::string_view param) {
  113|       |            /* We check these bounds indirectly via the urlSegments limit */
  114|  3.32k|            params[++paramsTop] = param;
  115|  3.32k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters3popEv:
  117|  1.01k|        void pop() {
  118|       |            /* Same here, we cannot pop outside */
  119|  1.01k|            paramsTop--;
  120|  1.01k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE6removeENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESB_j:
  362|  41.6k|    bool remove(std::string method, std::string pattern, uint32_t priority) {
  363|  41.6k|        uint32_t handler = findHandler(method, pattern, priority);
  364|  41.6k|        if (handler == UINT32_MAX) {
  ------------------
  |  Branch (364:13): [True: 41.6k, False: 0]
  ------------------
  365|       |            /* Not found or already removed, do nothing */
  366|  41.6k|            return false;
  367|  41.6k|        }
  368|       |
  369|       |        /* Cull the entire tree */
  370|       |        /* For all nodes in depth first tree traveral;
  371|       |         * if node contains handler - remove the handler -
  372|       |         * if node holds no handlers after removal, remove the node and return */
  373|      0|        cullNode(nullptr, &root, handler);
  374|       |
  375|       |        /* Now remove the actual handler */
  376|      0|        handlers.erase(handlers.begin() + (handler & HANDLER_MASK));
  377|       |
  378|      0|        return true;
  379|  41.6k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE11findHandlerENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESB_j:
  210|  41.6k|    uint32_t findHandler(std::string method, std::string pattern, uint32_t priority) {
  211|  62.4k|        for (std::unique_ptr<Node> &node : root.children) {
  ------------------
  |  Branch (211:42): [True: 62.4k, False: 13.8k]
  ------------------
  212|  62.4k|            if (method == node->name) {
  ------------------
  |  Branch (212:17): [True: 27.7k, False: 34.7k]
  ------------------
  213|  27.7k|                setUrl(pattern);
  214|  27.7k|                Node *n = node.get();
  215|  27.7k|                for (int i = 0; !getUrlSegment(i).second; i++) {
  ------------------
  |  Branch (215:33): [True: 27.7k, False: 0]
  ------------------
  216|       |                    /* Go to next segment or quit */
  217|  27.7k|                    std::string segment = std::string(getUrlSegment(i).first);
  218|  27.7k|                    Node *next = nullptr;
  219|  27.7k|                    for (std::unique_ptr<Node> &child : n->children) {
  ------------------
  |  Branch (219:55): [True: 27.7k, False: 27.7k]
  ------------------
  220|  27.7k|                        if (((segment.length() && child->name.length() && segment[0] == ':' && child->name[0] == ':') || child->name == segment) && child->isHighPriority == (priority == HIGH_PRIORITY)) {
  ------------------
  |  Branch (220:31): [True: 27.7k, False: 0]
  |  Branch (220:51): [True: 27.7k, False: 0]
  |  Branch (220:75): [True: 6.94k, False: 20.8k]
  |  Branch (220:96): [True: 0, False: 6.94k]
  |  Branch (220:122): [True: 6.94k, False: 20.8k]
  |  Branch (220:149): [True: 0, False: 6.94k]
  ------------------
  221|      0|                            next = child.get();
  222|      0|                            break;
  223|      0|                        }
  224|  27.7k|                    }
  225|  27.7k|                    if (!next) {
  ------------------
  |  Branch (225:25): [True: 27.7k, False: 0]
  ------------------
  226|  27.7k|                        return UINT32_MAX;
  227|  27.7k|                    }
  228|      0|                    n = next;
  229|      0|                }
  230|       |                /* Seek for a priority match in the found node */
  231|      0|                for (unsigned int i = 0; i < n->handlers.size(); i++) {
  ------------------
  |  Branch (231:42): [True: 0, False: 0]
  ------------------
  232|      0|                    if ((n->handlers[i] & ~HANDLER_MASK) == priority) {
  ------------------
  |  Branch (232:25): [True: 0, False: 0]
  ------------------
  233|      0|                        return n->handlers[i];
  234|      0|                    }
  235|      0|                }
  236|      0|                return UINT32_MAX;
  237|      0|            }
  238|  62.4k|        }
  239|  13.8k|        return UINT32_MAX;
  240|  41.6k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE3addENSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESC_ON5ofats13any_invocableIFbPS4_EEEj:
  282|  41.6k|    void add(std::vector<std::string> methods, std::string pattern, MoveOnlyFunction<bool(HttpRouter *)> &&handler, uint32_t priority = MEDIUM_PRIORITY) {
  283|       |        /* First remove existing handler */
  284|  41.6k|        remove(methods[0], pattern, priority);
  285|       |        
  286|  41.6k|        for (std::string method : methods) {
  ------------------
  |  Branch (286:33): [True: 41.6k, False: 41.6k]
  ------------------
  287|       |            /* Lookup method */
  288|  41.6k|            Node *node = getNode(&root, method, false);
  289|       |            /* Iterate over all segments */
  290|  41.6k|            setUrl(pattern);
  291|  90.2k|            for (int i = 0; !getUrlSegment(i).second; i++) {
  ------------------
  |  Branch (291:29): [True: 48.5k, False: 41.6k]
  ------------------
  292|  48.5k|                std::string strippedSegment(getUrlSegment(i).first);
  293|  48.5k|                if (strippedSegment.length() && strippedSegment[0] == ':') {
  ------------------
  |  Branch (293:21): [True: 48.5k, False: 0]
  |  Branch (293:49): [True: 6.94k, False: 41.6k]
  ------------------
  294|       |                    /* Parameter routes must be named only : */
  295|  6.94k|                    strippedSegment = ":";
  296|  6.94k|                }
  297|  48.5k|                node = getNode(node, strippedSegment, priority == HIGH_PRIORITY);
  298|  48.5k|            }
  299|       |            /* Insert handler in order sorted by priority (most significant 1 byte) */
  300|  41.6k|            node->handlers.insert(std::upper_bound(node->handlers.begin(), node->handlers.end(), (uint32_t) (priority | handlers.size())), (uint32_t) (priority | handlers.size()));
  301|  41.6k|        }
  302|       |
  303|       |        /* Alloate this handler */
  304|  41.6k|        handlers.emplace_back(std::move(handler));
  305|       |
  306|       |        /* ANY method must be last, GET must be first */
  307|  41.6k|        std::sort(root.children.begin(), root.children.end(), [](const auto &a, const auto &b) {
  308|  41.6k|            if (a->name == "GET" && b->name != "GET") {
  309|  41.6k|                return true;
  310|  41.6k|            } else if (b->name == "GET" && a->name != "GET") {
  311|  41.6k|                return false;
  312|  41.6k|            } else if (a->name == ANY_METHOD_TOKEN && b->name != ANY_METHOD_TOKEN) {
  313|  41.6k|                return false;
  314|  41.6k|            } else if (b->name == ANY_METHOD_TOKEN && a->name != ANY_METHOD_TOKEN) {
  315|  41.6k|                return true;
  316|  41.6k|            } else {
  317|  41.6k|                return a->name < b->name;
  318|  41.6k|            }
  319|  41.6k|        });
  320|  41.6k|    }
_ZZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE3addENSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESC_ON5ofats13any_invocableIFbPS4_EEEjENKUlRKT_RKT0_E_clINS5_10unique_ptrINS4_4NodeENS5_14default_deleteISU_EEEESX_EEDaSN_SQ_:
  307|  62.4k|        std::sort(root.children.begin(), root.children.end(), [](const auto &a, const auto &b) {
  308|  62.4k|            if (a->name == "GET" && b->name != "GET") {
  ------------------
  |  Branch (308:17): [True: 6.94k, False: 55.5k]
  |  Branch (308:37): [True: 6.94k, False: 0]
  ------------------
  309|  6.94k|                return true;
  310|  55.5k|            } else if (b->name == "GET" && a->name != "GET") {
  ------------------
  |  Branch (310:24): [True: 34.7k, False: 20.8k]
  |  Branch (310:44): [True: 34.7k, False: 0]
  ------------------
  311|  34.7k|                return false;
  312|  34.7k|            } else if (a->name == ANY_METHOD_TOKEN && b->name != ANY_METHOD_TOKEN) {
  ------------------
  |  Branch (312:24): [True: 13.8k, False: 6.94k]
  |  Branch (312:55): [True: 13.8k, False: 0]
  ------------------
  313|  13.8k|                return false;
  314|  13.8k|            } else if (b->name == ANY_METHOD_TOKEN && a->name != ANY_METHOD_TOKEN) {
  ------------------
  |  Branch (314:24): [True: 6.94k, False: 0]
  |  Branch (314:55): [True: 6.94k, False: 0]
  ------------------
  315|  6.94k|                return true;
  316|  6.94k|            } else {
  317|      0|                return a->name < b->name;
  318|      0|            }
  319|  62.4k|        });
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE13getParametersEv:
  248|  79.4k|    std::pair<int, std::string_view *> getParameters() {
  249|  79.4k|        return {routeParameters.paramsTop, routeParameters.params};
  250|  79.4k|    }

_ZN3uWS4Loop3getEPv:
  145|  86.3k|    static Loop *get(void *existingNativeLoop = nullptr) {
  146|  86.3k|        if (!getLazyLoop().loop) {
  ------------------
  |  Branch (146:13): [True: 6.94k, False: 79.3k]
  ------------------
  147|       |            /* If we are given a native loop pointer we pass that to uSockets and let it deal with it */
  148|  6.94k|            if (existingNativeLoop) {
  ------------------
  |  Branch (148:17): [True: 0, False: 6.94k]
  ------------------
  149|       |                /* Todo: here we want to pass the pointer, not a boolean */
  150|      0|                getLazyLoop().loop = create(existingNativeLoop);
  151|       |                /* We cannot register automatic free here, must be manually done */
  152|  6.94k|            } else {
  153|  6.94k|                getLazyLoop().loop = create(nullptr);
  154|  6.94k|                getLazyLoop().cleanMe = true;
  155|  6.94k|            }
  156|  6.94k|        }
  157|       |
  158|  86.3k|        return getLazyLoop().loop;
  159|  86.3k|    }
_ZN3uWS4Loop11getLazyLoopEv:
  112|   193k|    static LoopCleaner &getLazyLoop() {
  113|   193k|        static thread_local LoopCleaner lazyLoop;
  114|   193k|        return lazyLoop;
  115|   193k|    }
_ZN3uWS4Loop11LoopCleanerD2Ev:
  103|      1|        ~LoopCleaner() {
  104|      1|            if(loop && cleanMe) {
  ------------------
  |  Branch (104:16): [True: 0, False: 1]
  |  Branch (104:24): [True: 0, False: 0]
  ------------------
  105|      0|                loop->free();
  106|      0|            }
  107|      1|        }
_ZN3uWS4Loop6createEPv:
   85|  6.94k|    static Loop *create(void *hint) {
   86|  6.94k|        Loop *loop = ((Loop *) us_create_loop(hint, wakeupCb, preCb, postCb, sizeof(LoopData)))->init();
   87|       |
   88|       |        /* We also need some timers (should live off the one 4 second timer rather) */
   89|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((struct us_loop_t *) loop);
   90|  6.94k|        loopData->dateTimer = us_create_timer((struct us_loop_t *) loop, 1, sizeof(LoopData *));
   91|  6.94k|        memcpy(us_timer_ext(loopData->dateTimer), &loopData, sizeof(LoopData *));
   92|  6.94k|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   93|  6.94k|            LoopData *loopData;
   94|  6.94k|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   95|  6.94k|            loopData->updateDate();
   96|  6.94k|        }, 1000, 1000);
   97|       |
   98|  6.94k|        return loop;
   99|  6.94k|    }
_ZN3uWS4Loop8wakeupCbEP9us_loop_t:
   39|  2.66M|    static void wakeupCb(us_loop_t *loop) {
   40|  2.66M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   41|       |
   42|       |        /* Swap current deferQueue */
   43|  2.66M|        loopData->deferMutex.lock();
   44|  2.66M|        int oldDeferQueue = loopData->currentDeferQueue;
   45|  2.66M|        loopData->currentDeferQueue = (loopData->currentDeferQueue + 1) % 2;
   46|  2.66M|        loopData->deferMutex.unlock();
   47|       |
   48|       |        /* Drain the queue */
   49|  2.66M|        for (auto &x : loopData->deferQueues[oldDeferQueue]) {
  ------------------
  |  Branch (49:22): [True: 7.87k, False: 2.66M]
  ------------------
   50|  7.87k|            x();
   51|  7.87k|        }
   52|  2.66M|        loopData->deferQueues[oldDeferQueue].clear();
   53|  2.66M|    }
_ZN3uWS4Loop5preCbEP9us_loop_t:
   55|  3.36M|    static void preCb(us_loop_t *loop) {
   56|  3.36M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   57|       |
   58|  3.36M|        for (auto &p : loopData->preHandlers) {
  ------------------
  |  Branch (58:22): [True: 3.36M, False: 3.36M]
  ------------------
   59|  3.36M|            p.second((Loop *) loop);
   60|  3.36M|        }
   61|  3.36M|    }
_ZN3uWS4Loop6postCbEP9us_loop_t:
   63|  3.36M|    static void postCb(us_loop_t *loop) {
   64|  3.36M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   65|       |
   66|  3.36M|        for (auto &p : loopData->postHandlers) {
  ------------------
  |  Branch (66:22): [True: 3.36M, False: 3.36M]
  ------------------
   67|  3.36M|            p.second((Loop *) loop);
   68|  3.36M|        }
   69|       |
   70|       |        /* After every event loop iteration, we must not hold the cork buffer */
   71|  3.36M|        if (loopData->corkedSocket) {
  ------------------
  |  Branch (71:13): [True: 0, False: 3.36M]
  ------------------
   72|      0|            std::cerr << "Error: Cork buffer must not be held across event loop iterations!" << std::endl;
   73|      0|            std::terminate();
   74|      0|        }
   75|  3.36M|    }
_ZN3uWS4Loop4initEv:
   80|  6.94k|    Loop *init() {
   81|  6.94k|        new (us_loop_ext((us_loop_t *) this)) LoopData;
   82|  6.94k|        return this;
   83|  6.94k|    }
_ZZN3uWS4Loop6createEPvENKUlP10us_timer_tE_clES3_:
   92|  2.70M|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   93|  2.70M|            LoopData *loopData;
   94|  2.70M|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   95|  2.70M|            loopData->updateDate();
   96|  2.70M|        }, 1000, 1000);
_ZN3uWS4Loop9setSilentEb:
  226|  6.94k|    void setSilent(bool silent) {
  227|  6.94k|        ((LoopData *) us_loop_ext((us_loop_t *) this))->noMark = silent;
  228|  6.94k|    }
_ZN3uWS4Loop4freeEv:
  162|  6.94k|    void free() {
  163|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  164|       |
  165|       |        /* Stop and free dateTimer first */
  166|  6.94k|        us_timer_close(loopData->dateTimer);
  167|       |
  168|  6.94k|        loopData->~LoopData();
  169|       |        /* uSockets will track whether this loop is owned by us or a borrowed alien loop */
  170|  6.94k|        us_loop_free((us_loop_t *) this);
  171|       |
  172|       |        /* Reset lazyLoop */
  173|  6.94k|        getLazyLoop().loop = nullptr;
  174|  6.94k|    }
_ZN3uWS4Loop17removePostHandlerEPv:
  183|  6.94k|    void removePostHandler(void *key) {
  184|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  185|       |
  186|  6.94k|        loopData->postHandlers.erase(key);
  187|  6.94k|    }
_ZN3uWS4Loop16removePreHandlerEPv:
  196|  6.94k|    void removePreHandler(void *key) {
  197|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  198|       |
  199|  6.94k|        loopData->preHandlers.erase(key);
  200|  6.94k|    }
_ZN3uWS4Loop14addPostHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  176|  6.94k|    void addPostHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  177|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  178|       |
  179|  6.94k|        loopData->postHandlers.emplace(key, std::move(handler));
  180|  6.94k|    }
_ZN3uWS4Loop13addPreHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  189|  6.94k|    void addPreHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  190|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  191|       |
  192|  6.94k|        loopData->preHandlers.emplace(key, std::move(handler));
  193|  6.94k|    }
_ZN3uWS4Loop5deferEON5ofats13any_invocableIFvvEEE:
  203|  9.97k|    void defer(MoveOnlyFunction<void()> &&cb) {
  204|  9.97k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  205|       |
  206|       |        //if (std::thread::get_id() == ) // todo: add fast path for same thread id
  207|  9.97k|        loopData->deferMutex.lock();
  208|  9.97k|        loopData->deferQueues[loopData->currentDeferQueue].emplace_back(std::move(cb));
  209|  9.97k|        loopData->deferMutex.unlock();
  210|       |
  211|  9.97k|        us_wakeup_loop((us_loop_t *) this);
  212|  9.97k|    }
_ZN3uWS3runEv:
  232|  6.94k|inline void run() {
  233|  6.94k|    Loop::get()->run();
  234|  6.94k|}
_ZN3uWS4Loop3runEv:
  215|  6.94k|    void run() {
  216|  6.94k|        us_loop_run((us_loop_t *) this);
  217|  6.94k|    }

_ZN3uWS8LoopDataC2Ev:
   49|  6.94k|    LoopData() {
   50|  6.94k|        updateDate();
   51|  6.94k|    }
_ZN3uWS8LoopData10updateDateEv:
   63|  2.71M|    void updateDate() {
   64|  2.71M|        cacheTimepoint = time(0);
   65|  2.71M|        struct tm tstruct = {};
   66|       |#ifdef _WIN32
   67|       |        /* Micro, fucking soft never follows spec. */
   68|       |        gmtime_s(&tstruct, &cacheTimepoint);
   69|       |#else
   70|  2.71M|        gmtime_r(&cacheTimepoint, &tstruct);
   71|  2.71M|#endif
   72|  2.71M|        static const char wday_name[][4] = {
   73|  2.71M|            "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
   74|  2.71M|        };
   75|  2.71M|        static const char mon_name[][4] = {
   76|  2.71M|            "Jan", "Feb", "Mar", "Apr", "May", "Jun",
   77|  2.71M|            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
   78|  2.71M|        };
   79|  2.71M|        snprintf(date, 32, "%.3s, %.2u %.3s %.4u %.2u:%.2u:%.2u GMT",
   80|  2.71M|            wday_name[tstruct.tm_wday],
   81|  2.71M|            tstruct.tm_mday % 99,
   82|  2.71M|            mon_name[tstruct.tm_mon],
   83|  2.71M|            (1900 + tstruct.tm_year) % 9999,
   84|  2.71M|            tstruct.tm_hour % 99,
   85|  2.71M|            tstruct.tm_min % 99,
   86|  2.71M|            tstruct.tm_sec % 99);
   87|  2.71M|    }
_ZN3uWS8LoopDataD2Ev:
   53|  6.94k|    ~LoopData() {
   54|       |        /* If we have had App.ws called with compression we need to clear this */
   55|  6.94k|        if (zlibContext) {
  ------------------
  |  Branch (55:13): [True: 6.94k, False: 0]
  ------------------
   56|  6.94k|            delete zlibContext;
   57|  6.94k|            delete inflationStream;
   58|  6.94k|            delete deflationStream;
   59|  6.94k|        }
   60|  6.94k|        delete [] corkBuffer;
   61|  6.94k|    }

_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EDn:
  190|  13.8k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EDn:
  190|  41.6k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EDn:
  190|  48.5k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  190|  41.6k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EDn:
  190|  27.7k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  190|  20.8k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEED2Ev:
  209|  6.94k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE7destroyEv:
  242|  6.94k|  void destroy() noexcept {
  243|  6.94k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 6.94k, False: 0]
  ------------------
  244|  6.94k|      handle_(action::destroy, &storage_, nullptr);
  245|  6.94k|      handle_ = nullptr;
  246|  6.94k|    }
  247|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  209|  69.4k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  242|  69.4k|  void destroy() noexcept {
  243|  69.4k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 6.94k, False: 62.4k]
  ------------------
  244|  6.94k|      handle_(action::destroy, &storage_, nullptr);
  245|  6.94k|      handle_ = nullptr;
  246|  6.94k|    }
  247|  69.4k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEED2Ev:
  209|  69.4k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE7destroyEv:
  242|  69.4k|  void destroy() noexcept {
  243|  69.4k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 0, False: 69.4k]
  ------------------
  244|      0|      handle_(action::destroy, &storage_, nullptr);
  245|      0|      handle_ = nullptr;
  246|      0|    }
  247|  69.4k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  209|   138k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  242|   138k|  void destroy() noexcept {
  243|   138k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 13.8k, False: 124k]
  ------------------
  244|  13.8k|      handle_(action::destroy, &storage_, nullptr);
  245|  13.8k|      handle_ = nullptr;
  246|  13.8k|    }
  247|   138k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEED2Ev:
  209|   138k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE7destroyEv:
  242|   138k|  void destroy() noexcept {
  243|   138k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 13.8k, False: 124k]
  ------------------
  244|  13.8k|      handle_(action::destroy, &storage_, nullptr);
  245|  13.8k|      handle_ = nullptr;
  246|  13.8k|    }
  247|   138k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEED2Ev:
  209|   138k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE7destroyEv:
  242|   138k|  void destroy() noexcept {
  243|   138k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 6.94k, False: 131k]
  ------------------
  244|  6.94k|      handle_(action::destroy, &storage_, nullptr);
  245|  6.94k|      handle_ = nullptr;
  246|  6.94k|    }
  247|   138k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEED2Ev:
  209|  41.6k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEE7destroyEv:
  242|  41.6k|  void destroy() noexcept {
  243|  41.6k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 0, False: 41.6k]
  ------------------
  244|      0|      handle_(action::destroy, &storage_, nullptr);
  245|      0|      handle_ = nullptr;
  246|      0|    }
  247|  41.6k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEED2Ev:
  209|   124k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE7destroyEv:
  242|   124k|  void destroy() noexcept {
  243|   124k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 41.6k, False: 83.3k]
  ------------------
  244|  41.6k|      handle_(action::destroy, &storage_, nullptr);
  245|  41.6k|      handle_ = nullptr;
  246|  41.6k|    }
  247|   124k|  }
_ZN5ofats13any_invocableIFvvEEclEv:
  348|  26.2k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  26.2k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  26.2k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4callEv:
  249|  26.2k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  26.2k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  26.2k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEED2Ev:
  209|  1.51M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE7destroyEv:
  242|  1.51M|  void destroy() noexcept {
  243|  1.51M|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 29.7k, False: 1.48M]
  ------------------
  244|  29.7k|      handle_(action::destroy, &storage_, nullptr);
  245|  29.7k|      handle_ = nullptr;
  246|  29.7k|    }
  247|  1.51M|  }
_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEclES3_:
  348|  6.73M|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  6.73M|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  6.73M|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE4callES4_:
  249|  6.73M|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  6.73M|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  6.73M|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEED2Ev:
  209|  27.7k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE7destroyEv:
  242|  27.7k|  void destroy() noexcept {
  243|  27.7k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 13.8k, False: 13.8k]
  ------------------
  244|  13.8k|      handle_(action::destroy, &storage_, nullptr);
  245|  13.8k|      handle_ = nullptr;
  246|  13.8k|    }
  247|  27.7k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EDn:
  190|  6.94k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEED2Ev:
  209|  20.8k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE7destroyEv:
  242|  20.8k|  void destroy() noexcept {
  243|  20.8k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 0, False: 20.8k]
  ------------------
  244|      0|      handle_(action::destroy, &storage_, nullptr);
  245|      0|      handle_ = nullptr;
  246|      0|    }
  247|  20.8k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2Ev:
  189|  6.94k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEED2Ev:
  209|   131k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE7destroyEv:
  242|   131k|  void destroy() noexcept {
  243|   131k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 41.6k, False: 90.2k]
  ------------------
  244|  41.6k|      handle_(action::destroy, &storage_, nullptr);
  245|  41.6k|      handle_ = nullptr;
  246|  41.6k|    }
  247|   131k|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2Ev:
  189|  1.37M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2Ev:
  189|  1.40M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2Ev:
  189|  1.37M|  any_invocable_impl() noexcept = default;
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJEEcvbEv:
  231|  1.33M|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEED2Ev:
  209|  1.38M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE7destroyEv:
  242|  1.38M|  void destroy() noexcept {
  243|  1.38M|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 4.44k, False: 1.37M]
  ------------------
  244|  4.44k|      handle_(action::destroy, &storage_, nullptr);
  245|  4.44k|      handle_ = nullptr;
  246|  4.44k|    }
  247|  1.38M|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEED2Ev:
  209|  1.43M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE7destroyEv:
  242|  1.43M|  void destroy() noexcept {
  243|  1.43M|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 0, False: 1.43M]
  ------------------
  244|      0|      handle_(action::destroy, &storage_, nullptr);
  245|      0|      handle_ = nullptr;
  246|      0|    }
  247|  1.43M|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEclES1_S6_b:
  348|  55.0k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  55.0k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  55.0k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE4callES2_S7_b:
  249|  55.0k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  55.0k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  55.0k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEclES1_S4_:
  348|  67.8k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  67.8k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  67.8k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE4callES2_S5_:
  249|  67.8k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  67.8k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  67.8k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEC2IZZNS2_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS1_S4_E_vEEOT_:
  306|   203k|    any_invocable(F&& f) {                                                     \
  307|   203k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|   203k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEEC2Ev:
  189|   203k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE6createIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_JSE_EEEvDpOT0_:
  235|   203k|  void create(Args&&... args) {
  236|   203k|    using hdl = handler<F>;
  237|   203k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|   203k|    handle_ = &hdl::handle;
  239|   203k|    call_ = &hdl::call;
  240|   203k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  121|   203k|    static void create(storage& s, Args&&... args) {
  122|   203k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE12handler_baseINS6_13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESC_SD_iEUlS2_S5_E_EEE6handleENS0_6actionEPNS0_7storageESK_:
  106|   203k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|   203k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 203k]
  ------------------
  108|   203k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 203k, False: 0]
  ------------------
  109|   203k|          Derived::destroy(*current);
  110|   203k|          break;
  111|      0|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 0, False: 203k]
  ------------------
  112|      0|          Derived::move(*current, *other);
  113|      0|          break;
  114|   203k|      }
  115|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E7destroyERNS0_7storageE:
  125|   203k|    static void destroy(storage& s) noexcept {
  126|   203k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|   203k|      value.~T();
  128|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E4callERNS0_7storageES2_S5_:
  135|  67.8k|    static R call(storage& s, ArgTypes... args) {
  136|  67.8k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  67.8k|                         std::forward<ArgTypes>(args)...);
  138|  67.8k|    }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEclES7_:
  348|  79.4k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  79.4k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  79.4k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE4callES8_:
  249|  79.4k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  79.4k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  79.4k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEcvbEv:
  231|  59.4k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEED2Ev:
  209|   203k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE7destroyEv:
  242|   203k|  void destroy() noexcept {
  243|   203k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 203k, False: 0]
  ------------------
  244|   203k|      handle_(action::destroy, &storage_, nullptr);
  245|   203k|      handle_ = nullptr;
  246|   203k|    }
  247|   203k|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2IZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS1_S6_bE_vEEOT_:
  306|   203k|    any_invocable(F&& f) {                                                     \
  307|   203k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|   203k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEEC2Ev:
  189|   203k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE6createIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_JSH_EEEvDpOT0_:
  235|   203k|  void create(Args&&... args) {
  236|   203k|    using hdl = handler<F>;
  237|   203k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|   203k|    handle_ = &hdl::handle;
  239|   203k|    call_ = &hdl::call;
  240|   203k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  121|   203k|    static void create(storage& s, Args&&... args) {
  122|   203k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE12handler_baseINS8_13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESF_SG_iEUlS2_S7_bE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  106|   203k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|   203k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 203k]
  ------------------
  108|   203k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 203k, False: 0]
  ------------------
  109|   203k|          Derived::destroy(*current);
  110|   203k|          break;
  111|      0|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 0, False: 203k]
  ------------------
  112|      0|          Derived::move(*current, *other);
  113|      0|          break;
  114|   203k|      }
  115|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E7destroyERNS0_7storageE:
  125|   203k|    static void destroy(storage& s) noexcept {
  126|   203k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|   203k|      value.~T();
  128|   203k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E4callERNS0_7storageES2_S7_b:
  135|  55.0k|    static R call(storage& s, ArgTypes... args) {
  136|  55.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  55.0k|                         std::forward<ArgTypes>(args)...);
  138|  55.0k|    }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEclES5_b:
  348|  33.5k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  33.5k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  33.5k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4callES6_b:
  249|  33.5k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  33.5k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  33.5k|  }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEaSIDnDnEENS1_9enable_ifIXaantsr3stdE9is_same_vIT0_S7_Esr3stdE23is_move_constructible_vISA_EERS7_E4typeEOT_:
  338|  1.43k|    operator=(F&& f) {                                                         \
  339|  1.43k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  340|  1.43k|      return *this;                                                            \
  341|  1.43k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EDn:
  190|  1.43k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4swapERS7_:
  211|  10.3k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  10.3k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 4.44k, False: 5.88k]
  ------------------
  213|  4.44k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 4.44k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  4.44k|      } else {
  221|  4.44k|        rhs.swap(*this);
  222|  4.44k|      }
  223|  5.88k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 5.88k, False: 0]
  ------------------
  224|  5.88k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  5.88k|      handle_ = rhs.handle_;
  226|  5.88k|      call_ = rhs.call_;
  227|  5.88k|      rhs.handle_ = nullptr;
  228|  5.88k|    }
  229|  10.3k|  }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEED2Ev:
  209|   203k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE7destroyEv:
  242|   203k|  void destroy() noexcept {
  243|   203k|    if (handle_) {
  ------------------
  |  Branch (243:9): [True: 203k, False: 0]
  ------------------
  244|   203k|      handle_(action::destroy, &storage_, nullptr);
  245|   203k|      handle_ = nullptr;
  246|   203k|    }
  247|   203k|  }
_ZNK5ofats10any_detail18any_invocable_implIbLb0EJmEEcvbEv:
  231|  32.1k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE4swapERS2_:
  211|  63.2k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  63.2k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 0, False: 63.2k]
  ------------------
  213|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|      0|      } else {
  221|      0|        rhs.swap(*this);
  222|      0|      }
  223|  63.2k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 0, False: 63.2k]
  ------------------
  224|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|      0|      handle_ = rhs.handle_;
  226|      0|      call_ = rhs.call_;
  227|      0|      rhs.handle_ = nullptr;
  228|      0|    }
  229|  63.2k|  }
_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZNS1_12TemplatedAppILb0EEC1ENS1_20SocketContextOptionsEEUlPT_PT0_E_vEEOSD_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2Ev:
  189|  41.6k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_JSH_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_EEE6handleENS0_6actionEPNS0_7storageESN_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_E4moveERNS0_7storageESK_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZNS2_12TemplatedAppILb0EEC1ENS2_20SocketContextOptionsEEUlPT_PT0_E_E4callERNS0_7storageES5_S7_:
  135|  8.80k|    static R call(storage& s, ArgTypes... args) {
  136|  8.80k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  8.80k|                         std::forward<ArgTypes>(args)...);
  138|  8.80k|    }
_ZN5ofats13any_invocableIFvvEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  338|  63.2k|    operator=(F&& f) {                                                         \
  339|  63.2k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  340|  63.2k|      return *this;                                                            \
  341|  63.2k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EDn:
  190|  63.2k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4swapERS2_:
  211|  72.1k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  72.1k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 4.44k, False: 67.7k]
  ------------------
  213|  4.44k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 4.44k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  4.44k|      } else {
  221|  4.44k|        rhs.swap(*this);
  222|  4.44k|      }
  223|  67.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 5.88k, False: 61.8k]
  ------------------
  224|  5.88k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  5.88k|      handle_ = rhs.handle_;
  226|  5.88k|      call_ = rhs.call_;
  227|  5.88k|      rhs.handle_ = nullptr;
  228|  5.88k|    }
  229|  72.1k|  }
_ZN5ofats13any_invocableIFbmEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  338|  63.2k|    operator=(F&& f) {                                                         \
  339|  63.2k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  340|  63.2k|      return *this;                                                            \
  341|  63.2k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2EDn:
  190|  63.2k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2EOS5_:
  191|  13.8k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  13.8k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 13.8k, False: 0]
  ------------------
  193|  13.8k|      handle_ = rhs.handle_;
  194|  13.8k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  13.8k|      call_ = rhs.call_;
  196|  13.8k|      rhs.handle_ = nullptr;
  197|  13.8k|    }
  198|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E_vEEOSK_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2Ev:
  189|  13.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_JSN_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  121|  13.8k|    static void create(storage& s, Args&&... args) {
  122|  13.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E_EEE6handleENS0_6actionEPNS0_7storageEST_:
  106|  13.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  13.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 13.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 6.94k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  6.94k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 6.94k, False: 6.94k]
  ------------------
  112|  6.94k|          Derived::move(*current, *other);
  113|  6.94k|          break;
  114|  13.8k|      }
  115|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E7destroyERNS0_7storageE:
  125|  13.8k|    static void destroy(storage& s) noexcept {
  126|  13.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  13.8k|      value.~T();
  128|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4moveERNS0_7storageESQ_:
  130|  6.94k|    static void move(storage& dst, storage& src) noexcept {
  131|  6.94k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  6.94k|      destroy(src);
  133|  6.94k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4callERNS0_7storageES4_:
  135|  3.36M|    static R call(storage& s, ArgTypes... args) {
  136|  3.36M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  3.36M|                         std::forward<ArgTypes>(args)...);
  138|  3.36M|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E0_vEEOSK_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_JSN_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  121|  13.8k|    static void create(storage& s, Args&&... args) {
  122|  13.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E0_EEE6handleENS0_6actionEPNS0_7storageEST_:
  106|  13.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  13.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 13.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 6.94k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  6.94k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 6.94k, False: 6.94k]
  ------------------
  112|  6.94k|          Derived::move(*current, *other);
  113|  6.94k|          break;
  114|  13.8k|      }
  115|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E7destroyERNS0_7storageE:
  125|  13.8k|    static void destroy(storage& s) noexcept {
  126|  13.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  13.8k|      value.~T();
  128|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4moveERNS0_7storageESQ_:
  130|  6.94k|    static void move(storage& dst, storage& src) noexcept {
  131|  6.94k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  6.94k|      destroy(src);
  133|  6.94k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4callERNS0_7storageES4_:
  135|  3.36M|    static R call(storage& s, ArgTypes... args) {
  136|  3.36M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  3.36M|                         std::forward<ArgTypes>(args)...);
  138|  3.36M|    }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  231|  40.4k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_iSA_:
  348|  39.0k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  39.0k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  39.0k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_iSB_:
  249|  39.0k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  39.0k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  39.0k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEcvbEv:
  231|  12.9k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEclES5_SA_SB_:
  348|  10.4k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  10.4k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  10.4k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4callES6_SB_SC_:
  249|  10.4k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  10.4k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  10.4k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  231|  9.33k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_SA_:
  348|  8.19k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  8.19k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  8.19k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_SB_:
  249|  8.19k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  8.19k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  8.19k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEcvbEv:
  231|  44.8k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEclES5_:
  348|  43.1k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  43.1k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  43.1k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4callES6_:
  249|  43.1k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  43.1k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  43.1k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EOS2_:
  191|  45.7k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  45.7k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 45.7k, False: 0]
  ------------------
  193|  45.7k|      handle_ = rhs.handle_;
  194|  45.7k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  45.7k|      call_ = rhs.call_;
  196|  45.7k|      rhs.handle_ = nullptr;
  197|  45.7k|    }
  198|  45.7k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_vEEOSI_:
  306|  13.8k|    any_invocable(F&& f) {                                                     \
  307|  13.8k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  13.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_JSL_EEEvDpOT0_:
  235|  13.8k|  void create(Args&&... args) {
  236|  13.8k|    using hdl = handler<F>;
  237|  13.8k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  13.8k|    handle_ = &hdl::handle;
  239|  13.8k|    call_ = &hdl::call;
  240|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E6createIJSL_EEEvRNS0_7storageEDpOT_:
  121|  34.7k|    static void create(storage& s, Args&&... args) {
  122|  34.7k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  34.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS7_NSt3__112basic_stringIcNSB_11char_traitsIcEENSB_9allocatorIcEEEEONS7_17WebSocketBehaviorIT_EEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESR_:
  106|  34.7k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  34.7k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 34.7k]
  ------------------
  108|  13.8k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 13.8k, False: 20.8k]
  ------------------
  109|  13.8k|          Derived::destroy(*current);
  110|  13.8k|          break;
  111|  20.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 20.8k, False: 13.8k]
  ------------------
  112|  20.8k|          Derived::move(*current, *other);
  113|  20.8k|          break;
  114|  34.7k|      }
  115|  34.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E7destroyERNS0_7storageE:
  125|  34.7k|    static void destroy(storage& s) noexcept {
  126|  34.7k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  34.7k|      value.~T();
  128|  34.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4moveERNS0_7storageESO_:
  130|  20.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  20.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  20.8k|      destroy(src);
  133|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4callERNS0_7storageE:
  135|  13.8k|    static R call(storage& s, ArgTypes... args) {
  136|  13.8k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  13.8k|                         std::forward<ArgTypes>(args)...);
  138|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEaSEOS7_:
  200|  27.7k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  27.7k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  27.7k|    return *this;
  203|  27.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EOS7_:
  191|  83.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  83.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 13.8k, False: 69.4k]
  ------------------
  193|  13.8k|      handle_ = rhs.handle_;
  194|  13.8k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  13.8k|      call_ = rhs.call_;
  196|  13.8k|      rhs.handle_ = nullptr;
  197|  13.8k|    }
  198|  83.3k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4swapERS7_:
  211|  41.6k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  41.6k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 13.8k, False: 27.7k]
  ------------------
  213|  13.8k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 13.8k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  13.8k|      } else {
  221|  13.8k|        rhs.swap(*this);
  222|  13.8k|      }
  223|  27.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 13.8k, False: 13.8k]
  ------------------
  224|  13.8k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  13.8k|      handle_ = rhs.handle_;
  226|  13.8k|      call_ = rhs.call_;
  227|  13.8k|      rhs.handle_ = nullptr;
  228|  13.8k|    }
  229|  41.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEaSEOSD_:
  200|  27.7k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  27.7k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  27.7k|    return *this;
  203|  27.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EOSD_:
  191|  83.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  83.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 6.94k, False: 76.3k]
  ------------------
  193|  6.94k|      handle_ = rhs.handle_;
  194|  6.94k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  6.94k|      call_ = rhs.call_;
  196|  6.94k|      rhs.handle_ = nullptr;
  197|  6.94k|    }
  198|  83.3k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4swapERSD_:
  211|  34.7k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  34.7k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 6.94k, False: 27.7k]
  ------------------
  213|  6.94k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 6.94k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  6.94k|      } else {
  221|  6.94k|        rhs.swap(*this);
  222|  6.94k|      }
  223|  27.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 6.94k, False: 20.8k]
  ------------------
  224|  6.94k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  6.94k|      handle_ = rhs.handle_;
  226|  6.94k|      call_ = rhs.call_;
  227|  6.94k|      rhs.handle_ = nullptr;
  228|  6.94k|    }
  229|  34.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEaSEOSC_:
  200|  13.8k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  13.8k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  13.8k|    return *this;
  203|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EOSC_:
  191|  41.6k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  41.6k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 0, False: 41.6k]
  ------------------
  193|      0|      handle_ = rhs.handle_;
  194|      0|      handle_(action::move, &storage_, &rhs.storage_);
  195|      0|      call_ = rhs.call_;
  196|      0|      rhs.handle_ = nullptr;
  197|      0|    }
  198|  41.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE4swapERSC_:
  211|  13.8k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  13.8k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 0, False: 13.8k]
  ------------------
  213|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|      0|      } else {
  221|      0|        rhs.swap(*this);
  222|      0|      }
  223|  13.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 0, False: 13.8k]
  ------------------
  224|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|      0|      handle_ = rhs.handle_;
  226|      0|      call_ = rhs.call_;
  227|      0|      rhs.handle_ = nullptr;
  228|      0|    }
  229|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEaSEOSC_:
  200|  13.8k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  13.8k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  13.8k|    return *this;
  203|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  191|  41.6k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  41.6k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 6.94k, False: 34.7k]
  ------------------
  193|  6.94k|      handle_ = rhs.handle_;
  194|  6.94k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  6.94k|      call_ = rhs.call_;
  196|  6.94k|      rhs.handle_ = nullptr;
  197|  6.94k|    }
  198|  41.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  211|  20.8k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  20.8k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 6.94k, False: 13.8k]
  ------------------
  213|  6.94k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 6.94k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  6.94k|      } else {
  221|  6.94k|        rhs.swap(*this);
  222|  6.94k|      }
  223|  13.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 6.94k, False: 6.94k]
  ------------------
  224|  6.94k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  6.94k|      handle_ = rhs.handle_;
  226|  6.94k|      call_ = rhs.call_;
  227|  6.94k|      rhs.handle_ = nullptr;
  228|  6.94k|    }
  229|  20.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEaSEOSC_:
  200|  27.7k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  27.7k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  27.7k|    return *this;
  203|  27.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  191|  83.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  83.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 13.8k, False: 69.4k]
  ------------------
  193|  13.8k|      handle_ = rhs.handle_;
  194|  13.8k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  13.8k|      call_ = rhs.call_;
  196|  13.8k|      rhs.handle_ = nullptr;
  197|  13.8k|    }
  198|  83.3k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  211|  41.6k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  41.6k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 13.8k, False: 27.7k]
  ------------------
  213|  13.8k|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 13.8k]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|  13.8k|      } else {
  221|  13.8k|        rhs.swap(*this);
  222|  13.8k|      }
  223|  27.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 13.8k, False: 13.8k]
  ------------------
  224|  13.8k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|  13.8k|      handle_ = rhs.handle_;
  226|  13.8k|      call_ = rhs.call_;
  227|  13.8k|      rhs.handle_ = nullptr;
  228|  13.8k|    }
  229|  41.6k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEcvbEv:
  231|  41.6k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2EOS9_:
  191|  90.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  90.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 90.2k, False: 0]
  ------------------
  193|  90.2k|      handle_ = rhs.handle_;
  194|  90.2k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  90.2k|      call_ = rhs.call_;
  196|  90.2k|      rhs.handle_ = nullptr;
  197|  90.2k|    }
  198|  90.2k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2EOS8_:
  191|  83.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  83.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 83.3k, False: 0]
  ------------------
  193|  83.3k|      handle_ = rhs.handle_;
  194|  83.3k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  83.3k|      call_ = rhs.call_;
  196|  83.3k|      rhs.handle_ = nullptr;
  197|  83.3k|    }
  198|  83.3k|  }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEC2IZNS1_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS0_IFvPNS1_12HttpResponseILb0EEEPNS1_11HttpRequestEEEEbEUlPT_E_vEEOSS_:
  306|  41.6k|    any_invocable(F&& f) {                                                     \
  307|  41.6k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  41.6k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2Ev:
  189|  41.6k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE6createIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_JSV_EEEvDpOT0_:
  235|  41.6k|  void create(Args&&... args) {
  236|  41.6k|    using hdl = handler<F>;
  237|  41.6k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  41.6k|    handle_ = &hdl::handle;
  239|  41.6k|    call_ = &hdl::call;
  240|  41.6k|  }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E6createIJSV_EEEvRNS0_7storageEDpOT_:
  144|  41.6k|    static void create(storage& s, Args&&... args) {
  145|  41.6k|      s.ptr_ = new T(std::forward<Args>(args)...);
  146|  41.6k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE12handler_baseINS9_13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSE_11char_traitsIcEENSE_9allocatorIcEEEESK_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_EEE6handleENS0_6actionEPNS0_7storageES11_:
  106|   131k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|   131k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 131k]
  ------------------
  108|  41.6k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 41.6k, False: 90.2k]
  ------------------
  109|  41.6k|          Derived::destroy(*current);
  110|  41.6k|          break;
  111|  90.2k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 90.2k, False: 41.6k]
  ------------------
  112|  90.2k|          Derived::move(*current, *other);
  113|  90.2k|          break;
  114|   131k|      }
  115|   131k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E7destroyERNS0_7storageE:
  148|  41.6k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4moveERNS0_7storageESY_:
  150|  90.2k|    static void move(storage& dst, storage& src) noexcept {
  151|  90.2k|      dst.ptr_ = src.ptr_;
  152|  90.2k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4callERNS0_7storageES8_:
  154|  79.4k|    static R call(storage& s, ArgTypes... args) {
  155|  79.4k|      return std::invoke(*static_cast<T*>(s.ptr_),
  156|  79.4k|                         std::forward<ArgTypes>(args)...);
  157|  79.4k|    }
_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEclES4_S6_:
  348|  79.4k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  79.4k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  79.4k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE4callES5_S7_:
  249|  79.4k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  79.4k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  79.4k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EOSA_:
  191|  27.7k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  27.7k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 0, False: 27.7k]
  ------------------
  193|      0|      handle_ = rhs.handle_;
  194|      0|      handle_(action::move, &storage_, &rhs.storage_);
  195|      0|      call_ = rhs.call_;
  196|      0|      rhs.handle_ = nullptr;
  197|      0|    }
  198|  27.7k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_vEEOSN_:
  306|  13.8k|    any_invocable(F&& f) {                                                     \
  307|  13.8k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  13.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_JST_EEEvDpOT0_:
  235|  13.8k|  void create(Args&&... args) {
  236|  13.8k|    using hdl = handler<F>;
  237|  13.8k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  13.8k|    handle_ = &hdl::handle;
  239|  13.8k|    call_ = &hdl::call;
  240|  13.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E6createIJST_EEEvRNS0_7storageEDpOT_:
  144|  13.8k|    static void create(storage& s, Args&&... args) {
  145|  13.8k|      s.ptr_ = new T(std::forward<Args>(args)...);
  146|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSC_NSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEEONSC_17WebSocketBehaviorIT_EEEUlPSO_PT0_E_EEE6handleENS0_6actionEPNS0_7storageESZ_:
  106|  41.6k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  41.6k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 41.6k]
  ------------------
  108|  13.8k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 13.8k, False: 27.7k]
  ------------------
  109|  13.8k|          Derived::destroy(*current);
  110|  13.8k|          break;
  111|  27.7k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 27.7k, False: 13.8k]
  ------------------
  112|  27.7k|          Derived::move(*current, *other);
  113|  27.7k|          break;
  114|  41.6k|      }
  115|  41.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E7destroyERNS0_7storageE:
  148|  13.8k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4moveERNS0_7storageESW_:
  150|  27.7k|    static void move(storage& dst, storage& src) noexcept {
  151|  27.7k|      dst.ptr_ = src.ptr_;
  152|  27.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4callERNS0_7storageES5_S7_:
  154|  52.6k|    static R call(storage& s, ArgTypes... args) {
  155|  52.6k|      return std::invoke(*static_cast<T*>(s.ptr_),
  156|  52.6k|                         std::forward<ArgTypes>(args)...);
  157|  52.6k|    }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEcvbEv:
  231|  40.4k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_0vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_0JSA_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E6createIJSA_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_0EEE6handleENS0_6actionEPNS0_7storageESG_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4moveERNS0_7storageESD_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4callERNS0_7storageES5_S7_:
  135|  11.1k|    static R call(storage& s, ArgTypes... args) {
  136|  11.1k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  11.1k|                         std::forward<ArgTypes>(args)...);
  138|  11.1k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_1vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_1JSA_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E6createIJSA_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_1EEE6handleENS0_6actionEPNS0_7storageESG_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4moveERNS0_7storageESD_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4callERNS0_7storageES5_S7_:
  135|  4.44k|    static R call(storage& s, ArgTypes... args) {
  136|  4.44k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  4.44k|                         std::forward<ArgTypes>(args)...);
  138|  4.44k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEaSEOS2_:
  200|  4.44k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  4.44k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  4.44k|    return *this;
  203|  4.44k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_vEEOSA_:
  306|  4.44k|    any_invocable(F&& f) {                                                     \
  307|  4.44k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  4.44k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_JSE_EEEvDpOT0_:
  235|  4.44k|  void create(Args&&... args) {
  236|  4.44k|    using hdl = handler<F>;
  237|  4.44k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  4.44k|    handle_ = &hdl::handle;
  239|  4.44k|    call_ = &hdl::call;
  240|  4.44k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  121|  14.7k|    static void create(storage& s, Args&&... args) {
  122|  14.7k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_EUlvE_EEE6handleENS0_6actionEPNS0_7storageESK_:
  106|  14.7k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  14.7k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 14.7k]
  ------------------
  108|  4.44k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 4.44k, False: 10.3k]
  ------------------
  109|  4.44k|          Derived::destroy(*current);
  110|  4.44k|          break;
  111|  10.3k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 10.3k, False: 4.44k]
  ------------------
  112|  10.3k|          Derived::move(*current, *other);
  113|  10.3k|          break;
  114|  14.7k|      }
  115|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E7destroyERNS0_7storageE:
  125|  14.7k|    static void destroy(storage& s) noexcept {
  126|  14.7k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  14.7k|      value.~T();
  128|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4moveERNS0_7storageESH_:
  130|  10.3k|    static void move(storage& dst, storage& src) noexcept {
  131|  10.3k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  10.3k|      destroy(src);
  133|  10.3k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4callERNS0_7storageE:
  135|  3.00k|    static R call(storage& s, ArgTypes... args) {
  136|  3.00k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  3.00k|                         std::forward<ArgTypes>(args)...);
  138|  3.00k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_vEEOSA_:
  306|  3.00k|    any_invocable(F&& f) {                                                     \
  307|  3.00k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  3.00k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_JSF_EEEvDpOT0_:
  235|  3.00k|  void create(Args&&... args) {
  236|  3.00k|    using hdl = handler<F>;
  237|  3.00k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  3.00k|    handle_ = &hdl::handle;
  239|  3.00k|    call_ = &hdl::call;
  240|  3.00k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E6createIJSF_EEEvRNS0_7storageEDpOT_:
  121|  9.51k|    static void create(storage& s, Args&&... args) {
  122|  9.51k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  9.51k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_EEE6handleENS0_6actionEPNS0_7storageESL_:
  106|  9.51k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  9.51k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 9.51k]
  ------------------
  108|  3.00k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 3.00k, False: 6.50k]
  ------------------
  109|  3.00k|          Derived::destroy(*current);
  110|  3.00k|          break;
  111|  6.50k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 6.50k, False: 3.00k]
  ------------------
  112|  6.50k|          Derived::move(*current, *other);
  113|  6.50k|          break;
  114|  9.51k|      }
  115|  9.51k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E7destroyERNS0_7storageE:
  125|  9.51k|    static void destroy(storage& s) noexcept {
  126|  9.51k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  9.51k|      value.~T();
  128|  9.51k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4moveERNS0_7storageESI_:
  130|  6.50k|    static void move(storage& dst, storage& src) noexcept {
  131|  6.50k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  6.50k|      destroy(src);
  133|  6.50k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4callERNS0_7storageE:
  135|  2.78k|    static R call(storage& s, ArgTypes... args) {
  136|  2.78k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  2.78k|                         std::forward<ArgTypes>(args)...);
  138|  2.78k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEaSEOS7_:
  200|  4.44k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  4.44k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  4.44k|    return *this;
  203|  4.44k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EOS7_:
  191|  4.44k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  4.44k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 4.44k, False: 0]
  ------------------
  193|  4.44k|      handle_ = rhs.handle_;
  194|  4.44k|      handle_(action::move, &storage_, &rhs.storage_);
  195|  4.44k|      call_ = rhs.call_;
  196|  4.44k|      rhs.handle_ = nullptr;
  197|  4.44k|    }
  198|  4.44k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS5_bE_vEEOSF_:
  306|  4.44k|    any_invocable(F&& f) {                                                     \
  307|  4.44k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  4.44k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_JSJ_EEEvDpOT0_:
  235|  4.44k|  void create(Args&&... args) {
  236|  4.44k|    using hdl = handler<F>;
  237|  4.44k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  4.44k|    handle_ = &hdl::handle;
  239|  4.44k|    call_ = &hdl::call;
  240|  4.44k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E6createIJSJ_EEEvRNS0_7storageEDpOT_:
  121|  14.7k|    static void create(storage& s, Args&&... args) {
  122|  14.7k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE12handler_baseINS7_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSC_11HttpRequestEEEDaPT_PT0_EUlS6_bE_EEE6handleENS0_6actionEPNS0_7storageESP_:
  106|  14.7k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  14.7k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 14.7k]
  ------------------
  108|  4.44k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 4.44k, False: 10.3k]
  ------------------
  109|  4.44k|          Derived::destroy(*current);
  110|  4.44k|          break;
  111|  10.3k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 10.3k, False: 4.44k]
  ------------------
  112|  10.3k|          Derived::move(*current, *other);
  113|  10.3k|          break;
  114|  14.7k|      }
  115|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E7destroyERNS0_7storageE:
  125|  14.7k|    static void destroy(storage& s) noexcept {
  126|  14.7k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  14.7k|      value.~T();
  128|  14.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4moveERNS0_7storageESM_:
  130|  10.3k|    static void move(storage& dst, storage& src) noexcept {
  131|  10.3k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  10.3k|      destroy(src);
  133|  10.3k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4callERNS0_7storageES6_b:
  135|  33.5k|    static R call(storage& s, ArgTypes... args) {
  136|  33.5k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  33.5k|                         std::forward<ArgTypes>(args)...);
  138|  33.5k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_vEEOSA_:
  306|  1.43k|    any_invocable(F&& f) {                                                     \
  307|  1.43k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  1.43k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_JSK_EEEvDpOT0_:
  235|  1.43k|  void create(Args&&... args) {
  236|  1.43k|    using hdl = handler<F>;
  237|  1.43k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  1.43k|    handle_ = &hdl::handle;
  239|  1.43k|    call_ = &hdl::call;
  240|  1.43k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E6createIJSK_EEEvRNS0_7storageEDpOT_:
  144|  1.43k|    static void create(storage& s, Args&&... args) {
  145|  1.43k|      s.ptr_ = new T(std::forward<Args>(args)...);
  146|  1.43k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSF_11char_traitsIcEEEEbE_clESJ_bEUlvE_EEE6handleENS0_6actionEPNS0_7storageESQ_:
  106|  1.43k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  1.43k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 1.43k]
  ------------------
  108|  1.43k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 1.43k, False: 0]
  ------------------
  109|  1.43k|          Derived::destroy(*current);
  110|  1.43k|          break;
  111|      0|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 0, False: 1.43k]
  ------------------
  112|      0|          Derived::move(*current, *other);
  113|      0|          break;
  114|  1.43k|      }
  115|  1.43k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E7destroyERNS0_7storageE:
  148|  1.43k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E4callERNS0_7storageE:
  154|  1.43k|    static R call(storage& s, ArgTypes... args) {
  155|  1.43k|      return std::invoke(*static_cast<T*>(s.ptr_),
  156|  1.43k|                         std::forward<ArgTypes>(args)...);
  157|  1.43k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_2vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_2JSA_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E6createIJSA_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_2EEE6handleENS0_6actionEPNS0_7storageESG_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4moveERNS0_7storageESD_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4callERNS0_7storageES5_S7_:
  135|  2.31k|    static R call(storage& s, ArgTypes... args) {
  136|  2.31k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  2.31k|                         std::forward<ArgTypes>(args)...);
  138|  2.31k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_3vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2Ev:
  189|  13.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_3JS9_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E6createIJS9_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_3EEE6handleENS0_6actionEPNS0_7storageESF_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4moveERNS0_7storageESC_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4callERNS0_7storageES6_:
  135|  39.0k|    static R call(storage& s, ArgTypes... args) {
  136|  39.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  39.0k|                         std::forward<ArgTypes>(args)...);
  138|  39.0k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEC2IZ4testvE3$_4vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2Ev:
  189|  6.94k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE6createIZ4testvE3$_4JSF_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E6createIJSF_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE12handler_baseINSD_13small_handlerIZ4testvE3$_4EEE6handleENS0_6actionEPNS0_7storageESL_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4moveERNS0_7storageESI_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4callERNS0_7storageES6_SB_SC_:
  135|  10.4k|    static R call(storage& s, ArgTypes... args) {
  136|  10.4k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  10.4k|                         std::forward<ArgTypes>(args)...);
  138|  10.4k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_5vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_5JS9_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E6createIJS9_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_5EEE6handleENS0_6actionEPNS0_7storageESF_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4moveERNS0_7storageESC_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4callERNS0_7storageES6_:
  135|  4.10k|    static R call(storage& s, ArgTypes... args) {
  136|  4.10k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  4.10k|                         std::forward<ArgTypes>(args)...);
  138|  4.10k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_6vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  189|  13.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_6JSE_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E6createIJSE_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_6EEE6handleENS0_6actionEPNS0_7storageESK_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4moveERNS0_7storageESH_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4callERNS0_7storageES6_SB_:
  135|  6.97k|    static R call(storage& s, ArgTypes... args) {
  136|  6.97k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  6.97k|                         std::forward<ArgTypes>(args)...);
  138|  6.97k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_vEEOSA_:
  306|  6.97k|    any_invocable(F&& f) {                                                     \
  307|  6.97k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.97k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_JSH_EEEvDpOT0_:
  235|  6.97k|  void create(Args&&... args) {
  236|  6.97k|    using hdl = handler<F>;
  237|  6.97k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.97k|    handle_ = &hdl::handle;
  239|  6.97k|    call_ = &hdl::call;
  240|  6.97k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  121|  20.9k|    static void create(storage& s, Args&&... args) {
  122|  20.9k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSD_11char_traitsIcEEEEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  106|  20.9k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.9k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.9k]
  ------------------
  108|  6.97k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.97k, False: 14.0k]
  ------------------
  109|  6.97k|          Derived::destroy(*current);
  110|  6.97k|          break;
  111|  14.0k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 14.0k, False: 6.97k]
  ------------------
  112|  14.0k|          Derived::move(*current, *other);
  113|  14.0k|          break;
  114|  20.9k|      }
  115|  20.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E7destroyERNS0_7storageE:
  125|  20.9k|    static void destroy(storage& s) noexcept {
  126|  20.9k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.9k|      value.~T();
  128|  20.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4moveERNS0_7storageESK_:
  130|  14.0k|    static void move(storage& dst, storage& src) noexcept {
  131|  14.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  14.0k|      destroy(src);
  133|  14.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4callERNS0_7storageE:
  135|  5.08k|    static R call(storage& s, ArgTypes... args) {
  136|  5.08k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  5.08k|                         std::forward<ArgTypes>(args)...);
  138|  5.08k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_7vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_7JSE_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E6createIJSE_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_7EEE6handleENS0_6actionEPNS0_7storageESK_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E4moveERNS0_7storageESH_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E4callERNS0_7storageES6_SB_:
  135|  1.22k|    static R call(storage& s, ArgTypes... args) {
  136|  1.22k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  1.22k|                         std::forward<ArgTypes>(args)...);
  138|  1.22k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_8vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  189|  6.94k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_8JSE_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E6createIJSE_EEEvRNS0_7storageEDpOT_:
  121|  20.8k|    static void create(storage& s, Args&&... args) {
  122|  20.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_8EEE6handleENS0_6actionEPNS0_7storageESK_:
  106|  20.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  20.8k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 20.8k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 13.8k]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|  13.8k|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 13.8k, False: 6.94k]
  ------------------
  112|  13.8k|          Derived::move(*current, *other);
  113|  13.8k|          break;
  114|  20.8k|      }
  115|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E7destroyERNS0_7storageE:
  125|  20.8k|    static void destroy(storage& s) noexcept {
  126|  20.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  20.8k|      value.~T();
  128|  20.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4moveERNS0_7storageESH_:
  130|  13.8k|    static void move(storage& dst, storage& src) noexcept {
  131|  13.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  132|  13.8k|      destroy(src);
  133|  13.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4callERNS0_7storageES6_iSB_:
  135|  39.0k|    static R call(storage& s, ArgTypes... args) {
  136|  39.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  39.0k|                         std::forward<ArgTypes>(args)...);
  138|  39.0k|    }
_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEclES2_:
  348|  6.94k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  349|  6.94k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  350|  6.94k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE4callES3_:
  249|  6.94k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  250|  6.94k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  251|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEC2IZ4testvE3$_9vEEOT_:
  306|  6.94k|    any_invocable(F&& f) {                                                     \
  307|  6.94k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  308|  6.94k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEEC2Ev:
  189|  6.94k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE6createIZ4testvE3$_9JS6_EEEvDpOT0_:
  235|  6.94k|  void create(Args&&... args) {
  236|  6.94k|    using hdl = handler<F>;
  237|  6.94k|    hdl::create(storage_, std::forward<Args>(args)...);
  238|  6.94k|    handle_ = &hdl::handle;
  239|  6.94k|    call_ = &hdl::call;
  240|  6.94k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E6createIJS6_EEEvRNS0_7storageEDpOT_:
  121|  6.94k|    static void create(storage& s, Args&&... args) {
  122|  6.94k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  123|  6.94k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE12handler_baseINS4_13small_handlerIZ4testvE3$_9EEE6handleENS0_6actionEPNS0_7storageESC_:
  106|  6.94k|    static void handle(action act, storage* current, storage* other = nullptr) {
  107|  6.94k|      switch (act) {
  ------------------
  |  Branch (107:15): [True: 0, False: 6.94k]
  ------------------
  108|  6.94k|        case (action::destroy):
  ------------------
  |  Branch (108:9): [True: 6.94k, False: 0]
  ------------------
  109|  6.94k|          Derived::destroy(*current);
  110|  6.94k|          break;
  111|      0|        case (action::move):
  ------------------
  |  Branch (111:9): [True: 0, False: 6.94k]
  ------------------
  112|      0|          Derived::move(*current, *other);
  113|      0|          break;
  114|  6.94k|      }
  115|  6.94k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E7destroyERNS0_7storageE:
  125|  6.94k|    static void destroy(storage& s) noexcept {
  126|  6.94k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  127|  6.94k|      value.~T();
  128|  6.94k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E4callERNS0_7storageES3_:
  135|  6.94k|    static R call(storage& s, ArgTypes... args) {
  136|  6.94k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  137|  6.94k|                         std::forward<ArgTypes>(args)...);
  138|  6.94k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEaSEOS4_:
  200|  6.94k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  201|  6.94k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  202|  6.94k|    return *this;
  203|  6.94k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EOS4_:
  191|  6.94k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  192|  6.94k|    if (rhs.handle_) {
  ------------------
  |  Branch (192:9): [True: 0, False: 6.94k]
  ------------------
  193|      0|      handle_ = rhs.handle_;
  194|      0|      handle_(action::move, &storage_, &rhs.storage_);
  195|      0|      call_ = rhs.call_;
  196|      0|      rhs.handle_ = nullptr;
  197|      0|    }
  198|  6.94k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE4swapERS4_:
  211|  6.94k|  void swap(any_invocable_impl& rhs) noexcept {
  212|  6.94k|    if (handle_) {
  ------------------
  |  Branch (212:9): [True: 0, False: 6.94k]
  ------------------
  213|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        storage tmp;
  215|      0|        handle_(action::move, &tmp, &storage_);
  216|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  217|      0|        handle_(action::move, &rhs.storage_, &tmp);
  218|      0|        std::swap(handle_, rhs.handle_);
  219|      0|        std::swap(call_, rhs.call_);
  220|      0|      } else {
  221|      0|        rhs.swap(*this);
  222|      0|      }
  223|  6.94k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (223:16): [True: 0, False: 6.94k]
  ------------------
  224|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  225|      0|      handle_ = rhs.handle_;
  226|      0|      call_ = rhs.call_;
  227|      0|      rhs.handle_ = nullptr;
  228|      0|    }
  229|  6.94k|  }

_ZN3uWS15DeflationStream7deflateEPNS_11ZlibContextENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEb:
   90|  2.25k|    std::string_view deflate(ZlibContext * /*zlibContext*/, std::string_view raw, bool /*reset*/) {
   91|  2.25k|        return raw;
   92|  2.25k|    }
_ZN3uWS15InflationStream7inflateEPNS_11ZlibContextENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEmb:
   83|  1.35k|    std::optional<std::string_view> inflate(ZlibContext * /*zlibContext*/, std::string_view compressed, size_t maxPayloadLength, bool /*reset*/) {
   84|  1.35k|        return compressed.substr(0, std::min(maxPayloadLength, compressed.length()));
   85|  1.35k|    }
_ZN3uWS15InflationStreamC2ENS_15CompressOptionsE:
   86|  6.94k|    InflationStream(CompressOptions /*compressOptions*/) {
   87|  6.94k|    }
_ZN3uWS15DeflationStreamC2ENS_15CompressOptionsE:
   93|  6.94k|    DeflationStream(CompressOptions /*compressOptions*/) {
   94|  6.94k|    }

EpollHelloWorld.cpp:_ZN3uWSL20getDecodedQueryValueENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEES4_:
   28|  2.31k|    static inline std::string_view getDecodedQueryValue(std::string_view key, std::string_view rawQuery) {
   29|       |
   30|       |        /* Can't have a value without a key */
   31|  2.31k|        if (!key.length()) {
  ------------------
  |  Branch (31:13): [True: 0, False: 2.31k]
  ------------------
   32|      0|            return {};
   33|      0|        }
   34|       |
   35|       |        /* Start with the whole querystring including initial '?' */
   36|  2.31k|        std::string_view queryString = rawQuery;
   37|       |
   38|       |        /* List of key, value could be cached for repeated fetches similar to how headers are, todo! */
   39|  3.81k|        while (queryString.length()) {
  ------------------
  |  Branch (39:16): [True: 2.84k, False: 967]
  ------------------
   40|       |            /* Find boundaries of this statement */
   41|  2.84k|            std::string_view statement = queryString.substr(1, queryString.find('&', 1) - 1);
   42|       |
   43|       |            /* Only bother if first char of key match (early exit) */
   44|  2.84k|            if (statement.length() && statement[0] == key[0]) {
  ------------------
  |  Branch (44:17): [True: 2.03k, False: 819]
  |  Branch (44:39): [True: 1.79k, False: 236]
  ------------------
   45|       |                /* Equal sign must be present and not in the end of statement */
   46|  1.79k|                auto equality = statement.find('=');
   47|  1.79k|                if (equality != std::string_view::npos) {
  ------------------
  |  Branch (47:21): [True: 1.42k, False: 366]
  ------------------
   48|       |
   49|  1.42k|                    std::string_view statementKey = statement.substr(0, equality);
   50|  1.42k|                    std::string_view statementValue = statement.substr(equality + 1);
   51|       |
   52|       |                    /* String comparison */
   53|  1.42k|                    if (key == statementKey) {
  ------------------
  |  Branch (53:25): [True: 982, False: 446]
  ------------------
   54|       |
   55|       |                        /* Decode value inplace, put null at end if before length of original */
   56|    982|                        char *in = (char *) statementValue.data();
   57|       |
   58|       |                        /* Write offset */
   59|    982|                        unsigned int out = 0;
   60|       |
   61|       |                        /* Walk over all chars until end or null char, decoding in place */
   62|  30.1k|                        for (unsigned int i = 0; i < statementValue.length() && in[i]; i++) {
  ------------------
  |  Branch (62:50): [True: 29.4k, False: 750]
  |  Branch (62:81): [True: 29.4k, False: 0]
  ------------------
   63|       |                                /* Only bother with '%' */
   64|  29.4k|                                if (in[i] == '%') {
  ------------------
  |  Branch (64:37): [True: 3.50k, False: 25.9k]
  ------------------
   65|       |                                    /* Do we have enough data for two bytes hex? */
   66|  3.50k|                                    if (i + 2 >= statementValue.length()) {
  ------------------
  |  Branch (66:41): [True: 232, False: 3.27k]
  ------------------
   67|    232|                                        return {};
   68|    232|                                    }
   69|       |
   70|       |                                    /* Two bytes hex */
   71|  3.27k|                                    int hex1 = in[i + 1] - '0';
   72|  3.27k|                                    if (hex1 > 9) {
  ------------------
  |  Branch (72:41): [True: 865, False: 2.40k]
  ------------------
   73|    865|                                        hex1 &= 223;
   74|    865|                                        hex1 -= 7;
   75|    865|                                    }
   76|       |
   77|  3.27k|                                    int hex2 = in[i + 2] - '0';
   78|  3.27k|                                    if (hex2 > 9) {
  ------------------
  |  Branch (78:41): [True: 852, False: 2.41k]
  ------------------
   79|    852|                                        hex2 &= 223;
   80|    852|                                        hex2 -= 7;
   81|    852|                                    }
   82|       |
   83|  3.27k|                                    *((unsigned char *) &in[out]) = (unsigned char) (hex1 * 16 + hex2);
   84|  3.27k|                                    i += 2;
   85|  25.9k|                                } else {
   86|       |                                    /* Is this even a rule? */
   87|  25.9k|                                    if (in[i] == '+') {
  ------------------
  |  Branch (87:41): [True: 427, False: 25.5k]
  ------------------
   88|    427|                                        in[out] = ' ';
   89|  25.5k|                                    } else {
   90|  25.5k|                                        in[out] = in[i];
   91|  25.5k|                                    }
   92|  25.9k|                                }
   93|       |
   94|       |                                /* We always only write one char */
   95|  29.2k|                                out++;
   96|  29.2k|                        }
   97|       |
   98|       |                        /* If decoded string is shorter than original, put null char to stop next read */
   99|    750|                        if (out < statementValue.length()) {
  ------------------
  |  Branch (99:29): [True: 316, False: 434]
  ------------------
  100|    316|                            in[out] = 0;
  101|    316|                        }
  102|       |
  103|    750|                        return statementValue.substr(0, out);
  104|    982|                    }
  105|  1.42k|                } else {
  106|       |                    /* This querystring is invalid, cannot parse it */
  107|    366|                    return {nullptr, 0};
  108|    366|                }
  109|  1.79k|            }
  110|       |
  111|  1.50k|            queryString.remove_prefix(statement.length() + 1);
  112|  1.50k|        }
  113|       |
  114|       |        /* Nothing found is given as nullptr, while empty string is given as some pointer to the given buffer */
  115|    967|        return {nullptr, 0};
  116|  2.31k|    }

_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEC2ENSt3__18functionIFbPNS_10SubscriberERS1_NS3_13IteratorFlagsEEEE:
  148|  6.94k|    TopicTree(std::function<bool(Subscriber *, T &, IteratorFlags)> cb) : cb(cb) {
  149|       |
  150|  6.94k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE5drainEv:
  269|  6.73M|    void drain() {
  270|  6.73M|        if (drainableSubscribers) {
  ------------------
  |  Branch (270:13): [True: 0, False: 6.73M]
  ------------------
  271|       |            /* Drain one socket a time */
  272|      0|            for (Subscriber *s = drainableSubscribers; s; s = s->next) {
  ------------------
  |  Branch (272:56): [True: 0, False: 0]
  ------------------
  273|       |                /* Instead of unlinking every single subscriber, we just leave the list undefined
  274|       |                 * and reset drainableSubscribers ptr below. */
  275|      0|                drainImpl(s);
  276|      0|            }
  277|       |            /* Drain always clears drainableSubscribers and outgoingMessages */
  278|      0|            drainableSubscribers = nullptr;
  279|      0|            outgoingMessages.clear();
  280|      0|        }
  281|  6.73M|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE14freeSubscriberEPNS_10SubscriberE:
  223|  40.4k|    void freeSubscriber(Subscriber *s) {
  224|       |
  225|       |        /* I guess we call this one even if we are not subscribers */
  226|  40.4k|        if (!s) {
  ------------------
  |  Branch (226:13): [True: 40.4k, False: 0]
  ------------------
  227|  40.4k|            return;
  228|  40.4k|        }
  229|       |
  230|       |        /* For all topics, unsubscribe */
  231|      0|        for (Topic *topicPtr : s->topics) {
  ------------------
  |  Branch (231:30): [True: 0, False: 0]
  ------------------
  232|       |            /* If we are the last subscriber, simply remove the whole topic */
  233|      0|            if (topicPtr->size() == 1) {
  ------------------
  |  Branch (233:17): [True: 0, False: 0]
  ------------------
  234|      0|                topics.erase(topicPtr->name);
  235|      0|            } else {
  236|       |                /* Otherwise just remove us */
  237|      0|                topicPtr->erase(s);
  238|      0|            }
  239|      0|        }
  240|       |
  241|       |        /* We also need to unlink us */
  242|      0|        if (s->needsDrainage()) {
  ------------------
  |  Branch (242:13): [True: 0, False: 0]
  ------------------
  243|      0|            unlinkDrainableSubscriber(s);
  244|      0|        }
  245|       |
  246|      0|        delete s;
  247|      0|    }

_ZN3uWS5utils9u32toaHexEjPc:
   28|  7.24k|inline int u32toaHex(uint32_t value, char *dst) {
   29|  7.24k|    char palette[] = "0123456789abcdef";
   30|  7.24k|    char temp[10];
   31|  7.24k|    char *p = temp;
   32|  7.60k|    do {
   33|  7.60k|        *p++ = palette[value & 15];
   34|  7.60k|        value >>= 4;
   35|  7.60k|    } while (value > 0);
  ------------------
  |  Branch (35:14): [True: 356, False: 7.24k]
  ------------------
   36|       |
   37|  7.24k|    int ret = (int) (p - temp);
   38|       |
   39|  7.60k|    do {
   40|  7.60k|        *dst++ = *--p;
   41|  7.60k|    } while (p != temp);
  ------------------
  |  Branch (41:14): [True: 356, False: 7.24k]
  ------------------
   42|       |
   43|  7.24k|    return ret;
   44|  7.24k|}
_ZN3uWS5utils6u64toaEmPc:
   46|  18.8k|inline int u64toa(uint64_t value, char *dst) {
   47|  18.8k|    char temp[20];
   48|  18.8k|    char *p = temp;
   49|  35.2k|    do {
   50|  35.2k|        *p++ = (char) ((value % 10) + '0');
   51|  35.2k|        value /= 10;
   52|  35.2k|    } while (value > 0);
  ------------------
  |  Branch (52:14): [True: 16.4k, False: 18.8k]
  ------------------
   53|       |
   54|  18.8k|    int ret = (int) (p - temp);
   55|       |
   56|  35.2k|    do {
   57|  35.2k|        *dst++ = *--p;
   58|  35.2k|    } while (p != temp);
  ------------------
  |  Branch (58:14): [True: 16.4k, False: 18.8k]
  ------------------
   59|       |
   60|  18.8k|    return ret;
   61|  18.8k|}

EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE11getUserDataEv:
   51|  80.9k|    USERDATA *getUserData() {
   52|  80.9k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
   53|       |        /* We just have it overallocated by sizeof type */
   54|  80.9k|        return (USERDATA *) (webSocketData + 1);
   55|  80.9k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE3endEiNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  220|  5.99k|    void end(int code = 0, std::string_view message = {}) {
  221|       |        /* Check if we already called this one */
  222|  5.99k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  223|  5.99k|        if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (223:13): [True: 0, False: 5.99k]
  ------------------
  224|      0|            return;
  225|      0|        }
  226|       |
  227|       |        /* We postpone any FIN sending to either drainage or uncorking */
  228|  5.99k|        webSocketData->isShuttingDown = true;
  229|       |
  230|       |        /* Format and send the close frame */
  231|  5.99k|        static const int MAX_CLOSE_PAYLOAD = 123;
  232|  5.99k|        size_t length = std::min<size_t>(MAX_CLOSE_PAYLOAD, message.length());
  233|  5.99k|        char closePayload[MAX_CLOSE_PAYLOAD + 2];
  234|  5.99k|        size_t closePayloadLength = protocol::formatClosePayload(closePayload, (uint16_t) code, message.data(), length);
  235|  5.99k|        bool ok = send(std::string_view(closePayload, closePayloadLength), OpCode::CLOSE);
  236|       |
  237|       |        /* FIN if we are ok and not corked */
  238|  5.99k|        if (!this->isCorked()) {
  ------------------
  |  Branch (238:13): [True: 0, False: 5.99k]
  ------------------
  239|      0|            if (ok) {
  ------------------
  |  Branch (239:17): [True: 0, False: 0]
  ------------------
  240|       |                /* If we are not corked, and we just sent off everything, we need to FIN right here.
  241|       |                 * In all other cases, we need to fin either if uncork was successful, or when drainage is complete. */
  242|      0|                this->shutdown();
  243|      0|            }
  244|      0|        }
  245|       |
  246|  5.99k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  247|  5.99k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  248|  5.99k|        );
  249|       |
  250|       |        /* Set shorter timeout (use ping-timeout) to avoid long hanging sockets after end() on broken connections */
  251|  5.99k|        Super::timeout(webSocketContextData->idleTimeoutComponents.second);
  252|       |
  253|       |        /* At this point we iterate all currently held subscriptions and emit an event for all of them */
  254|  5.99k|        if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (254:13): [True: 0, False: 5.99k]
  |  Branch (254:42): [True: 0, False: 0]
  ------------------
  255|      0|            for (Topic *t : webSocketData->subscriber->topics) {
  ------------------
  |  Branch (255:27): [True: 0, False: 0]
  ------------------
  256|      0|                webSocketContextData->subscriptionHandler(this, t->name, (int) t->size() - 1, (int) t->size());
  257|      0|            }
  258|      0|        }
  259|       |
  260|       |        /* Make sure to unsubscribe from any pub/sub node at exit */
  261|  5.99k|        webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  262|  5.99k|        webSocketData->subscriber = nullptr;
  263|       |
  264|       |        /* Emit close event */
  265|  5.99k|        if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (265:13): [True: 5.58k, False: 416]
  ------------------
  266|  5.58k|            webSocketContextData->closeHandler(this, code, message);
  267|  5.58k|        }
  268|  5.99k|        ((USERDATA *) this->getUserData())->~USERDATA();
  269|  5.99k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4sendENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEENS_6OpCodeEib:
  113|  23.9k|    SendStatus send(std::string_view message, OpCode opCode = OpCode::BINARY, int compress = false, bool fin = true) {
  114|  23.9k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  115|  23.9k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  116|  23.9k|        );
  117|       |
  118|       |        /* Skip sending and report success if we are over the limit of maxBackpressure */
  119|  23.9k|        if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
  ------------------
  |  Branch (119:13): [True: 23.9k, False: 0]
  |  Branch (119:54): [True: 409, False: 23.5k]
  ------------------
  120|       |            /* Also defer a close if we should */
  121|    409|            if (webSocketContextData->closeOnBackpressureLimit) {
  ------------------
  |  Branch (121:17): [True: 0, False: 409]
  ------------------
  122|      0|                us_socket_shutdown_read(SSL, (us_socket_t *) this);
  123|      0|            }
  124|       |
  125|       |            /* It is okay to call send again from within this callback since we immediately return with DROPPED afterwards */
  126|    409|            if (webSocketContextData->droppedHandler) {
  ------------------
  |  Branch (126:17): [True: 0, False: 409]
  ------------------
  127|      0|                webSocketContextData->droppedHandler(this, message, opCode);
  128|      0|            }
  129|       |
  130|    409|            return DROPPED;
  131|    409|        }
  132|       |
  133|       |        /* If we are subscribers and have messages to drain we need to drain them here to stay synced */
  134|  23.5k|        WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  135|       |
  136|       |        /* Special path for long sends of non-compressed, non-SSL messages */
  137|  23.5k|        if (message.length() >= 16 * 1024 && !compress && !SSL && !webSocketData->subscriber && getBufferedAmount() == 0 && Super::getLoopData()->corkOffset == 0) {
  ------------------
  |  Branch (137:13): [True: 67, False: 23.4k]
  |  Branch (137:46): [True: 0, False: 67]
  |  Branch (137:59): [Folded - Ignored]
  |  Branch (137:67): [True: 0, False: 0]
  |  Branch (137:97): [True: 0, False: 0]
  |  Branch (137:125): [True: 0, False: 0]
  ------------------
  138|      0|            char header[10];
  139|      0|            int header_length = (int) protocol::formatMessage<isServer>(header, "", 0, opCode, message.length(), compress, fin);
  140|      0|            int written = us_socket_write2(0, (struct us_socket_t *)this, header, header_length, message.data(), (int) message.length());
  141|       |        
  142|      0|            if (written != header_length + (int) message.length()) {
  ------------------
  |  Branch (142:17): [True: 0, False: 0]
  ------------------
  143|       |                /* Buffer up backpressure */
  144|      0|                if (written > header_length) {
  ------------------
  |  Branch (144:21): [True: 0, False: 0]
  ------------------
  145|      0|                    webSocketData->buffer.append(message.data() + written - header_length, message.length() - (size_t) (written - header_length));
  146|      0|                } else {
  147|      0|                    webSocketData->buffer.append(header + written, (size_t) header_length - (size_t) written);
  148|      0|                    webSocketData->buffer.append(message.data(), message.length());
  149|      0|                }
  150|       |                /* We cannot still be corked if we have backpressure.
  151|       |                 * We also cannot uncork normally since it will re-write the already buffered
  152|       |                 * up backpressure again. */
  153|      0|                Super::uncorkWithoutSending();
  154|      0|                return BACKPRESSURE;
  155|      0|            }
  156|  23.5k|        } else {
  157|       |
  158|  23.5k|            if (webSocketData->subscriber) {
  ------------------
  |  Branch (158:17): [True: 0, False: 23.5k]
  ------------------
  159|       |                /* This will call back into us, send. */
  160|      0|                webSocketContextData->topicTree->drain(webSocketData->subscriber);
  161|      0|            }
  162|       |
  163|       |            /* Transform the message to compressed domain if requested */
  164|  23.5k|            if (compress) {
  ------------------
  |  Branch (164:17): [True: 10.0k, False: 13.4k]
  ------------------
  165|  10.0k|                WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  166|       |
  167|       |                /* Check and correct the compress hint. It is never valid to compress 0 bytes */
  168|  10.0k|                if (message.length() && opCode < 3 && webSocketData->compressionStatus == WebSocketData::ENABLED) {
  ------------------
  |  Branch (168:21): [True: 8.65k, False: 1.41k]
  |  Branch (168:41): [True: 8.65k, False: 0]
  |  Branch (168:55): [True: 2.25k, False: 6.39k]
  ------------------
  169|       |                    /* If compress is 2 (IS_PRE_COMPRESSED), skip this step (experimental) */
  170|  2.25k|                    if (compress != CompressFlags::ALREADY_COMPRESSED) {
  ------------------
  |  Branch (170:25): [True: 2.25k, False: 0]
  ------------------
  171|  2.25k|                        LoopData *loopData = Super::getLoopData();
  172|       |                        /* Compress using either shared or dedicated deflationStream */
  173|  2.25k|                        if (webSocketData->deflationStream) {
  ------------------
  |  Branch (173:29): [True: 0, False: 2.25k]
  ------------------
  174|      0|                            message = webSocketData->deflationStream->deflate(loopData->zlibContext, message, false);
  175|  2.25k|                        } else {
  176|  2.25k|                            message = loopData->deflationStream->deflate(loopData->zlibContext, message, true);
  177|  2.25k|                        }
  178|  2.25k|                    }
  179|  7.80k|                } else {
  180|  7.80k|                    compress = false;
  181|  7.80k|                }
  182|  10.0k|            }
  183|       |
  184|       |            /* Get size, allocate size, write if needed */
  185|  23.5k|            size_t messageFrameSize = protocol::messageFrameSize(message.length());
  186|  23.5k|            auto [sendBuffer, sendBufferAttribute] = Super::getSendBuffer(messageFrameSize);
  187|  23.5k|            protocol::formatMessage<isServer>(sendBuffer, message.data(), message.length(), opCode, message.length(), compress, fin);
  188|       |
  189|       |            /* Depending on size of message we have different paths */
  190|  23.5k|            if (sendBufferAttribute == SendBufferAttribute::NEEDS_DRAIN) {
  ------------------
  |  Branch (190:17): [True: 17.8k, False: 5.62k]
  ------------------
  191|       |                /* This is a drain */
  192|  17.8k|                auto[written, failed] = Super::write(nullptr, 0);
  193|  17.8k|                if (failed) {
  ------------------
  |  Branch (193:21): [True: 16.5k, False: 1.30k]
  ------------------
  194|       |                    /* Return false for failure, skipping to reset the timeout below */
  195|  16.5k|                    return BACKPRESSURE;
  196|  16.5k|                }
  197|  17.8k|            } else if (sendBufferAttribute == SendBufferAttribute::NEEDS_UNCORK) {
  ------------------
  |  Branch (197:24): [True: 0, False: 5.62k]
  ------------------
  198|       |                /* Uncork if we came here uncorked */
  199|      0|                auto [written, failed] = Super::uncork();
  200|      0|                if (failed) {
  ------------------
  |  Branch (200:21): [True: 0, False: 0]
  ------------------
  201|      0|                    return BACKPRESSURE;
  202|      0|                }
  203|      0|            }
  204|       |
  205|  23.5k|        }
  206|       |
  207|       |        /* Every successful send resets the timeout */
  208|  6.92k|        if (webSocketContextData->resetIdleTimeoutOnSend) {
  ------------------
  |  Branch (208:13): [True: 0, False: 6.92k]
  ------------------
  209|      0|            Super::timeout(webSocketContextData->idleTimeoutComponents.first);
  210|      0|            WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  211|      0|            webSocketData->hasTimedOut = false;
  212|      0|        }
  213|       |
  214|       |        /* Return success */
  215|  6.92k|        return SUCCESS;
  216|  23.5k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4initEbNS_15CompressOptionsEONS_12BackPressureE:
   44|  40.4k|    void *init(bool perMessageDeflate, CompressOptions compressOptions, BackPressure &&backpressure) {
   45|  40.4k|        new (us_socket_ext(SSL, (us_socket_t *) this)) WebSocketData(perMessageDeflate, compressOptions, std::move(backpressure));
   46|  40.4k|        return this;
   47|  40.4k|    }

EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6createEPNS_4LoopEP19us_socket_context_tPNS_9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEE:
  422|  13.8k|    static WebSocketContext *create(Loop */*loop*/, us_socket_context_t *parentSocketContext, TopicTree<TopicTreeMessage, TopicTreeBigMessage> *topicTree) {
  423|  13.8k|        WebSocketContext *webSocketContext = (WebSocketContext *) us_create_child_socket_context(SSL, parentSocketContext, sizeof(WebSocketContextData<SSL, USERDATA>));
  424|  13.8k|        if (!webSocketContext) {
  ------------------
  |  Branch (424:13): [True: 0, False: 13.8k]
  ------------------
  425|      0|            return nullptr;
  426|      0|        }
  427|       |
  428|       |        /* Init socket context data */
  429|  13.8k|        new ((WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *)webSocketContext)) WebSocketContextData<SSL, USERDATA>(topicTree);
  430|  13.8k|        return webSocketContext->init();
  431|  13.8k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEv:
  248|  13.8k|    WebSocketContext<SSL, isServer, USERDATA> *init() {
  249|       |        /* Adopting a socket does not trigger open event.
  250|       |         * We arreive as WebSocket with timeout set and
  251|       |         * any backpressure from HTTP state kept. */
  252|       |
  253|       |        /* Handle socket disconnections */
  254|  13.8k|        us_socket_context_on_close(SSL, getSocketContext(), [](auto *s, int code, void *reason) {
  255|       |            /* For whatever reason, if we already have emitted close event, do not emit it again */
  256|  13.8k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  13.8k|            if (!webSocketData->isShuttingDown) {
  258|       |                /* Emit close event */
  259|  13.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  260|       |
  261|       |                /* At this point we iterate all currently held subscriptions and emit an event for all of them */
  262|  13.8k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  263|  13.8k|                    for (Topic *t : webSocketData->subscriber->topics) {
  264|  13.8k|                        webSocketContextData->subscriptionHandler((WebSocket<SSL, isServer, USERDATA> *) s, t->name, (int) t->size() - 1, (int) t->size());
  265|  13.8k|                    }
  266|  13.8k|                }
  267|       |
  268|       |                /* Make sure to unsubscribe from any pub/sub node at exit */
  269|  13.8k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  13.8k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  13.8k|                auto *ws = (WebSocket<SSL, isServer, USERDATA> *) s;
  273|  13.8k|                if (webSocketContextData->closeHandler) {
  274|  13.8k|                    webSocketContextData->closeHandler(ws, 1006, {(char *) reason, (size_t) code});
  275|  13.8k|                }
  276|  13.8k|                ((USERDATA *) ws->getUserData())->~USERDATA();
  277|  13.8k|            }
  278|       |
  279|       |            /* Destruct in-placed data struct */
  280|  13.8k|            webSocketData->~WebSocketData();
  281|       |
  282|  13.8k|            return s;
  283|  13.8k|        });
  284|       |
  285|       |        /* Handle WebSocket data streams */
  286|  13.8k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  287|       |
  288|       |            /* We need the websocket data */
  289|  13.8k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  290|       |
  291|       |            /* When in websocket shutdown mode, we do not care for ANY message, whether responding close frame or not.
  292|       |             * We only care for the TCP FIN really, not emitting any message after closing is key */
  293|  13.8k|            if (webSocketData->isShuttingDown) {
  294|  13.8k|                return s;
  295|  13.8k|            }
  296|       |
  297|  13.8k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  298|  13.8k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  299|       |
  300|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  301|  13.8k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  302|  13.8k|            webSocketData->hasTimedOut = false;
  303|       |
  304|       |            /* We always cork on data */
  305|  13.8k|            asyncSocket->cork();
  306|       |
  307|       |            /* This parser has virtually no overhead */
  308|  13.8k|            WebSocketProtocol<isServer, WebSocketContext<SSL, isServer, USERDATA>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
  309|       |
  310|       |            /* Uncorking a closed socekt is fine, in fact it is needed */
  311|  13.8k|            asyncSocket->uncork();
  312|       |
  313|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  314|  13.8k|            if (asyncSocket->getBufferedAmount() == 0) {
  315|       |                /* We can now be in shutdown state */
  316|  13.8k|                if (webSocketData->isShuttingDown) {
  317|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  318|  13.8k|                    asyncSocket->shutdown();
  319|  13.8k|                }
  320|  13.8k|            }
  321|       |
  322|  13.8k|            return s;
  323|  13.8k|        });
  324|       |
  325|       |        /* Handle HTTP write out (note: SSL_read may trigger this spuriously, the app need to handle spurious calls) */
  326|  13.8k|        us_socket_context_on_writable(SSL, getSocketContext(), [](auto *s) {
  327|       |
  328|       |            /* NOTE: Are we called here corked? If so, the below write code is broken, since
  329|       |             * we will have 0 as getBufferedAmount due to writing to cork buffer, then sending TCP FIN before
  330|       |             * we actually uncorked and sent off things */
  331|       |
  332|       |            /* It makes sense to check for us_is_shut_down here and return if so, to avoid shutting down twice */
  333|  13.8k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  334|  13.8k|                return s;
  335|  13.8k|            }
  336|       |
  337|  13.8k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  338|  13.8k|            WebSocketData *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  339|       |
  340|       |            /* We store old backpressure since it is unclear whether write drained anything,
  341|       |             * however, in case of coming here with 0 backpressure we still need to emit drain event */
  342|  13.8k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  343|       |
  344|       |            /* Drain as much as possible */
  345|  13.8k|            asyncSocket->write(nullptr, 0);
  346|       |
  347|       |            /* Behavior: if we actively drain backpressure, always reset timeout (even if we are in shutdown) */
  348|       |            /* Also reset timeout if we came here with 0 backpressure */
  349|  13.8k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  350|  13.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  351|  13.8k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  352|  13.8k|                webSocketData->hasTimedOut = false;
  353|  13.8k|            }
  354|       |
  355|       |            /* Are we in (WebSocket) shutdown mode? */
  356|  13.8k|            if (webSocketData->isShuttingDown) {
  357|       |                /* Check if we just now drained completely */
  358|  13.8k|                if (asyncSocket->getBufferedAmount() == 0) {
  359|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  360|  13.8k|                    asyncSocket->shutdown();
  361|  13.8k|                }
  362|  13.8k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  363|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  364|  13.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  365|  13.8k|                if (webSocketContextData->drainHandler) {
  366|  13.8k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  367|  13.8k|                }
  368|       |                /* No need to check for closed here as we leave the handler immediately*/
  369|  13.8k|            }
  370|       |
  371|  13.8k|            return s;
  372|  13.8k|        });
  373|       |
  374|       |        /* Handle FIN, WebSocket does not support half-closed sockets, so simply close */
  375|  13.8k|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  376|       |
  377|       |            /* If we get a fin, we just close I guess */
  378|  13.8k|            us_socket_close(SSL, (us_socket_t *) s, (int) ERR_TCP_FIN.length(), (void *) ERR_TCP_FIN.data());
  379|       |
  380|  13.8k|            return s;
  381|  13.8k|        });
  382|       |
  383|  13.8k|        us_socket_context_on_long_timeout(SSL, getSocketContext(), [](auto *s) {
  384|  13.8k|            ((WebSocket<SSL, isServer, USERDATA> *) s)->end(1000, "please reconnect");
  385|       |
  386|  13.8k|            return s;
  387|  13.8k|        });
  388|       |
  389|       |        /* Handle socket timeouts, simply close them so to not confuse client with FIN */
  390|  13.8k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  391|       |
  392|  13.8k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  393|  13.8k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  394|       |
  395|  13.8k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  396|  13.8k|                webSocketData->hasTimedOut = true;
  397|  13.8k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  398|       |                /* Send ping without being corked */
  399|  13.8k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  400|  13.8k|                return s;
  401|  13.8k|            }
  402|       |
  403|       |            /* Timeout is very simple; we just close it */
  404|       |            /* Warning: we happen to know forceClose will not use first parameter so pass nullptr here */
  405|  13.8k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  406|       |
  407|  13.8k|            return s;
  408|  13.8k|        });
  409|       |
  410|  13.8k|        return this;
  411|  13.8k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_iPvE_clI11us_socket_tEEDaS4_iS5_:
  254|  40.4k|        us_socket_context_on_close(SSL, getSocketContext(), [](auto *s, int code, void *reason) {
  255|       |            /* For whatever reason, if we already have emitted close event, do not emit it again */
  256|  40.4k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  40.4k|            if (!webSocketData->isShuttingDown) {
  ------------------
  |  Branch (257:17): [True: 34.4k, False: 5.99k]
  ------------------
  258|       |                /* Emit close event */
  259|  34.4k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  260|       |
  261|       |                /* At this point we iterate all currently held subscriptions and emit an event for all of them */
  262|  34.4k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (262:21): [True: 0, False: 34.4k]
  |  Branch (262:50): [True: 0, False: 0]
  ------------------
  263|      0|                    for (Topic *t : webSocketData->subscriber->topics) {
  ------------------
  |  Branch (263:35): [True: 0, False: 0]
  ------------------
  264|      0|                        webSocketContextData->subscriptionHandler((WebSocket<SSL, isServer, USERDATA> *) s, t->name, (int) t->size() - 1, (int) t->size());
  265|      0|                    }
  266|      0|                }
  267|       |
  268|       |                /* Make sure to unsubscribe from any pub/sub node at exit */
  269|  34.4k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  34.4k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  34.4k|                auto *ws = (WebSocket<SSL, isServer, USERDATA> *) s;
  273|  34.4k|                if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (273:21): [True: 33.4k, False: 1.00k]
  ------------------
  274|  33.4k|                    webSocketContextData->closeHandler(ws, 1006, {(char *) reason, (size_t) code});
  275|  33.4k|                }
  276|  34.4k|                ((USERDATA *) ws->getUserData())->~USERDATA();
  277|  34.4k|            }
  278|       |
  279|       |            /* Destruct in-placed data struct */
  280|  40.4k|            webSocketData->~WebSocketData();
  281|       |
  282|  40.4k|            return s;
  283|  40.4k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_PciE_clI11us_socket_tEEDaS4_S5_i:
  286|  60.4k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  287|       |
  288|       |            /* We need the websocket data */
  289|  60.4k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  290|       |
  291|       |            /* When in websocket shutdown mode, we do not care for ANY message, whether responding close frame or not.
  292|       |             * We only care for the TCP FIN really, not emitting any message after closing is key */
  293|  60.4k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (293:17): [True: 408, False: 60.0k]
  ------------------
  294|    408|                return s;
  295|    408|            }
  296|       |
  297|  60.0k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  298|  60.0k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  299|       |
  300|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  301|  60.0k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  302|  60.0k|            webSocketData->hasTimedOut = false;
  303|       |
  304|       |            /* We always cork on data */
  305|  60.0k|            asyncSocket->cork();
  306|       |
  307|       |            /* This parser has virtually no overhead */
  308|  60.0k|            WebSocketProtocol<isServer, WebSocketContext<SSL, isServer, USERDATA>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
  309|       |
  310|       |            /* Uncorking a closed socekt is fine, in fact it is needed */
  311|  60.0k|            asyncSocket->uncork();
  312|       |
  313|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  314|  60.0k|            if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (314:17): [True: 26.0k, False: 34.0k]
  ------------------
  315|       |                /* We can now be in shutdown state */
  316|  26.0k|                if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (316:21): [True: 1.17k, False: 24.8k]
  ------------------
  317|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  318|  1.17k|                    asyncSocket->shutdown();
  319|  1.17k|                }
  320|  26.0k|            }
  321|       |
  322|  60.0k|            return s;
  323|  60.4k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE13setCompressedEPNS_14WebSocketStateILb1EEEPv:
   44|  2.54k|    static bool setCompressed(WebSocketState<isServer> */*wState*/, void *s) {
   45|  2.54k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   46|       |
   47|  2.54k|        if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::ENABLED) {
  ------------------
  |  Branch (47:13): [True: 1.45k, False: 1.09k]
  ------------------
   48|  1.45k|            webSocketData->compressionStatus = WebSocketData::CompressionStatus::COMPRESSED_FRAME;
   49|  1.45k|            return true;
   50|  1.45k|        } else {
   51|  1.09k|            return false;
   52|  1.09k|        }
   53|  2.54k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE10forceCloseEPNS_14WebSocketStateILb1EEEPvNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   55|  11.9k|    static void forceClose(WebSocketState<isServer> */*wState*/, void *s, std::string_view reason = {}) {
   56|  11.9k|        us_socket_close(SSL, (us_socket_t *) s, (int) reason.length(), (void *) reason.data());
   57|  11.9k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE19refusePayloadLengthEmPNS_14WebSocketStateILb1EEEPv:
  241|  93.1k|    static bool refusePayloadLength(uint64_t length, WebSocketState<isServer> */*wState*/, void *s) {
  242|  93.1k|        auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  243|       |
  244|       |        /* Return true for refuse, false for accept */
  245|  93.1k|        return webSocketContextData->maxPayloadLength < length;
  246|  93.1k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE14handleFragmentEPcmjibPNS_14WebSocketStateILb1EEEPv:
   60|  82.0k|    static bool handleFragment(char *data, size_t length, unsigned int remainingBytes, int opCode, bool fin, WebSocketState<isServer> *webSocketState, void *s) {
   61|       |        /* WebSocketData and WebSocketContextData */
   62|  82.0k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
   63|  82.0k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   64|       |
   65|       |        /* Is this a non-control frame? */
   66|  82.0k|        if (opCode < 3) {
  ------------------
  |  Branch (66:13): [True: 61.5k, False: 20.4k]
  ------------------
   67|       |            /* Did we get everything in one go? */
   68|  61.5k|            if (!remainingBytes && fin && !webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (68:17): [True: 25.3k, False: 36.1k]
  |  Branch (68:36): [True: 15.1k, False: 10.2k]
  |  Branch (68:43): [True: 12.7k, False: 2.40k]
  ------------------
   69|       |
   70|       |                /* Handle compressed frame */
   71|  12.7k|                if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (71:21): [True: 699, False: 12.0k]
  ------------------
   72|    699|                        webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
   73|       |
   74|    699|                        LoopData *loopData = (LoopData *) us_loop_ext(us_socket_context_loop(SSL, us_socket_context(SSL, (us_socket_t *) s)));
   75|       |                        /* Decompress using shared or dedicated decompressor */
   76|    699|                        std::optional<std::string_view> inflatedFrame;
   77|    699|                        if (webSocketData->inflationStream) {
  ------------------
  |  Branch (77:29): [True: 0, False: 699]
  ------------------
   78|      0|                            inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, false);
   79|    699|                        } else {
   80|    699|                            inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, true);
   81|    699|                        }
   82|       |
   83|    699|                        if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (83:29): [True: 0, False: 699]
  ------------------
   84|      0|                            forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
   85|      0|                            return true;
   86|    699|                        } else {
   87|    699|                            data = (char *) inflatedFrame->data();
   88|    699|                            length = inflatedFrame->length();
   89|    699|                        }
   90|    699|                }
   91|       |
   92|       |                /* Check text messages for Utf-8 validity */
   93|  12.7k|                if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (93:21): [True: 10.4k, False: 2.30k]
  |  Branch (93:36): [True: 2.35k, False: 8.11k]
  ------------------
   94|  2.35k|                    forceClose(webSocketState, s, ERR_INVALID_TEXT);
   95|  2.35k|                    return true;
   96|  2.35k|                }
   97|       |
   98|       |                /* Emit message event & break if we are closed or shut down when returning */
   99|  10.4k|                if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (99:21): [True: 8.56k, False: 1.85k]
  ------------------
  100|  8.56k|                    webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  101|  8.56k|                    if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (101:25): [True: 0, False: 8.56k]
  |  Branch (101:72): [True: 0, False: 8.56k]
  ------------------
  102|      0|                        return true;
  103|      0|                    }
  104|  8.56k|                }
  105|  48.7k|            } else {
  106|       |                /* Allocate fragment buffer up front first time */
  107|  48.7k|                if (!webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (107:21): [True: 7.90k, False: 40.8k]
  ------------------
  108|  7.90k|                    webSocketData->fragmentBuffer.reserve(length + remainingBytes);
  109|  7.90k|                }
  110|       |                /* Fragments forming a big message are not caught until appending them */
  111|  48.7k|                if (refusePayloadLength(length + webSocketData->fragmentBuffer.length(), webSocketState, s)) {
  ------------------
  |  Branch (111:21): [True: 73, False: 48.7k]
  ------------------
  112|     73|                    forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE);
  113|     73|                    return true;
  114|     73|                }
  115|  48.7k|                webSocketData->fragmentBuffer.append(data, length);
  116|       |
  117|       |                /* Are we done now? */
  118|       |                // todo: what if we don't have any remaining bytes yet we are not fin? forceclose!
  119|  48.7k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (119:21): [True: 12.6k, False: 36.0k]
  |  Branch (119:40): [True: 2.40k, False: 10.2k]
  ------------------
  120|       |
  121|       |                    /* Handle compression */
  122|  2.40k|                    if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (122:25): [True: 658, False: 1.75k]
  ------------------
  123|    658|                            webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
  124|       |
  125|       |                            /* 9 bytes of padding for libdeflate, 4 for zlib */
  126|    658|                            webSocketData->fragmentBuffer.append("123456789");
  127|       |
  128|    658|                            LoopData *loopData = (LoopData *) us_loop_ext(
  129|    658|                                us_socket_context_loop(SSL,
  130|    658|                                    us_socket_context(SSL, (us_socket_t *) s)
  131|    658|                                )
  132|    658|                            );
  133|       |
  134|       |                            /* Decompress using shared or dedicated decompressor */
  135|    658|                            std::optional<std::string_view> inflatedFrame;
  136|    658|                            if (webSocketData->inflationStream) {
  ------------------
  |  Branch (136:33): [True: 0, False: 658]
  ------------------
  137|      0|                                inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, false);
  138|    658|                            } else {
  139|    658|                                inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, true);
  140|    658|                            }
  141|       |
  142|    658|                            if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (142:33): [True: 0, False: 658]
  ------------------
  143|      0|                                forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
  144|      0|                                return true;
  145|    658|                            } else {
  146|    658|                                data = (char *) inflatedFrame->data();
  147|    658|                                length = inflatedFrame->length();
  148|    658|                            }
  149|       |
  150|       |
  151|  1.75k|                    } else {
  152|       |                        // reset length and data ptrs
  153|  1.75k|                        length = webSocketData->fragmentBuffer.length();
  154|  1.75k|                        data = webSocketData->fragmentBuffer.data();
  155|  1.75k|                    }
  156|       |
  157|       |                    /* Check text messages for Utf-8 validity */
  158|  2.40k|                    if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (158:25): [True: 639, False: 1.76k]
  |  Branch (158:40): [True: 230, False: 409]
  ------------------
  159|    230|                        forceClose(webSocketState, s, ERR_INVALID_TEXT);
  160|    230|                        return true;
  161|    230|                    }
  162|       |
  163|       |                    /* Emit message and check for shutdown or close */
  164|  2.17k|                    if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (164:25): [True: 1.91k, False: 268]
  ------------------
  165|  1.91k|                        webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  166|  1.91k|                        if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (166:29): [True: 0, False: 1.91k]
  |  Branch (166:76): [True: 0, False: 1.91k]
  ------------------
  167|      0|                            return true;
  168|      0|                        }
  169|  1.91k|                    }
  170|       |
  171|       |                    /* If we shutdown or closed, this will be taken care of elsewhere */
  172|  2.17k|                    webSocketData->fragmentBuffer.clear();
  173|  2.17k|                }
  174|  48.7k|            }
  175|  61.5k|        } else {
  176|       |            /* Control frames need the websocket to send pings, pongs and close */
  177|  20.4k|            WebSocket<SSL, isServer, USERDATA> *webSocket = (WebSocket<SSL, isServer, USERDATA> *) s;
  178|       |
  179|  20.4k|            if (!remainingBytes && fin && !webSocketData->controlTipLength) {
  ------------------
  |  Branch (179:17): [True: 15.3k, False: 5.16k]
  |  Branch (179:36): [True: 15.3k, False: 0]
  |  Branch (179:43): [True: 12.0k, False: 3.24k]
  ------------------
  180|  12.0k|                if (opCode == CLOSE) {
  ------------------
  |  Branch (180:21): [True: 4.18k, False: 7.90k]
  ------------------
  181|  4.18k|                    auto closeFrame = protocol::parseClosePayload(data, length);
  182|  4.18k|                    webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  183|  4.18k|                    return true;
  184|  7.90k|                } else {
  185|  7.90k|                    if (opCode == PING) {
  ------------------
  |  Branch (185:25): [True: 6.91k, False: 999]
  ------------------
  186|  6.91k|                        webSocket->send(std::string_view(data, length), (OpCode) OpCode::PONG);
  187|  6.91k|                        if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (187:29): [True: 6.64k, False: 270]
  ------------------
  188|  6.64k|                            webSocketContextData->pingHandler(webSocket, {data, length});
  189|  6.64k|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (189:33): [True: 0, False: 6.64k]
  |  Branch (189:80): [True: 0, False: 6.64k]
  ------------------
  190|      0|                                return true;
  191|      0|                            }
  192|  6.64k|                        }
  193|  6.91k|                    } else if (opCode == PONG) {
  ------------------
  |  Branch (193:32): [True: 999, False: 0]
  ------------------
  194|    999|                        if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (194:29): [True: 804, False: 195]
  ------------------
  195|    804|                            webSocketContextData->pongHandler(webSocket, {data, length});
  196|    804|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (196:33): [True: 0, False: 804]
  |  Branch (196:80): [True: 0, False: 804]
  ------------------
  197|      0|                                return true;
  198|      0|                            }
  199|    804|                        }
  200|    999|                    }
  201|  7.90k|                }
  202|  12.0k|            } else {
  203|       |                /* Here we never mind any size optimizations as we are in the worst possible path */
  204|  8.40k|                webSocketData->fragmentBuffer.append(data, length);
  205|  8.40k|                webSocketData->controlTipLength += (unsigned int) length;
  206|       |
  207|  8.40k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (207:21): [True: 3.24k, False: 5.16k]
  |  Branch (207:40): [True: 3.24k, False: 0]
  ------------------
  208|  3.24k|                    char *controlBuffer = (char *) webSocketData->fragmentBuffer.data() + webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength;
  209|  3.24k|                    if (opCode == CLOSE) {
  ------------------
  |  Branch (209:25): [True: 1.81k, False: 1.42k]
  ------------------
  210|  1.81k|                        protocol::CloseFrame closeFrame = protocol::parseClosePayload(controlBuffer, webSocketData->controlTipLength);
  211|  1.81k|                        webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  212|  1.81k|                        return true;
  213|  1.81k|                    } else {
  214|  1.42k|                        if (opCode == PING) {
  ------------------
  |  Branch (214:29): [True: 542, False: 884]
  ------------------
  215|    542|                            webSocket->send(std::string_view(controlBuffer, webSocketData->controlTipLength), (OpCode) OpCode::PONG);
  216|    542|                            if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (216:33): [True: 333, False: 209]
  ------------------
  217|    333|                                webSocketContextData->pingHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  218|    333|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (218:37): [True: 0, False: 333]
  |  Branch (218:84): [True: 0, False: 333]
  ------------------
  219|      0|                                    return true;
  220|      0|                                }
  221|    333|                            }
  222|    884|                        } else if (opCode == PONG) {
  ------------------
  |  Branch (222:36): [True: 884, False: 0]
  ------------------
  223|    884|                            if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (223:33): [True: 422, False: 462]
  ------------------
  224|    422|                                webSocketContextData->pongHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  225|    422|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (225:37): [True: 0, False: 422]
  |  Branch (225:84): [True: 0, False: 422]
  ------------------
  226|      0|                                    return true;
  227|      0|                                }
  228|    422|                            }
  229|    884|                        }
  230|  1.42k|                    }
  231|       |
  232|       |                    /* Same here, we do not care for any particular smart allocation scheme */
  233|  1.42k|                    webSocketData->fragmentBuffer.resize((unsigned int) webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength);
  234|  1.42k|                    webSocketData->controlTipLength = 0;
  235|  1.42k|                }
  236|  8.40k|            }
  237|  20.4k|        }
  238|  73.3k|        return false;
  239|  82.0k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E_clI11us_socket_tEEDaS4_:
  326|  7.29k|        us_socket_context_on_writable(SSL, getSocketContext(), [](auto *s) {
  327|       |
  328|       |            /* NOTE: Are we called here corked? If so, the below write code is broken, since
  329|       |             * we will have 0 as getBufferedAmount due to writing to cork buffer, then sending TCP FIN before
  330|       |             * we actually uncorked and sent off things */
  331|       |
  332|       |            /* It makes sense to check for us_is_shut_down here and return if so, to avoid shutting down twice */
  333|  7.29k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  ------------------
  |  Branch (333:17): [True: 0, False: 7.29k]
  ------------------
  334|      0|                return s;
  335|      0|            }
  336|       |
  337|  7.29k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  338|  7.29k|            WebSocketData *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  339|       |
  340|       |            /* We store old backpressure since it is unclear whether write drained anything,
  341|       |             * however, in case of coming here with 0 backpressure we still need to emit drain event */
  342|  7.29k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  343|       |
  344|       |            /* Drain as much as possible */
  345|  7.29k|            asyncSocket->write(nullptr, 0);
  346|       |
  347|       |            /* Behavior: if we actively drain backpressure, always reset timeout (even if we are in shutdown) */
  348|       |            /* Also reset timeout if we came here with 0 backpressure */
  349|  7.29k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (349:17): [True: 236, False: 7.05k]
  |  Branch (349:34): [True: 4.87k, False: 2.17k]
  ------------------
  350|  5.11k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  351|  5.11k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  352|  5.11k|                webSocketData->hasTimedOut = false;
  353|  5.11k|            }
  354|       |
  355|       |            /* Are we in (WebSocket) shutdown mode? */
  356|  7.29k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (356:17): [True: 1.40k, False: 5.88k]
  ------------------
  357|       |                /* Check if we just now drained completely */
  358|  1.40k|                if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (358:21): [True: 419, False: 990]
  ------------------
  359|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  360|    419|                    asyncSocket->shutdown();
  361|    419|                }
  362|  5.88k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (362:24): [True: 236, False: 5.64k]
  |  Branch (362:41): [True: 4.09k, False: 1.55k]
  ------------------
  363|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  364|  4.32k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  365|  4.32k|                if (webSocketContextData->drainHandler) {
  ------------------
  |  Branch (365:21): [True: 4.10k, False: 225]
  ------------------
  366|  4.10k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  367|  4.10k|                }
  368|       |                /* No need to check for closed here as we leave the handler immediately*/
  369|  4.32k|            }
  370|       |
  371|  7.29k|            return s;
  372|  7.29k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E0_clI11us_socket_tEEDaS4_:
  375|    342|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  376|       |
  377|       |            /* If we get a fin, we just close I guess */
  378|    342|            us_socket_close(SSL, (us_socket_t *) s, (int) ERR_TCP_FIN.length(), (void *) ERR_TCP_FIN.data());
  379|       |
  380|    342|            return s;
  381|    342|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E2_clI11us_socket_tEEDaS4_:
  390|  5.86k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  391|       |
  392|  5.86k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  393|  5.86k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  394|       |
  395|  5.86k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  ------------------
  |  Branch (395:17): [True: 5.86k, False: 0]
  |  Branch (395:65): [True: 2.94k, False: 2.91k]
  |  Branch (395:99): [True: 2.54k, False: 404]
  ------------------
  396|  2.54k|                webSocketData->hasTimedOut = true;
  397|  2.54k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  398|       |                /* Send ping without being corked */
  399|  2.54k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  400|  2.54k|                return s;
  401|  2.54k|            }
  402|       |
  403|       |            /* Timeout is very simple; we just close it */
  404|       |            /* Warning: we happen to know forceClose will not use first parameter so pass nullptr here */
  405|  3.32k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  406|       |
  407|  3.32k|            return s;
  408|  5.86k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4freeEv:
  413|  13.8k|    void free() {
  414|  13.8k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
  415|  13.8k|        webSocketContextData->~WebSocketContextData();
  416|       |
  417|  13.8k|        us_socket_context_free(SSL, (us_socket_context_t *) this);
  418|  13.8k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE16getSocketContextEv:
   35|  90.2k|    us_socket_context_t *getSocketContext() {
   36|  90.2k|        return (us_socket_context_t *) this;
   37|  90.2k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6getExtEv:
   39|   222k|    WebSocketContextData<SSL, USERDATA> *getExt() {
   40|   222k|        return (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
   41|   222k|    }

EpollHelloWorld.cpp:_ZN3uWS20WebSocketContextDataILb0EZ4testvE13PerSocketDataEC2EPNS_9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEE:
  102|  13.8k|    WebSocketContextData(TopicTree<TopicTreeMessage, TopicTreeBigMessage> *topicTree) : topicTree(topicTree) {
  103|       |
  104|  13.8k|    }
EpollHelloWorld.cpp:_ZN3uWS20WebSocketContextDataILb0EZ4testvE13PerSocketDataED2Ev:
   98|  13.8k|    ~WebSocketContextData() {
   99|       |
  100|  13.8k|    }
EpollHelloWorld.cpp:_ZN3uWS20WebSocketContextDataILb0EZ4testvE13PerSocketDataE29calculateIdleTimeoutCompnentsEt:
   86|  13.8k|    void calculateIdleTimeoutCompnents(unsigned short idleTimeout) {
   87|  13.8k|        unsigned short margin = 4;
   88|       |        /* 4, 8 or 16 seconds margin based on idleTimeout */
   89|  27.7k|        while ((int) idleTimeout - margin * 2 >= margin * 2 && margin < 16) {
  ------------------
  |  Branch (89:16): [True: 20.8k, False: 6.94k]
  |  Branch (89:64): [True: 13.8k, False: 6.94k]
  ------------------
   90|  13.8k|            margin = (unsigned short) (margin << 1);
   91|  13.8k|        }
   92|  13.8k|        idleTimeoutComponents = {
   93|  13.8k|            idleTimeout - (sendPingsAutomatically ? margin : 0), /* reduce normal idleTimeout if it is extended by ping-timeout */
  ------------------
  |  Branch (93:28): [True: 13.8k, False: 0]
  ------------------
   94|  13.8k|            margin /* ping-timeout - also used for end() timeout */
   95|  13.8k|        };
   96|  13.8k|    }

_ZN3uWS13WebSocketDataD2Ev:
   69|  40.4k|    ~WebSocketData() {
   70|  40.4k|        if (deflationStream) {
  ------------------
  |  Branch (70:13): [True: 0, False: 40.4k]
  ------------------
   71|      0|            delete deflationStream;
   72|      0|        }
   73|       |
   74|  40.4k|        if (inflationStream) {
  ------------------
  |  Branch (74:13): [True: 0, False: 40.4k]
  ------------------
   75|      0|            delete inflationStream;
   76|      0|        }
   77|       |
   78|  40.4k|        if (subscriber) {
  ------------------
  |  Branch (78:13): [True: 0, False: 40.4k]
  ------------------
   79|      0|            delete subscriber;
   80|      0|        }
   81|  40.4k|    }
_ZN3uWS13WebSocketDataC2EbNS_15CompressOptionsEONS_12BackPressureE:
   55|  40.4k|    WebSocketData(bool perMessageDeflate, CompressOptions compressOptions, BackPressure &&backpressure) : AsyncSocketData<false>(std::move(backpressure)), WebSocketState<true>() {
   56|  40.4k|        compressionStatus = perMessageDeflate ? ENABLED : DISABLED;
  ------------------
  |  Branch (56:29): [True: 3.74k, False: 36.7k]
  ------------------
   57|       |
   58|       |        /* Initialize the dedicated sliding window(s) */
   59|  40.4k|        if (perMessageDeflate) {
  ------------------
  |  Branch (59:13): [True: 3.74k, False: 36.7k]
  ------------------
   60|  3.74k|            if ((compressOptions & CompressOptions::_COMPRESSOR_MASK) != CompressOptions::SHARED_COMPRESSOR) {
  ------------------
  |  Branch (60:17): [True: 0, False: 3.74k]
  ------------------
   61|      0|                deflationStream = new DeflationStream(compressOptions);
   62|      0|            }
   63|  3.74k|            if ((compressOptions & CompressOptions::_DECOMPRESSOR_MASK) != CompressOptions::SHARED_DECOMPRESSOR) {
  ------------------
  |  Branch (63:17): [True: 0, False: 3.74k]
  ------------------
   64|      0|                inflationStream = new InflationStream(compressOptions);
   65|      0|            }
   66|  3.74k|        }
   67|  40.4k|    }

EpollHelloWorld.cpp:_ZN3uWSL20negotiateCompressionEbiiNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  144|  6.02k|static inline std::tuple<bool, int, int, std::string_view> negotiateCompression(bool wantCompression, int wantedCompressionWindow, int wantedInflationWindow, std::string_view offer) {
  145|       |
  146|       |    /* If we don't want compression then we are done here */
  147|  6.02k|    if (!wantCompression) {
  ------------------
  |  Branch (147:9): [True: 0, False: 6.02k]
  ------------------
  148|      0|        return {false, 0, 0, ""};
  149|      0|    }
  150|       |
  151|  6.02k|    ExtensionsParser ep(offer.data(), offer.length());
  152|       |
  153|  6.02k|    static thread_local std::string response;
  154|  6.02k|    response = "";
  155|       |
  156|  6.02k|    int compressionWindow = wantedCompressionWindow;
  157|  6.02k|    int inflationWindow = wantedInflationWindow;
  158|  6.02k|    bool compression = false;
  159|       |
  160|  6.02k|    if (ep.xWebKitDeflateFrame) {
  ------------------
  |  Branch (160:9): [True: 783, False: 5.24k]
  ------------------
  161|       |        /* We now have compression */
  162|    783|        compression = true;
  163|    783|        response = "x-webkit-deflate-frame";
  164|       |
  165|       |        /* If the other peer has DEMANDED us no sliding window,
  166|       |         * we cannot compress with anything other than shared compressor */
  167|    783|        if (ep.noContextTakeover) {
  ------------------
  |  Branch (167:13): [True: 320, False: 463]
  ------------------
  168|       |            /* We must fail here right now (fix pub/sub) */
  169|    320|#ifndef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  170|    320|            if (wantedCompressionWindow != 0) {
  ------------------
  |  Branch (170:17): [True: 0, False: 320]
  ------------------
  171|      0|                return {false, 0, 0, ""};
  172|      0|            }
  173|    320|#endif
  174|       |
  175|    320|            compressionWindow = 0;
  176|    320|        }
  177|       |
  178|       |        /* If the other peer has DEMANDED us to use a limited sliding window,
  179|       |         * we have to limit out compression sliding window */
  180|    783|        if (ep.maxWindowBits && ep.maxWindowBits < compressionWindow) {
  ------------------
  |  Branch (180:13): [True: 249, False: 534]
  |  Branch (180:33): [True: 0, False: 249]
  ------------------
  181|      0|            compressionWindow = ep.maxWindowBits;
  182|      0|#ifndef UWS_ALLOW_8_WINDOW_BITS
  183|       |            /* We cannot really deny this, so we have to disable compression in this case */
  184|      0|            if (compressionWindow == 8) {
  ------------------
  |  Branch (184:17): [True: 0, False: 0]
  ------------------
  185|      0|                return {false, 0, 0, ""};
  186|      0|            }
  187|      0|#endif
  188|      0|        }
  189|       |
  190|       |        /* We decide our own inflation sliding window (and their compression sliding window) */
  191|    783|        if (wantedInflationWindow < 15) {
  ------------------
  |  Branch (191:13): [True: 783, False: 0]
  ------------------
  192|    783|            if (!wantedInflationWindow) {
  ------------------
  |  Branch (192:17): [True: 783, False: 0]
  ------------------
  193|    783|                response += "; no_context_takeover";
  194|    783|            } else {
  195|      0|                response += "; max_window_bits=" + std::to_string(wantedInflationWindow);
  196|      0|            }
  197|    783|        }
  198|  5.24k|    } else if (ep.perMessageDeflate) {
  ------------------
  |  Branch (198:16): [True: 2.96k, False: 2.27k]
  ------------------
  199|       |        /* We now have compression */
  200|  2.96k|        compression = true;
  201|  2.96k|        response = "permessage-deflate";
  202|       |
  203|  2.96k|        if (ep.clientNoContextTakeover) {
  ------------------
  |  Branch (203:13): [True: 234, False: 2.72k]
  ------------------
  204|    234|            inflationWindow = 0;
  205|  2.72k|        } else if (ep.clientMaxWindowBits && ep.clientMaxWindowBits != 1) {
  ------------------
  |  Branch (205:20): [True: 1.64k, False: 1.08k]
  |  Branch (205:46): [True: 1.44k, False: 204]
  ------------------
  206|  1.44k|            inflationWindow = std::min<int>(ep.clientMaxWindowBits, inflationWindow);
  207|  1.44k|        }
  208|       |
  209|       |        /* Whatever we have now, write */
  210|  2.96k|        if (inflationWindow < 15) {
  ------------------
  |  Branch (210:13): [True: 2.96k, False: 0]
  ------------------
  211|  2.96k|            if (!inflationWindow || !ep.clientMaxWindowBits) {
  ------------------
  |  Branch (211:17): [True: 2.96k, False: 0]
  |  Branch (211:37): [True: 0, False: 0]
  ------------------
  212|  2.96k|                response += "; client_no_context_takeover";
  213|  2.96k|                inflationWindow = 0;
  214|  2.96k|            } else {
  215|      0|                response += "; client_max_window_bits=" + std::to_string(inflationWindow);
  216|      0|            }
  217|  2.96k|        }
  218|       |
  219|       |        /* This block basically lets the client lower it */
  220|  2.96k|        if (ep.serverNoContextTakeover) {
  ------------------
  |  Branch (220:13): [True: 194, False: 2.76k]
  ------------------
  221|       |        /* This is an important (temporary) fix since we haven't allowed
  222|       |         * these two modes to mix, and pub/sub will not handle this case (yet) */
  223|       |#ifdef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  224|       |            compressionWindow = 0;
  225|       |#endif
  226|  2.76k|        } else if (ep.serverMaxWindowBits) {
  ------------------
  |  Branch (226:20): [True: 293, False: 2.47k]
  ------------------
  227|    293|            compressionWindow = std::min<int>(ep.serverMaxWindowBits, compressionWindow);
  228|    293|#ifndef UWS_ALLOW_8_WINDOW_BITS
  229|       |            /* Zlib cannot do windowBits=8, memLevel=1 so we raise it up to 9 minimum */
  230|    293|            if (compressionWindow == 8) {
  ------------------
  |  Branch (230:17): [True: 0, False: 293]
  ------------------
  231|      0|                compressionWindow = 9;
  232|      0|            }
  233|    293|#endif
  234|    293|        }
  235|       |
  236|       |        /* Whatever we have now, write */
  237|  2.96k|        if (compressionWindow < 15) {
  ------------------
  |  Branch (237:13): [True: 2.96k, False: 0]
  ------------------
  238|  2.96k|            if (!compressionWindow) {
  ------------------
  |  Branch (238:17): [True: 2.96k, False: 0]
  ------------------
  239|  2.96k|                response += "; server_no_context_takeover";
  240|  2.96k|            } else {
  241|      0|                response += "; server_max_window_bits=" + std::to_string(compressionWindow);
  242|      0|            }
  243|  2.96k|        }
  244|  2.96k|    }
  245|       |
  246|       |    /* A final sanity check (this check does not actually catch too high values!) */
  247|  6.02k|    if ((compressionWindow && compressionWindow < 8) || compressionWindow > 15 || (inflationWindow && inflationWindow < 8) || inflationWindow > 15) {
  ------------------
  |  Branch (247:10): [True: 0, False: 6.02k]
  |  Branch (247:31): [True: 0, False: 0]
  |  Branch (247:57): [True: 0, False: 6.02k]
  |  Branch (247:84): [True: 0, False: 6.02k]
  |  Branch (247:103): [True: 0, False: 0]
  |  Branch (247:127): [True: 0, False: 6.02k]
  ------------------
  248|      0|        return {false, 0, 0, ""};
  249|      0|    }
  250|       |
  251|  6.02k|    return {compression, compressionWindow, inflationWindow, response};
  252|  6.02k|}
_ZN3uWS16ExtensionsParserC2EPKcm:
   93|  6.02k|    ExtensionsParser(const char *data, size_t length) {
   94|  6.02k|        const char *stop = data + length;
   95|  6.02k|        int token = 1;
   96|       |
   97|       |        /* Ignore anything before permessage-deflate or x-webkit-deflate-frame */
   98|  20.0k|        for (; token && token != TOK_PERMESSAGE_DEFLATE && token != TOK_X_WEBKIT_DEFLATE_FRAME; token = getToken(data, stop));
  ------------------
  |  Branch (98:16): [True: 17.7k, False: 2.27k]
  |  Branch (98:25): [True: 14.7k, False: 2.96k]
  |  Branch (98:60): [True: 14.0k, False: 783]
  ------------------
   99|       |
  100|       |        /* What protocol are we going to use? */
  101|  6.02k|        perMessageDeflate = (token == TOK_PERMESSAGE_DEFLATE);
  102|  6.02k|        xWebKitDeflateFrame = (token == TOK_X_WEBKIT_DEFLATE_FRAME);
  103|       |
  104|  20.9k|        while ((token = getToken(data, stop))) {
  ------------------
  |  Branch (104:16): [True: 15.5k, False: 5.42k]
  ------------------
  105|  15.5k|            switch (token) {
  106|    258|            case TOK_X_WEBKIT_DEFLATE_FRAME:
  ------------------
  |  Branch (106:13): [True: 258, False: 15.2k]
  ------------------
  107|       |                /* Duplicates not allowed/supported */
  108|    258|                return;
  109|    515|            case TOK_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (109:13): [True: 515, False: 15.0k]
  ------------------
  110|    515|                noContextTakeover = true;
  111|    515|                break;
  112|    445|            case TOK_MAX_WINDOW_BITS:
  ------------------
  |  Branch (112:13): [True: 445, False: 15.1k]
  ------------------
  113|    445|                maxWindowBits = 1;
  114|    445|                lastInteger = &maxWindowBits;
  115|    445|                break;
  116|    339|            case TOK_PERMESSAGE_DEFLATE:
  ------------------
  |  Branch (116:13): [True: 339, False: 15.2k]
  ------------------
  117|       |                /* Duplicates not allowed/supported */
  118|    339|                return;
  119|    388|            case TOK_SERVER_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (119:13): [True: 388, False: 15.1k]
  ------------------
  120|    388|                serverNoContextTakeover = true;
  121|    388|                break;
  122|    408|            case TOK_CLIENT_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (122:13): [True: 408, False: 15.1k]
  ------------------
  123|    408|                clientNoContextTakeover = true;
  124|    408|                break;
  125|    474|            case TOK_SERVER_MAX_WINDOW_BITS:
  ------------------
  |  Branch (125:13): [True: 474, False: 15.0k]
  ------------------
  126|    474|                serverMaxWindowBits = 1;
  127|    474|                lastInteger = &serverMaxWindowBits;
  128|    474|                break;
  129|  1.83k|            case TOK_CLIENT_MAX_WINDOW_BITS:
  ------------------
  |  Branch (129:13): [True: 1.83k, False: 13.7k]
  ------------------
  130|  1.83k|                clientMaxWindowBits = 1;
  131|  1.83k|                lastInteger = &clientMaxWindowBits;
  132|  1.83k|                break;
  133|  10.8k|            default:
  ------------------
  |  Branch (133:13): [True: 10.8k, False: 4.66k]
  ------------------
  134|  10.8k|                if (token < 0 && lastInteger) {
  ------------------
  |  Branch (134:21): [True: 4.26k, False: 6.62k]
  |  Branch (134:34): [True: 3.76k, False: 501]
  ------------------
  135|  3.76k|                    *lastInteger = -token;
  136|  3.76k|                }
  137|  10.8k|                break;
  138|  15.5k|            }
  139|  15.5k|        }
  140|  6.02k|    }
_ZN3uWS16ExtensionsParser8getTokenERPKcS2_:
   69|  34.9k|    int getToken(const char *&in, const char *stop) {
   70|  68.6k|        while (in != stop && !isalnum(*in)) {
  ------------------
  |  Branch (70:16): [True: 62.8k, False: 5.78k]
  |  Branch (70:30): [True: 33.6k, False: 29.2k]
  ------------------
   71|  33.6k|            in++;
   72|  33.6k|        }
   73|       |
   74|       |        /* Don't care more than this for now */
   75|  34.9k|        static_assert(SHRT_MIN > INT_MIN, "Integer overflow fix is invalid for this platform, report this as a bug!");
   76|       |
   77|  34.9k|        int hashedToken = 0;
   78|   247k|        while (in != stop && (isalnum(*in) || *in == '-' || *in == '_')) {
  ------------------
  |  Branch (78:16): [True: 236k, False: 10.7k]
  |  Branch (78:31): [True: 201k, False: 35.1k]
  |  Branch (78:47): [True: 9.92k, False: 25.2k]
  |  Branch (78:61): [True: 1.05k, False: 24.1k]
  ------------------
   79|   212k|            if (isdigit(*in)) {
  ------------------
  |  Branch (79:17): [True: 20.9k, False: 191k]
  ------------------
   80|       |                /* This check is a quick and incorrect fix for integer overflow
   81|       |                 * in oss-fuzz but we don't care as it doesn't matter either way */
   82|  20.9k|                if (hashedToken > SHRT_MIN && hashedToken < SHRT_MAX) {
  ------------------
  |  Branch (82:21): [True: 20.3k, False: 540]
  |  Branch (82:47): [True: 19.9k, False: 452]
  ------------------
   83|  19.9k|                    hashedToken = hashedToken * 10 - (*in - '0');
   84|  19.9k|                }
   85|   191k|            } else {
   86|   191k|                hashedToken += *in;
   87|   191k|            }
   88|   212k|            in++;
   89|   212k|        }
   90|  34.9k|        return hashedToken;
   91|  34.9k|    }

_ZN3uWS18WebSocketHandshake8generateEPKcPc:
  116|  40.4k|    static inline void generate(const char input[24], char output[28]) {
  117|  40.4k|        uint32_t b_output[5] = {
  118|  40.4k|            0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
  119|  40.4k|        };
  120|  40.4k|        uint32_t b_input[16] = {
  121|  40.4k|            0, 0, 0, 0, 0, 0, 0x32353845, 0x41464135, 0x2d453931, 0x342d3437, 0x44412d39,
  122|  40.4k|            0x3543412d, 0x43354142, 0x30444338, 0x35423131, 0x80000000
  123|  40.4k|        };
  124|       |
  125|   283k|        for (int i = 0; i < 6; i++) {
  ------------------
  |  Branch (125:25): [True: 242k, False: 40.4k]
  ------------------
  126|   242k|            b_input[i] = (uint32_t) ((input[4 * i + 3] & 0xff) | (input[4 * i + 2] & 0xff) << 8 | (input[4 * i + 1] & 0xff) << 16 | (input[4 * i + 0] & 0xff) << 24);
  127|   242k|        }
  128|  40.4k|        sha1(b_output, b_input);
  129|  40.4k|        uint32_t last_b[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480};
  130|  40.4k|        sha1(b_output, last_b);
  131|   242k|        for (int i = 0; i < 5; i++) {
  ------------------
  |  Branch (131:25): [True: 202k, False: 40.4k]
  ------------------
  132|   202k|            uint32_t tmp = b_output[i];
  133|   202k|            char *bytes = (char *) &b_output[i];
  134|   202k|            bytes[3] = (char) (tmp & 0xff);
  135|   202k|            bytes[2] = (char) ((tmp >> 8) & 0xff);
  136|   202k|            bytes[1] = (char) ((tmp >> 16) & 0xff);
  137|   202k|            bytes[0] = (char) ((tmp >> 24) & 0xff);
  138|   202k|        }
  139|  40.4k|        base64((unsigned char *) b_output, output);
  140|  40.4k|    }
_ZN3uWS18WebSocketHandshake4sha1EPjS1_:
   91|  80.9k|    static inline void sha1(uint32_t hash[5], uint32_t b[16]) {
   92|  80.9k|        uint32_t a[5] = {hash[4], hash[3], hash[2], hash[1], hash[0]};
   93|  80.9k|        static_for<16, Sha1Loop1>()(a, b);
   94|  80.9k|        static_for<4, Sha1Loop2>()(a, b);
   95|  80.9k|        static_for<20, Sha1Loop3>()(a, b);
   96|  80.9k|        static_for<20, Sha1Loop4>()(a, b);
   97|  80.9k|        static_for<20, Sha1Loop5>()(a, b);
   98|  80.9k|        static_for<5, Sha1Loop6>()(a, hash);
   99|  80.9k|    }
_ZN3uWS18WebSocketHandshake10static_forILi16ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi15ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi14ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi13ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi12ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi11ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi10ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi9ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi8ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi7ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi6ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi5ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop1EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop1EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi0EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake3rolEjm:
   40|  18.1M|    static inline uint32_t rol(uint32_t value, size_t bits) {return (value << bits) | (value >> (32 - bits));}
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi1EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi2EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi3EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi4EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi5EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi6EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi7EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi8EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi9EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi10EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi11EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi12EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi13EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi14EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop11fILi15EEEvPjS3_:
   47|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   48|  80.9k|            a[i % 5] += ((a[(3 + i) % 5] & (a[(2 + i) % 5] ^ a[(1 + i) % 5])) ^ a[(1 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(4 + i) % 5], 5);
   49|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   50|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop2EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop2EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop2EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop2EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop2EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop21fILi0EEEvPjS3_:
   54|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   55|  80.9k|            b[i] = blk(b, i);
   56|  80.9k|            a[(1 + i) % 5] += ((a[(4 + i) % 5] & (a[(3 + i) % 5] ^ a[(2 + i) % 5])) ^ a[(2 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(5 + i) % 5], 5);
   57|  80.9k|            a[(4 + i) % 5] = rol(a[(4 + i) % 5], 30);
   58|  80.9k|        }
_ZN3uWS18WebSocketHandshake3blkEPjm:
   41|  5.18M|    static inline uint32_t blk(uint32_t b[16], size_t i) {
   42|  5.18M|        return rol(b[(i + 13) & 15] ^ b[(i + 8) & 15] ^ b[(i + 2) & 15] ^ b[i], 1);
   43|  5.18M|    }
_ZN3uWS18WebSocketHandshake9Sha1Loop21fILi1EEEvPjS3_:
   54|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   55|  80.9k|            b[i] = blk(b, i);
   56|  80.9k|            a[(1 + i) % 5] += ((a[(4 + i) % 5] & (a[(3 + i) % 5] ^ a[(2 + i) % 5])) ^ a[(2 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(5 + i) % 5], 5);
   57|  80.9k|            a[(4 + i) % 5] = rol(a[(4 + i) % 5], 30);
   58|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop21fILi2EEEvPjS3_:
   54|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   55|  80.9k|            b[i] = blk(b, i);
   56|  80.9k|            a[(1 + i) % 5] += ((a[(4 + i) % 5] & (a[(3 + i) % 5] ^ a[(2 + i) % 5])) ^ a[(2 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(5 + i) % 5], 5);
   57|  80.9k|            a[(4 + i) % 5] = rol(a[(4 + i) % 5], 30);
   58|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop21fILi3EEEvPjS3_:
   54|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   55|  80.9k|            b[i] = blk(b, i);
   56|  80.9k|            a[(1 + i) % 5] += ((a[(4 + i) % 5] & (a[(3 + i) % 5] ^ a[(2 + i) % 5])) ^ a[(2 + i) % 5]) + b[i] + 0x5a827999 + rol(a[(5 + i) % 5], 5);
   57|  80.9k|            a[(4 + i) % 5] = rol(a[(4 + i) % 5], 30);
   58|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi20ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi19ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi18ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi17ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi16ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi15ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi14ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi13ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi12ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi11ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi10ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi9ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi8ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi7ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi6ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi5ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop3EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop3EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi0EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi1EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi2EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi3EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi4EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi5EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi6EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi7EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi8EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi9EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi10EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi11EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi12EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi13EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi14EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi15EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi16EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi17EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi18EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop31fILi19EEEvPjS3_:
   62|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   63|  80.9k|            b[(i + 4) % 16] = blk(b, (i + 4) % 16);
   64|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 4) % 16] + 0x6ed9eba1 + rol(a[(4 + i) % 5], 5);
   65|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   66|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi20ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi19ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi18ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi17ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi16ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi15ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi14ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi13ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi12ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi11ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi10ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi9ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi8ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi7ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi6ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi5ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop4EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop4EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi0EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi1EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi2EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi3EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi4EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi5EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi6EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi7EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi8EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi9EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi10EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi11EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi12EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi13EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi14EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi15EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi16EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi17EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi18EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop41fILi19EEEvPjS3_:
   70|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   71|  80.9k|            b[(i + 8) % 16] = blk(b, (i + 8) % 16);
   72|  80.9k|            a[i % 5] += (((a[(3 + i) % 5] | a[(2 + i) % 5]) & a[(1 + i) % 5]) | (a[(3 + i) % 5] & a[(2 + i) % 5])) + b[(i + 8) % 16] + 0x8f1bbcdc + rol(a[(4 + i) % 5], 5);
   73|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   74|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi20ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi19ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi18ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi17ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi16ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi15ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi14ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi13ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi12ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi11ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi10ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi9ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi8ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi7ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi6ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi5ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop5EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop5EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi0EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi1EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi2EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi3EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi4EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi5EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi6EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi7EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi8EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi9EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi10EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi11EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi12EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi13EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi14EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi15EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi16EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi17EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi18EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop51fILi19EEEvPjS3_:
   78|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   79|  80.9k|            b[(i + 12) % 16] = blk(b, (i + 12) % 16);
   80|  80.9k|            a[i % 5] += (a[(3 + i) % 5] ^ a[(2 + i) % 5] ^ a[(1 + i) % 5]) + b[(i + 12) % 16] + 0xca62c1d6 + rol(a[(4 + i) % 5], 5);
   81|  80.9k|            a[(3 + i) % 5] = rol(a[(3 + i) % 5], 30);
   82|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi5ENS0_9Sha1Loop6EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi4ENS0_9Sha1Loop6EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi3ENS0_9Sha1Loop6EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi2ENS0_9Sha1Loop6EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi1ENS0_9Sha1Loop6EEclEPjS4_:
   29|  80.9k|        void operator()(uint32_t *a, uint32_t *b) {
   30|  80.9k|            static_for<N - 1, T>()(a, b);
   31|  80.9k|            T::template f<N - 1>(a, b);
   32|  80.9k|        }
_ZN3uWS18WebSocketHandshake10static_forILi0ENS0_9Sha1Loop6EEclEPjS4_:
   37|  80.9k|        void operator()(uint32_t */*a*/, uint32_t */*hash*/) {}
_ZN3uWS18WebSocketHandshake9Sha1Loop61fILi0EEEvPjS3_:
   86|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   87|  80.9k|            b[i] += a[4 - i];
   88|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop61fILi1EEEvPjS3_:
   86|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   87|  80.9k|            b[i] += a[4 - i];
   88|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop61fILi2EEEvPjS3_:
   86|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   87|  80.9k|            b[i] += a[4 - i];
   88|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop61fILi3EEEvPjS3_:
   86|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   87|  80.9k|            b[i] += a[4 - i];
   88|  80.9k|        }
_ZN3uWS18WebSocketHandshake9Sha1Loop61fILi4EEEvPjS3_:
   86|  80.9k|        static inline void f(uint32_t *a, uint32_t *b) {
   87|  80.9k|            b[i] += a[4 - i];
   88|  80.9k|        }
_ZN3uWS18WebSocketHandshake6base64EPhPc:
  101|  40.4k|    static inline void base64(unsigned char *src, char *dst) {
  102|  40.4k|        const char *b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  103|   283k|        for (int i = 0; i < 18; i += 3) {
  ------------------
  |  Branch (103:25): [True: 242k, False: 40.4k]
  ------------------
  104|   242k|            *dst++ = b64[(src[i] >> 2) & 63];
  105|   242k|            *dst++ = b64[((src[i] & 3) << 4) | ((src[i + 1] & 240) >> 4)];
  106|   242k|            *dst++ = b64[((src[i + 1] & 15) << 2) | ((src[i + 2] & 192) >> 6)];
  107|   242k|            *dst++ = b64[src[i + 2] & 63];
  108|   242k|        }
  109|  40.4k|        *dst++ = b64[(src[18] >> 2) & 63];
  110|  40.4k|        *dst++ = b64[((src[18] & 3) << 4) | ((src[19] & 240) >> 4)];
  111|  40.4k|        *dst++ = b64[((src[19] & 15) << 2)];
  112|  40.4k|        *dst++ = '=';
  113|  40.4k|    }

EpollHelloWorld.cpp:_ZN3uWS8protocolL13formatMessageILb1EEEmPcPKcmNS_6OpCodeEmbb:
  214|  23.5k|static inline size_t formatMessage(char *dst, const char *src, size_t length, OpCode opCode, size_t reportedLength, bool compressed, bool fin) {
  215|  23.5k|    size_t messageLength;
  216|  23.5k|    size_t headerLength;
  217|  23.5k|    if (reportedLength < 126) {
  ------------------
  |  Branch (217:9): [True: 22.6k, False: 824]
  ------------------
  218|  22.6k|        headerLength = 2;
  219|  22.6k|        dst[1] = (char) reportedLength;
  220|  22.6k|    } else if (reportedLength <= UINT16_MAX) {
  ------------------
  |  Branch (220:16): [True: 824, False: 0]
  ------------------
  221|    824|        headerLength = 4;
  222|    824|        dst[1] = 126;
  223|    824|        uint16_t tmp = cond_byte_swap<uint16_t>((uint16_t) reportedLength);
  224|    824|        memcpy(&dst[2], &tmp, sizeof(uint16_t));
  225|    824|    } else {
  226|      0|        headerLength = 10;
  227|      0|        dst[1] = 127;
  228|      0|        uint64_t tmp = cond_byte_swap<uint64_t>((uint64_t) reportedLength);
  229|      0|        memcpy(&dst[2], &tmp, sizeof(uint64_t));
  230|      0|    }
  231|       |
  232|  23.5k|    dst[0] = (char) ((fin ? 128 : 0) | ((compressed && opCode) ? SND_COMPRESSED : 0) | (char) opCode);
  ------------------
  |  Branch (232:23): [True: 23.5k, False: 0]
  |  Branch (232:42): [True: 2.25k, False: 21.2k]
  |  Branch (232:56): [True: 2.25k, False: 0]
  ------------------
  233|       |
  234|       |    //printf("%d\n", (int)dst[0]);
  235|       |
  236|  23.5k|    char mask[4];
  237|  23.5k|    if (!isServer) {
  ------------------
  |  Branch (237:9): [Folded - Ignored]
  ------------------
  238|      0|        dst[1] |= 0x80;
  239|      0|        uint32_t random = (uint32_t) rand();
  240|      0|        memcpy(mask, &random, 4);
  241|      0|        memcpy(dst + headerLength, &random, 4);
  242|      0|        headerLength += 4;
  243|      0|    }
  244|       |
  245|  23.5k|    messageLength = headerLength + length;
  246|  23.5k|    memcpy(dst + headerLength, src, length);
  247|       |
  248|  23.5k|    if (!isServer) {
  ------------------
  |  Branch (248:9): [Folded - Ignored]
  ------------------
  249|       |
  250|       |        // overwrites up to 3 bytes outside of the given buffer!
  251|       |        //WebSocketProtocol<isServer>::unmaskInplace(dst + headerLength, dst + headerLength + length, mask);
  252|       |
  253|       |        // this is not optimal
  254|      0|        char *start = dst + headerLength;
  255|      0|        char *stop = start + length;
  256|      0|        int i = 0;
  257|      0|        while (start != stop) {
  ------------------
  |  Branch (257:16): [True: 0, False: 0]
  ------------------
  258|      0|            (*start++) ^= mask[i++ % 4];
  259|      0|        }
  260|      0|    }
  261|  23.5k|    return messageLength;
  262|  23.5k|}
_ZN3uWS8protocol14cond_byte_swapItEET_S2_:
   97|  12.2k|T cond_byte_swap(T value) {
   98|  12.2k|    static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
   99|  12.2k|    uint32_t endian_test = 1;
  100|  12.2k|    if (*reinterpret_cast<char*>(&endian_test)) {
  ------------------
  |  Branch (100:9): [True: 12.2k, False: 0]
  ------------------
  101|  12.2k|        uint8_t src[sizeof(T)];
  102|  12.2k|        uint8_t dst[sizeof(T)];
  103|       |
  104|  12.2k|        std::memcpy(src, &value, sizeof(T));
  105|  36.8k|        for (size_t i = 0; i < sizeof(T); ++i) {
  ------------------
  |  Branch (105:28): [True: 24.5k, False: 12.2k]
  ------------------
  106|  24.5k|            dst[i] = src[sizeof(T) - 1 - i];
  107|  24.5k|        }
  108|       |
  109|  12.2k|        T result;
  110|  12.2k|        std::memcpy(&result, dst, sizeof(T));
  111|  12.2k|        return result;
  112|  12.2k|    }
  113|      0|    return value;
  114|  12.2k|}
_ZN3uWS8protocol14cond_byte_swapImEET_S2_:
   97|  3.74k|T cond_byte_swap(T value) {
   98|  3.74k|    static_assert(std::is_trivially_copyable<T>::value, "T must be trivially copyable");
   99|  3.74k|    uint32_t endian_test = 1;
  100|  3.74k|    if (*reinterpret_cast<char*>(&endian_test)) {
  ------------------
  |  Branch (100:9): [True: 3.74k, False: 0]
  ------------------
  101|  3.74k|        uint8_t src[sizeof(T)];
  102|  3.74k|        uint8_t dst[sizeof(T)];
  103|       |
  104|  3.74k|        std::memcpy(src, &value, sizeof(T));
  105|  33.7k|        for (size_t i = 0; i < sizeof(T); ++i) {
  ------------------
  |  Branch (105:28): [True: 29.9k, False: 3.74k]
  ------------------
  106|  29.9k|            dst[i] = src[sizeof(T) - 1 - i];
  107|  29.9k|        }
  108|       |
  109|  3.74k|        T result;
  110|  3.74k|        std::memcpy(&result, dst, sizeof(T));
  111|  3.74k|        return result;
  112|  3.74k|    }
  113|      0|    return value;
  114|  3.74k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL16messageFrameSizeEm:
  198|  23.5k|static inline size_t messageFrameSize(size_t messageSize) {
  199|  23.5k|    if (messageSize < 126) {
  ------------------
  |  Branch (199:9): [True: 22.6k, False: 824]
  ------------------
  200|  22.6k|        return 2 + messageSize;
  201|  22.6k|    } else if (messageSize <= UINT16_MAX) {
  ------------------
  |  Branch (201:16): [True: 824, False: 0]
  ------------------
  202|    824|        return 4 + messageSize;
  203|    824|    }
  204|      0|    return 10 + messageSize;
  205|  23.5k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE7consumeEPcjPNS_14WebSocketStateILb1EEEPv:
  463|  60.0k|    static inline void consume(char *src, unsigned int length, WebSocketState<isServer> *wState, void *user) {
  464|  60.0k|        if (wState->state.spillLength) {
  ------------------
  |  Branch (464:13): [True: 2.61k, False: 57.4k]
  ------------------
  465|  2.61k|            src -= wState->state.spillLength;
  466|  2.61k|            length += wState->state.spillLength;
  467|  2.61k|            memcpy(src, wState->state.spill, wState->state.spillLength);
  468|  2.61k|        }
  469|  60.0k|        if (wState->state.wantsHead) {
  ------------------
  |  Branch (469:13): [True: 21.4k, False: 38.6k]
  ------------------
  470|  26.2k|            parseNext:
  471|  53.5k|            while (length >= SHORT_MESSAGE_HEADER) {
  ------------------
  |  Branch (471:20): [True: 49.8k, False: 3.71k]
  ------------------
  472|       |
  473|       |                // invalid reserved bits / invalid opcodes / invalid control frames / set compressed frame
  474|  49.8k|                if ((rsv1(src) && !Impl::setCompressed(wState, user)) || rsv23(src) || (getOpCode(src) > 2 && getOpCode(src) < 8) ||
  ------------------
  |  Branch (474:22): [True: 2.54k, False: 47.2k]
  |  Branch (474:35): [True: 1.09k, False: 1.45k]
  |  Branch (474:74): [True: 897, False: 47.8k]
  |  Branch (474:89): [True: 17.0k, False: 30.7k]
  |  Branch (474:111): [True: 254, False: 16.8k]
  ------------------
  475|  49.8k|                    getOpCode(src) > 10 || (getOpCode(src) > 2 && (!isFin(src) || payloadLength(src) > 125))) {
  ------------------
  |  Branch (475:21): [True: 291, False: 47.2k]
  |  Branch (475:45): [True: 16.5k, False: 30.7k]
  |  Branch (475:68): [True: 266, False: 16.2k]
  |  Branch (475:83): [True: 288, False: 15.9k]
  ------------------
  476|  3.09k|                    Impl::forceClose(wState, user, ERR_PROTOCOL);
  477|  3.09k|                    return;
  478|  3.09k|                }
  479|       |
  480|  46.7k|                if (payloadLength(src) < 126) {
  ------------------
  |  Branch (480:21): [True: 38.1k, False: 8.56k]
  ------------------
  481|  38.1k|                    if (consumeMessage<SHORT_MESSAGE_HEADER, uint8_t>(payloadLength(src), src, length, wState, user)) {
  ------------------
  |  Branch (481:25): [True: 13.9k, False: 24.1k]
  ------------------
  482|  13.9k|                        return;
  483|  13.9k|                    }
  484|  38.1k|                } else if (payloadLength(src) == 126) {
  ------------------
  |  Branch (484:28): [True: 4.53k, False: 4.03k]
  ------------------
  485|  4.53k|                    if (length < MEDIUM_MESSAGE_HEADER) {
  ------------------
  |  Branch (485:25): [True: 220, False: 4.31k]
  ------------------
  486|    220|                        break;
  487|  4.31k|                    } else if(consumeMessage<MEDIUM_MESSAGE_HEADER, uint16_t>(protocol::cond_byte_swap<uint16_t>(protocol::bit_cast<uint16_t>(src + 2)), src, length, wState, user)) {
  ------------------
  |  Branch (487:31): [True: 2.36k, False: 1.94k]
  ------------------
  488|  2.36k|                        return;
  489|  2.36k|                    }
  490|  4.53k|                } else if (length < LONG_MESSAGE_HEADER) {
  ------------------
  |  Branch (490:28): [True: 283, False: 3.74k]
  ------------------
  491|    283|                    break;
  492|  3.74k|                } else if (consumeMessage<LONG_MESSAGE_HEADER, uint64_t>(protocol::cond_byte_swap<uint64_t>(protocol::bit_cast<uint64_t>(src + 2)), src, length, wState, user)) {
  ------------------
  |  Branch (492:28): [True: 2.54k, False: 1.20k]
  ------------------
  493|  2.54k|                    return;
  494|  2.54k|                }
  495|  46.7k|            }
  496|  4.22k|            if (length) {
  ------------------
  |  Branch (496:17): [True: 3.14k, False: 1.07k]
  ------------------
  497|  3.14k|                memcpy(wState->state.spill, src, length);
  498|  3.14k|                wState->state.spillLength = length & 0xf;
  499|  3.14k|            }
  500|  38.6k|        } else if (consumeContinuation(src, length, wState, user)) {
  ------------------
  |  Branch (500:20): [True: 4.80k, False: 33.8k]
  ------------------
  501|  4.80k|            goto parseNext;
  502|  4.80k|        }
  503|  60.0k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE4rsv1EPc:
  279|  49.8k|    static inline bool rsv1(char *frame) {return *((unsigned char *) frame) & 64;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5rsv23EPc:
  278|  48.7k|    static inline bool rsv23(char *frame) {return *((unsigned char *) frame) & 48;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE9getOpCodeEPc:
  276|   247k|    static inline unsigned char getOpCode(char *frame) {return *((unsigned char *) frame) & 15;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5isFinEPc:
  275|   104k|    static inline bool isFin(char *frame) {return *((unsigned char *) frame) & 128;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13payloadLengthEPc:
  277|   109k|    static inline unsigned char payloadLength(char *frame) {return ((unsigned char *) frame)[1] & 127;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj6EhEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  345|  38.1k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  346|  38.1k|        if (getOpCode(src)) {
  ------------------
  |  Branch (346:13): [True: 32.3k, False: 5.78k]
  ------------------
  347|  32.3k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (347:17): [True: 196, False: 32.1k]
  |  Branch (347:48): [True: 2.82k, False: 29.3k]
  |  Branch (347:74): [True: 250, False: 2.57k]
  ------------------
  348|    446|                Impl::forceClose(wState, user, ERR_PROTOCOL);
  349|    446|                return true;
  350|    446|            }
  351|  31.9k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  352|  31.9k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (352:20): [True: 269, False: 5.52k]
  ------------------
  353|    269|            Impl::forceClose(wState, user, ERR_PROTOCOL);
  354|    269|            return true;
  355|    269|        }
  356|  37.4k|        wState->state.lastFin = isFin(src);
  357|       |
  358|  37.4k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (358:13): [True: 0, False: 37.4k]
  ------------------
  359|      0|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  360|      0|            return true;
  361|      0|        }
  362|       |
  363|  37.4k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (363:13): [True: 30.2k, False: 7.22k]
  ------------------
  364|  30.2k|            bool fin = isFin(src);
  365|  30.2k|            if (isServer) {
  ------------------
  |  Branch (365:17): [Folded - Ignored]
  ------------------
  366|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  367|  30.2k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  368|  30.2k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (368:21): [True: 6.04k, False: 24.1k]
  ------------------
  369|  6.04k|                    return true;
  370|  6.04k|                }
  371|  30.2k|            } else {
  372|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (372:21): [True: 0, False: 0]
  ------------------
  373|      0|                    return true;
  374|      0|                }
  375|      0|            }
  376|       |
  377|  24.1k|            if (fin) {
  ------------------
  |  Branch (377:17): [True: 16.4k, False: 7.75k]
  ------------------
  378|  16.4k|                wState->state.opStack--;
  379|  16.4k|            }
  380|       |
  381|  24.1k|            src += payLength + MESSAGE_HEADER;
  382|  24.1k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  383|  24.1k|            wState->state.spillLength = 0;
  384|  24.1k|            return false;
  385|  30.2k|        } else {
  386|  7.22k|            wState->state.spillLength = 0;
  387|  7.22k|            wState->state.wantsHead = false;
  388|  7.22k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  389|  7.22k|            bool fin = isFin(src);
  390|  7.22k|            if constexpr (isServer) {
  391|  7.22k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  392|  7.22k|                uint64_t mask;
  393|  7.22k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  394|  7.22k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  395|  7.22k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  396|  7.22k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  397|  7.22k|            }
  398|  7.22k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  399|  7.22k|            return true;
  400|  7.22k|        }
  401|  37.4k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi6EEEvPcj:
  313|  30.2k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  314|       |        if constexpr (HEADER_SIZE != 6) {
  315|       |            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  316|       |            uint64_t maskInt;
  317|       |            memcpy(&maskInt, mask, 8);
  318|       |            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  319|  30.2k|        } else {
  320|  30.2k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  321|  30.2k|            uint32_t maskInt;
  322|  30.2k|            memcpy(&maskInt, mask, 4);
  323|  30.2k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  324|  30.2k|        }
  325|  30.2k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise4ILi6EEEvPcjj:
  302|  30.2k|    static inline void unmaskImprecise4(char *src, uint32_t mask, unsigned int length) {
  303|   122k|        for (unsigned int n = (length >> 2) + 1; n; n--) {
  ------------------
  |  Branch (303:50): [True: 91.9k, False: 30.2k]
  ------------------
  304|  91.9k|            uint32_t loaded;
  305|  91.9k|            memcpy(&loaded, src, 4);
  306|  91.9k|            loaded ^= mask;
  307|  91.9k|            memcpy(src - DESTINATION, &loaded, 4);
  308|  91.9k|            src += 4;
  309|  91.9k|        }
  310|  30.2k|    }
EpollHelloWorld.cpp:_ZN3uWS8protocolL11isValidUtf8EPhm:
  122|  14.0k|{
  123|  24.2k|    for (unsigned char *e = s + length; s != e; ) {
  ------------------
  |  Branch (123:41): [True: 23.1k, False: 1.05k]
  ------------------
  124|  23.1k|        if (s + 16 <= e) {
  ------------------
  |  Branch (124:13): [True: 10.0k, False: 13.1k]
  ------------------
  125|  10.0k|            uint64_t tmp[2];
  126|  10.0k|            memcpy(tmp, s, 16);
  127|  10.0k|            if (((tmp[0] & 0x8080808080808080) | (tmp[1] & 0x8080808080808080)) == 0) {
  ------------------
  |  Branch (127:17): [True: 7.12k, False: 2.87k]
  ------------------
  128|  7.12k|                s += 16;
  129|  7.12k|                continue;
  130|  7.12k|            }
  131|  10.0k|        }
  132|       |
  133|  27.6k|        while (!(*s & 0x80)) {
  ------------------
  |  Branch (133:16): [True: 20.4k, False: 7.14k]
  ------------------
  134|  20.4k|            if (++s == e) {
  ------------------
  |  Branch (134:17): [True: 8.92k, False: 11.5k]
  ------------------
  135|  8.92k|                return true;
  136|  8.92k|            }
  137|  20.4k|        }
  138|       |
  139|  7.14k|        if ((s[0] & 0x60) == 0x40) {
  ------------------
  |  Branch (139:13): [True: 1.75k, False: 5.38k]
  ------------------
  140|  1.75k|            if (s + 1 >= e || (s[1] & 0xc0) != 0x80 || (s[0] & 0xfe) == 0xc0) {
  ------------------
  |  Branch (140:17): [True: 214, False: 1.54k]
  |  Branch (140:31): [True: 418, False: 1.12k]
  |  Branch (140:56): [True: 197, False: 926]
  ------------------
  141|    829|                return false;
  142|    829|            }
  143|    926|            s += 2;
  144|  5.38k|        } else if ((s[0] & 0xf0) == 0xe0) {
  ------------------
  |  Branch (144:20): [True: 2.60k, False: 2.78k]
  ------------------
  145|  2.60k|            if (s + 2 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (145:17): [True: 207, False: 2.39k]
  |  Branch (145:31): [True: 258, False: 2.13k]
  |  Branch (145:56): [True: 224, False: 1.91k]
  ------------------
  146|  2.60k|                    (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || (s[0] == 0xed && (s[1] & 0xe0) == 0xa0)) {
  ------------------
  |  Branch (146:22): [True: 414, False: 1.50k]
  |  Branch (146:38): [True: 194, False: 220]
  |  Branch (146:65): [True: 1.07k, False: 644]
  |  Branch (146:81): [True: 232, False: 844]
  ------------------
  147|  1.11k|                return false;
  148|  1.11k|            }
  149|  1.48k|            s += 3;
  150|  2.78k|        } else if ((s[0] & 0xf8) == 0xf0) {
  ------------------
  |  Branch (150:20): [True: 2.16k, False: 624]
  ------------------
  151|  2.16k|            if (s + 3 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (151:17): [True: 257, False: 1.90k]
  |  Branch (151:31): [True: 219, False: 1.68k]
  |  Branch (151:56): [True: 243, False: 1.44k]
  |  Branch (151:81): [True: 217, False: 1.22k]
  ------------------
  152|  2.16k|                    (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4) {
  ------------------
  |  Branch (152:22): [True: 390, False: 834]
  |  Branch (152:38): [True: 195, False: 195]
  |  Branch (152:65): [True: 401, False: 628]
  |  Branch (152:81): [True: 197, False: 204]
  |  Branch (152:97): [True: 195, False: 637]
  ------------------
  153|  1.52k|                return false;
  154|  1.52k|            }
  155|    637|            s += 4;
  156|    637|        } else {
  157|    624|            return false;
  158|    624|        }
  159|  7.14k|    }
  160|  1.05k|    return true;
  161|  14.0k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL17parseClosePayloadEPcm:
  169|  5.99k|static inline CloseFrame parseClosePayload(char *src, size_t length) {
  170|       |    /* If we get no code or message, default to reporting 1005 no status code present */
  171|  5.99k|    CloseFrame cf = {1005, nullptr, 0};
  172|  5.99k|    if (length >= 2) {
  ------------------
  |  Branch (172:9): [True: 5.69k, False: 301]
  ------------------
  173|  5.69k|        memcpy(&cf.code, src, 2);
  174|  5.69k|        cf = {cond_byte_swap<uint16_t>(cf.code), src + 2, length - 2};
  175|  5.69k|        if (cf.code < 1000 || cf.code > 4999 || (cf.code > 1011 && cf.code < 4000) ||
  ------------------
  |  Branch (175:13): [True: 457, False: 5.24k]
  |  Branch (175:31): [True: 1.44k, False: 3.79k]
  |  Branch (175:50): [True: 1.74k, False: 2.04k]
  |  Branch (175:68): [True: 422, False: 1.32k]
  ------------------
  176|  5.69k|            (cf.code >= 1004 && cf.code <= 1006) || !isValidUtf8((unsigned char *) cf.message, cf.length)) {
  ------------------
  |  Branch (176:14): [True: 2.17k, False: 1.20k]
  |  Branch (176:33): [True: 409, False: 1.76k]
  |  Branch (176:53): [True: 1.50k, False: 1.46k]
  ------------------
  177|       |            /* Even though we got a WebSocket close frame, it in itself is abnormal */
  178|  4.23k|            return {1006, (char *) ERR_INVALID_CLOSE_PAYLOAD.data(), ERR_INVALID_CLOSE_PAYLOAD.length()};
  179|  4.23k|        }
  180|  5.69k|    }
  181|  1.76k|    return cf;
  182|  5.99k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL18formatClosePayloadEPctPKcm:
  184|  5.99k|static inline size_t formatClosePayload(char *dst, uint16_t code, const char *message, size_t length) {
  185|       |    /* We could have more strict checks here, but never append code 0 or 1005 or 1006 */
  186|  5.99k|    if (code && code != 1005 && code != 1006) {
  ------------------
  |  Branch (186:9): [True: 5.99k, False: 0]
  |  Branch (186:17): [True: 5.69k, False: 301]
  |  Branch (186:33): [True: 1.46k, False: 4.23k]
  ------------------
  187|  1.46k|        code = cond_byte_swap<uint16_t>(code);
  188|  1.46k|        memcpy(dst, &code, 2);
  189|       |        /* It is invalid to pass nullptr to memcpy, even though length is 0 */
  190|  1.46k|        if (message) {
  ------------------
  |  Branch (190:13): [True: 1.46k, False: 0]
  ------------------
  191|  1.46k|            memcpy(dst + 2, message, length);
  192|  1.46k|        }
  193|  1.46k|        return length + 2;
  194|  1.46k|    }
  195|  4.53k|    return 0;
  196|  5.99k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi0EEEvPcmj:
  290|  9.48k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  291|  60.2k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (291:50): [True: 50.7k, False: 9.48k]
  ------------------
  292|  50.7k|            uint64_t loaded;
  293|  50.7k|            memcpy(&loaded, src, 8);
  294|  50.7k|            loaded ^= mask;
  295|  50.7k|            memcpy(src - DESTINATION, &loaded, 8);
  296|  50.7k|            src += 8;
  297|  50.7k|        }
  298|  9.48k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE10rotateMaskEjPc:
  327|  40.7k|    static inline void rotateMask(unsigned int offset, char *mask) {
  328|  40.7k|        char originalMask[4] = {mask[0], mask[1], mask[2], mask[3]};
  329|  40.7k|        mask[(0 + offset) % 4] = originalMask[0];
  330|  40.7k|        mask[(1 + offset) % 4] = originalMask[1];
  331|  40.7k|        mask[(2 + offset) % 4] = originalMask[2];
  332|  40.7k|        mask[(3 + offset) % 4] = originalMask[3];
  333|  40.7k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj8EtEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  345|  4.31k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  346|  4.31k|        if (getOpCode(src)) {
  ------------------
  |  Branch (346:13): [True: 3.56k, False: 746]
  ------------------
  347|  3.56k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (347:17): [True: 194, False: 3.37k]
  |  Branch (347:48): [True: 701, False: 2.67k]
  |  Branch (347:74): [True: 195, False: 506]
  ------------------
  348|    389|                Impl::forceClose(wState, user, ERR_PROTOCOL);
  349|    389|                return true;
  350|    389|            }
  351|  3.17k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  352|  3.17k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (352:20): [True: 194, False: 552]
  ------------------
  353|    194|            Impl::forceClose(wState, user, ERR_PROTOCOL);
  354|    194|            return true;
  355|    194|        }
  356|  3.73k|        wState->state.lastFin = isFin(src);
  357|       |
  358|  3.73k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (358:13): [True: 209, False: 3.52k]
  ------------------
  359|    209|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  360|    209|            return true;
  361|    209|        }
  362|       |
  363|  3.52k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (363:13): [True: 2.19k, False: 1.32k]
  ------------------
  364|  2.19k|            bool fin = isFin(src);
  365|  2.19k|            if (isServer) {
  ------------------
  |  Branch (365:17): [Folded - Ignored]
  ------------------
  366|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  367|  2.19k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  368|  2.19k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (368:21): [True: 247, False: 1.94k]
  ------------------
  369|    247|                    return true;
  370|    247|                }
  371|  2.19k|            } else {
  372|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (372:21): [True: 0, False: 0]
  ------------------
  373|      0|                    return true;
  374|      0|                }
  375|      0|            }
  376|       |
  377|  1.94k|            if (fin) {
  ------------------
  |  Branch (377:17): [True: 1.38k, False: 565]
  ------------------
  378|  1.38k|                wState->state.opStack--;
  379|  1.38k|            }
  380|       |
  381|  1.94k|            src += payLength + MESSAGE_HEADER;
  382|  1.94k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  383|  1.94k|            wState->state.spillLength = 0;
  384|  1.94k|            return false;
  385|  2.19k|        } else {
  386|  1.32k|            wState->state.spillLength = 0;
  387|  1.32k|            wState->state.wantsHead = false;
  388|  1.32k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  389|  1.32k|            bool fin = isFin(src);
  390|  1.32k|            if constexpr (isServer) {
  391|  1.32k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  392|  1.32k|                uint64_t mask;
  393|  1.32k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  394|  1.32k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  395|  1.32k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  396|  1.32k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  397|  1.32k|            }
  398|  1.32k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  399|  1.32k|            return true;
  400|  1.32k|        }
  401|  3.52k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi8EEEvPcj:
  313|  2.19k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  314|  2.19k|        if constexpr (HEADER_SIZE != 6) {
  315|  2.19k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  316|  2.19k|            uint64_t maskInt;
  317|  2.19k|            memcpy(&maskInt, mask, 8);
  318|  2.19k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  319|       |        } else {
  320|       |            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  321|       |            uint32_t maskInt;
  322|       |            memcpy(&maskInt, mask, 4);
  323|       |            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  324|       |        }
  325|  2.19k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi8EEEvPcmj:
  290|  2.19k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  291|  12.9k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (291:50): [True: 10.7k, False: 2.19k]
  ------------------
  292|  10.7k|            uint64_t loaded;
  293|  10.7k|            memcpy(&loaded, src, 8);
  294|  10.7k|            loaded ^= mask;
  295|  10.7k|            memcpy(src - DESTINATION, &loaded, 8);
  296|  10.7k|            src += 8;
  297|  10.7k|        }
  298|  2.19k|    }
_ZN3uWS8protocol8bit_castItEET_Pc:
   89|  4.31k|T bit_cast(char *c) {
   90|  4.31k|    T val;
   91|  4.31k|    memcpy(&val, c, sizeof(T));
   92|  4.31k|    return val;
   93|  4.31k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj14EmEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  345|  3.74k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  346|  3.74k|        if (getOpCode(src)) {
  ------------------
  |  Branch (346:13): [True: 2.81k, False: 931]
  ------------------
  347|  2.81k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (347:17): [True: 194, False: 2.62k]
  |  Branch (347:48): [True: 480, False: 2.14k]
  |  Branch (347:74): [True: 199, False: 281]
  ------------------
  348|    393|                Impl::forceClose(wState, user, ERR_PROTOCOL);
  349|    393|                return true;
  350|    393|            }
  351|  2.42k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  352|  2.42k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (352:20): [True: 194, False: 737]
  ------------------
  353|    194|            Impl::forceClose(wState, user, ERR_PROTOCOL);
  354|    194|            return true;
  355|    194|        }
  356|  3.16k|        wState->state.lastFin = isFin(src);
  357|       |
  358|  3.16k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (358:13): [True: 776, False: 2.38k]
  ------------------
  359|    776|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  360|    776|            return true;
  361|    776|        }
  362|       |
  363|  2.38k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (363:13): [True: 1.44k, False: 937]
  ------------------
  364|  1.44k|            bool fin = isFin(src);
  365|  1.44k|            if (isServer) {
  ------------------
  |  Branch (365:17): [Folded - Ignored]
  ------------------
  366|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  367|  1.44k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  368|  1.44k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (368:21): [True: 245, False: 1.20k]
  ------------------
  369|    245|                    return true;
  370|    245|                }
  371|  1.44k|            } else {
  372|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (372:21): [True: 0, False: 0]
  ------------------
  373|      0|                    return true;
  374|      0|                }
  375|      0|            }
  376|       |
  377|  1.20k|            if (fin) {
  ------------------
  |  Branch (377:17): [True: 596, False: 608]
  ------------------
  378|    596|                wState->state.opStack--;
  379|    596|            }
  380|       |
  381|  1.20k|            src += payLength + MESSAGE_HEADER;
  382|  1.20k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  383|  1.20k|            wState->state.spillLength = 0;
  384|  1.20k|            return false;
  385|  1.44k|        } else {
  386|    937|            wState->state.spillLength = 0;
  387|    937|            wState->state.wantsHead = false;
  388|    937|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  389|    937|            bool fin = isFin(src);
  390|    937|            if constexpr (isServer) {
  391|    937|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  392|    937|                uint64_t mask;
  393|    937|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  394|    937|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  395|    937|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  396|    937|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  397|    937|            }
  398|    937|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  399|    937|            return true;
  400|    937|        }
  401|  2.38k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi14EEEvPcj:
  313|  1.44k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  314|  1.44k|        if constexpr (HEADER_SIZE != 6) {
  315|  1.44k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  316|  1.44k|            uint64_t maskInt;
  317|  1.44k|            memcpy(&maskInt, mask, 8);
  318|  1.44k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  319|       |        } else {
  320|       |            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  321|       |            uint32_t maskInt;
  322|       |            memcpy(&maskInt, mask, 4);
  323|       |            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  324|       |        }
  325|  1.44k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi14EEEvPcmj:
  290|  1.44k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  291|  5.61k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (291:50): [True: 4.16k, False: 1.44k]
  ------------------
  292|  4.16k|            uint64_t loaded;
  293|  4.16k|            memcpy(&loaded, src, 8);
  294|  4.16k|            loaded ^= mask;
  295|  4.16k|            memcpy(src - DESTINATION, &loaded, 8);
  296|  4.16k|            src += 8;
  297|  4.16k|        }
  298|  1.44k|    }
_ZN3uWS8protocol8bit_castImEET_Pc:
   89|  3.74k|T bit_cast(char *c) {
   90|  3.74k|    T val;
   91|  3.74k|    memcpy(&val, c, sizeof(T));
   92|  3.74k|    return val;
   93|  3.74k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE19consumeContinuationERPcRjPNS_14WebSocketStateILb1EEEPv:
  410|  38.6k|    static inline bool consumeContinuation(char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  411|  38.6k|        if (wState->remainingBytes <= length) {
  ------------------
  |  Branch (411:13): [True: 6.85k, False: 31.8k]
  ------------------
  412|  6.85k|            if (isServer) {
  ------------------
  |  Branch (412:17): [Folded - Ignored]
  ------------------
  413|  6.85k|                unsigned int n = wState->remainingBytes >> 2;
  414|  6.85k|                unmaskInplace(src, src + n * 4, wState->mask);
  415|  16.8k|                for (unsigned int i = 0, s = wState->remainingBytes % 4; i < s; i++) {
  ------------------
  |  Branch (415:74): [True: 10.0k, False: 6.85k]
  ------------------
  416|  10.0k|                    src[n * 4 + i] ^= wState->mask[i];
  417|  10.0k|                }
  418|  6.85k|            }
  419|       |
  420|  6.85k|            if (Impl::handleFragment(src, wState->remainingBytes, 0, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (420:17): [True: 2.05k, False: 4.80k]
  ------------------
  421|  2.05k|                return false;
  422|  2.05k|            }
  423|       |
  424|  4.80k|            if (wState->state.lastFin) {
  ------------------
  |  Branch (424:17): [True: 3.51k, False: 1.28k]
  ------------------
  425|  3.51k|                wState->state.opStack--;
  426|  3.51k|            }
  427|       |
  428|  4.80k|            src += wState->remainingBytes;
  429|  4.80k|            length -= wState->remainingBytes;
  430|  4.80k|            wState->state.wantsHead = true;
  431|  4.80k|            return true;
  432|  31.8k|        } else {
  433|  31.8k|            if (isServer) {
  ------------------
  |  Branch (433:17): [Folded - Ignored]
  ------------------
  434|       |                /* No need to unmask if mask is 0 */
  435|  31.8k|                uint32_t nullmask = 0;
  436|  31.8k|                if (memcmp(wState->mask, &nullmask, sizeof(uint32_t))) {
  ------------------
  |  Branch (436:21): [True: 31.5k, False: 251]
  ------------------
  437|  31.5k|                    if /*constexpr*/ (LIBUS_RECV_BUFFER_LENGTH == length) {
  ------------------
  |  |   22|  31.5k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  |  Branch (437:39): [True: 0, False: 31.5k]
  ------------------
  438|      0|                        unmaskAll(src, wState->mask);
  439|  31.5k|                    } else {
  440|       |                        // Slow path
  441|  31.5k|                        unmaskInplace(src, src + ((length >> 2) + 1) * 4, wState->mask);
  442|  31.5k|                    }
  443|  31.5k|                }
  444|  31.8k|            }
  445|       |
  446|  31.8k|            wState->remainingBytes -= length;
  447|  31.8k|            if (Impl::handleFragment(src, length, wState->remainingBytes, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (447:17): [True: 71, False: 31.7k]
  ------------------
  448|     71|                return false;
  449|     71|            }
  450|       |
  451|  31.7k|            if (isServer && length % 4) {
  ------------------
  |  Branch (451:17): [Folded - Ignored]
  |  Branch (451:29): [True: 31.2k, False: 474]
  ------------------
  452|  31.2k|                rotateMask(4 - (length % 4), wState->mask);
  453|  31.2k|            }
  454|  31.7k|            return false;
  455|  31.8k|        }
  456|  38.6k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13unmaskInplaceEPcS5_S5_:
  335|  38.4k|    static inline void unmaskInplace(char *data, char *stop, char *mask) {
  336|  1.17M|        while (data < stop) {
  ------------------
  |  Branch (336:16): [True: 1.14M, False: 38.4k]
  ------------------
  337|  1.14M|            *(data++) ^= mask[0];
  338|  1.14M|            *(data++) ^= mask[1];
  339|  1.14M|            *(data++) ^= mask[2];
  340|  1.14M|            *(data++) ^= mask[3];
  341|  1.14M|        }
  342|  38.4k|    }
_ZN3uWS14WebSocketStateILb1EE5StateC2Ev:
   72|  40.4k|        State() {
   73|  40.4k|            wantsHead = true;
   74|  40.4k|            spillLength = 0;
   75|  40.4k|            opStack = -1;
   76|  40.4k|            lastFin = true;
   77|  40.4k|        }

apple_no_sigpipe:
  269|  1.38M|LIBUS_SOCKET_DESCRIPTOR apple_no_sigpipe(LIBUS_SOCKET_DESCRIPTOR fd) {
  270|       |#ifdef __APPLE__
  271|       |    if (fd != LIBUS_SOCKET_ERROR) {
  272|       |        int no_sigpipe = 1;
  273|       |        setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (void *) &no_sigpipe, sizeof(int));
  274|       |    }
  275|       |#endif
  276|  1.38M|    return fd;
  277|  1.38M|}
bsd_set_nonblocking:
  279|  1.38M|LIBUS_SOCKET_DESCRIPTOR bsd_set_nonblocking(LIBUS_SOCKET_DESCRIPTOR fd) {
  280|       |#ifdef _WIN32
  281|       |    /* Libuv will set windows sockets as non-blocking */
  282|       |#else
  283|  1.38M|    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
  284|  1.38M|#endif
  285|  1.38M|    return fd;
  286|  1.38M|}
bsd_socket_nodelay:
  288|  1.37M|void bsd_socket_nodelay(LIBUS_SOCKET_DESCRIPTOR fd, int enabled) {
  289|  1.37M|    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &enabled, sizeof(enabled));
  290|  1.37M|}
bsd_socket_flush:
  292|    225|void bsd_socket_flush(LIBUS_SOCKET_DESCRIPTOR fd) {
  293|       |    // Linux TCP_CORK has the same underlying corking mechanism as with MSG_MORE
  294|    225|#ifdef TCP_CORK
  295|    225|    int enabled = 0;
  296|    225|    setsockopt(fd, IPPROTO_TCP, TCP_CORK, (void *) &enabled, sizeof(int));
  297|    225|#endif
  298|    225|}
bsd_create_socket:
  300|  13.7k|LIBUS_SOCKET_DESCRIPTOR bsd_create_socket(int domain, int type, int protocol) {
  301|       |    // returns INVALID_SOCKET on error
  302|  13.7k|    int flags = 0;
  303|  13.7k|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  304|  13.7k|    flags = SOCK_CLOEXEC | SOCK_NONBLOCK;
  305|  13.7k|#endif
  306|       |
  307|  13.7k|    LIBUS_SOCKET_DESCRIPTOR created_fd = socket(domain, type | flags, protocol);
  ------------------
  |  |   38|  13.7k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  308|       |
  309|  13.7k|    return bsd_set_nonblocking(apple_no_sigpipe(created_fd));
  310|  13.7k|}
bsd_close_socket:
  312|  1.38M|void bsd_close_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  313|       |#ifdef _WIN32
  314|       |    closesocket(fd);
  315|       |#else
  316|  1.38M|    close(fd);
  317|  1.38M|#endif
  318|  1.38M|}
bsd_shutdown_socket:
  320|  91.1k|void bsd_shutdown_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  321|       |#ifdef _WIN32
  322|       |    shutdown(fd, SD_SEND);
  323|       |#else
  324|  91.1k|    shutdown(fd, SHUT_WR);
  325|  91.1k|#endif
  326|  91.1k|}
bsd_shutdown_socket_read:
  328|    844|void bsd_shutdown_socket_read(LIBUS_SOCKET_DESCRIPTOR fd) {
  329|       |#ifdef _WIN32
  330|       |    shutdown(fd, SD_RECEIVE);
  331|       |#else
  332|    844|    shutdown(fd, SHUT_RD);
  333|    844|#endif
  334|    844|}
internal_finalize_bsd_addr:
  336|  1.41M|void internal_finalize_bsd_addr(struct bsd_addr_t *addr) {
  337|       |    // parse, so to speak, the address
  338|  1.41M|    if (addr->mem.ss_family == AF_INET6) {
  ------------------
  |  Branch (338:9): [True: 801k, False: 610k]
  ------------------
  339|   801k|        addr->ip = (char *) &((struct sockaddr_in6 *) addr)->sin6_addr;
  340|   801k|        addr->ip_length = sizeof(struct in6_addr);
  341|   801k|        addr->port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
  342|   801k|    } else if (addr->mem.ss_family == AF_INET) {
  ------------------
  |  Branch (342:16): [True: 610k, False: 0]
  ------------------
  343|   610k|        addr->ip = (char *) &((struct sockaddr_in *) addr)->sin_addr;
  344|   610k|        addr->ip_length = sizeof(struct in_addr);
  345|   610k|        addr->port = ntohs(((struct sockaddr_in *) addr)->sin_port);
  346|   610k|    } else {
  347|      0|        addr->ip_length = 0;
  348|      0|        addr->port = -1;
  349|      0|    }
  350|  1.41M|}
bsd_local_addr:
  352|  2.03k|int bsd_local_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  353|  2.03k|    addr->len = sizeof(addr->mem);
  354|  2.03k|    if (getsockname(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (354:9): [True: 2.03k, False: 0]
  ------------------
  355|  2.03k|        return -1;
  356|  2.03k|    }
  357|      0|    internal_finalize_bsd_addr(addr);
  358|      0|    return 0;
  359|  2.03k|}
bsd_remote_addr:
  361|  39.0k|int bsd_remote_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  362|  39.0k|    addr->len = sizeof(addr->mem);
  363|  39.0k|    if (getpeername(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (363:9): [True: 0, False: 39.0k]
  ------------------
  364|      0|        return -1;
  365|      0|    }
  366|  39.0k|    internal_finalize_bsd_addr(addr);
  367|  39.0k|    return 0;
  368|  39.0k|}
bsd_addr_get_ip:
  370|  1.41M|char *bsd_addr_get_ip(struct bsd_addr_t *addr) {
  371|  1.41M|    return addr->ip;
  372|  1.41M|}
bsd_addr_get_ip_length:
  374|  1.45M|int bsd_addr_get_ip_length(struct bsd_addr_t *addr) {
  375|  1.45M|    return addr->ip_length;
  376|  1.45M|}
bsd_accept_socket:
  383|  3.80M|LIBUS_SOCKET_DESCRIPTOR bsd_accept_socket(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  384|  3.80M|    LIBUS_SOCKET_DESCRIPTOR accepted_fd;
  ------------------
  |  |   38|  3.80M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  385|  3.80M|    addr->len = sizeof(addr->mem);
  386|       |
  387|  3.80M|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  388|       |    // Linux, FreeBSD
  389|  3.80M|    accepted_fd = accept4(fd, (struct sockaddr *) addr, &addr->len, SOCK_CLOEXEC | SOCK_NONBLOCK);
  390|       |#else
  391|       |    // Windows, OS X
  392|       |    accepted_fd = accept(fd, (struct sockaddr *) addr, &addr->len);
  393|       |
  394|       |#endif
  395|       |
  396|       |    /* We cannot rely on addr since it is not initialized if failed */
  397|  3.80M|    if (accepted_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  3.80M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (397:9): [True: 2.43M, False: 1.37M]
  ------------------
  398|  2.43M|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  2.43M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  399|  2.43M|    }
  400|       |
  401|  1.37M|    internal_finalize_bsd_addr(addr);
  402|       |
  403|  1.37M|    return bsd_set_nonblocking(apple_no_sigpipe(accepted_fd));
  404|  3.80M|}
bsd_recv:
  406|   295k|int bsd_recv(LIBUS_SOCKET_DESCRIPTOR fd, void *buf, int length, int flags) {
  407|   295k|    return recv(fd, buf, length, flags);
  408|   295k|}
bsd_send:
  436|   282k|int bsd_send(LIBUS_SOCKET_DESCRIPTOR fd, const char *buf, int length, int msg_more) {
  437|       |
  438|       |    // MSG_MORE (Linux), MSG_PARTIAL (Windows), TCP_NOPUSH (BSD)
  439|       |
  440|       |#ifndef MSG_NOSIGNAL
  441|       |#define MSG_NOSIGNAL 0
  442|       |#endif
  443|       |
  444|   282k|#ifdef MSG_MORE
  445|       |
  446|       |    // for Linux we do not want signals
  447|   282k|    return send(fd, buf, length, ((msg_more != 0) * MSG_MORE) | MSG_NOSIGNAL);
  448|       |
  449|       |#else
  450|       |
  451|       |    // use TCP_NOPUSH
  452|       |
  453|       |    return send(fd, buf, length, MSG_NOSIGNAL);
  454|       |
  455|       |#endif
  456|   282k|}
bsd_would_block:
  458|  2.66k|int bsd_would_block() {
  459|       |#ifdef _WIN32
  460|       |    return WSAGetLastError() == WSAEWOULDBLOCK;
  461|       |#else
  462|  2.66k|    return errno == EWOULDBLOCK;// || errno == EAGAIN;
  463|  2.66k|#endif
  464|  2.66k|}
bsd_create_listen_socket:
  468|  6.94k|LIBUS_SOCKET_DESCRIPTOR bsd_create_listen_socket(const char *host, int port, int options) {
  469|  6.94k|    struct addrinfo hints, *result;
  470|  6.94k|    memset(&hints, 0, sizeof(struct addrinfo));
  471|       |
  472|  6.94k|    hints.ai_flags = AI_PASSIVE;
  473|  6.94k|    hints.ai_family = AF_UNSPEC;
  474|  6.94k|    hints.ai_socktype = SOCK_STREAM;
  475|       |
  476|  6.94k|    char port_string[16];
  477|  6.94k|    snprintf(port_string, 16, "%d", port);
  478|       |
  479|  6.94k|    if (getaddrinfo(host, port_string, &hints, &result)) {
  ------------------
  |  Branch (479:9): [True: 0, False: 6.94k]
  ------------------
  480|      0|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      0|#define LIBUS_SOCKET_ERROR -1
  ------------------
  481|      0|    }
  482|       |
  483|  6.94k|    LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   38|  6.94k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
                  LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  484|  6.94k|    struct addrinfo *listenAddr;
  485|  13.8k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (485:39): [True: 6.94k, False: 6.94k]
  |  Branch (485:44): [True: 6.94k, False: 0]
  ------------------
  486|  6.94k|        if (a->ai_family == AF_INET6) {
  ------------------
  |  Branch (486:13): [True: 5.90k, False: 1.03k]
  ------------------
  487|  5.90k|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  488|  5.90k|            listenAddr = a;
  489|  5.90k|        }
  490|  6.94k|    }
  491|       |
  492|  7.97k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (492:39): [True: 6.94k, False: 1.03k]
  |  Branch (492:44): [True: 1.03k, False: 5.90k]
  ------------------
  493|  1.03k|        if (a->ai_family == AF_INET) {
  ------------------
  |  Branch (493:13): [True: 906, False: 127]
  ------------------
  494|    906|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  495|    906|            listenAddr = a;
  496|    906|        }
  497|  1.03k|    }
  498|       |
  499|  6.94k|    if (listenFd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (499:9): [True: 127, False: 6.81k]
  ------------------
  500|    127|        freeaddrinfo(result);
  501|    127|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|    127|#define LIBUS_SOCKET_ERROR -1
  ------------------
  502|    127|    }
  503|       |
  504|  6.81k|    if (port != 0) {
  ------------------
  |  Branch (504:9): [True: 6.81k, False: 0]
  ------------------
  505|       |        /* Otherwise, always enable SO_REUSEPORT and SO_REUSEADDR _unless_ options specify otherwise */
  506|       |#ifdef _WIN32
  507|       |        if (options & LIBUS_LISTEN_EXCLUSIVE_PORT) {
  508|       |            int optval2 = 1;
  509|       |            setsockopt(listenFd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (void *) &optval2, sizeof(optval2));
  510|       |        } else {
  511|       |            int optval3 = 1;
  512|       |            setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval3, sizeof(optval3));
  513|       |        }
  514|       |#else
  515|  6.81k|    #if /*defined(__linux) &&*/ defined(SO_REUSEPORT)
  516|  6.81k|        if (!(options & LIBUS_LISTEN_EXCLUSIVE_PORT)) {
  ------------------
  |  Branch (516:13): [True: 6.81k, False: 0]
  ------------------
  517|  6.81k|            int optval = 1;
  518|  6.81k|            setsockopt(listenFd, SOL_SOCKET, SO_REUSEPORT, (void *) &optval, sizeof(optval));
  519|  6.81k|        }
  520|  6.81k|    #endif
  521|  6.81k|        int enabled = 1;
  522|  6.81k|        setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &enabled, sizeof(enabled));
  523|  6.81k|#endif
  524|       |
  525|  6.81k|    }
  526|       |    
  527|  6.81k|#ifdef IPV6_V6ONLY
  528|  6.81k|    int disabled = 0;
  529|  6.81k|    setsockopt(listenFd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &disabled, sizeof(disabled));
  530|  6.81k|#endif
  531|       |
  532|  6.81k|    if (bind(listenFd, listenAddr->ai_addr, (socklen_t) listenAddr->ai_addrlen) || listen(listenFd, 512)) {
  ------------------
  |  Branch (532:9): [True: 0, False: 6.81k]
  |  Branch (532:84): [True: 12, False: 6.80k]
  ------------------
  533|     12|        bsd_close_socket(listenFd);
  534|     12|        freeaddrinfo(result);
  535|     12|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     12|#define LIBUS_SOCKET_ERROR -1
  ------------------
  536|     12|    }
  537|       |
  538|  6.80k|    freeaddrinfo(result);
  539|  6.80k|    return listenFd;
  540|  6.81k|}
bsd_create_connect_socket:
  712|  6.94k|LIBUS_SOCKET_DESCRIPTOR bsd_create_connect_socket(const char *host, int port, const char *source_host, int options) {
  713|  6.94k|    struct addrinfo hints, *result;
  714|  6.94k|    memset(&hints, 0, sizeof(struct addrinfo));
  715|  6.94k|    hints.ai_family = AF_UNSPEC;
  716|  6.94k|    hints.ai_socktype = SOCK_STREAM;
  717|       |
  718|  6.94k|    char port_string[16];
  719|  6.94k|    snprintf(port_string, 16, "%d", port);
  720|       |
  721|  6.94k|    if (getaddrinfo(host, port_string, &hints, &result) != 0) {
  ------------------
  |  Branch (721:9): [True: 21, False: 6.92k]
  ------------------
  722|     21|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     21|#define LIBUS_SOCKET_ERROR -1
  ------------------
  723|     21|    }
  724|       |
  725|  6.92k|    LIBUS_SOCKET_DESCRIPTOR fd = bsd_create_socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  ------------------
  |  |   38|  6.92k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  726|  6.92k|    if (fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.92k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (726:9): [True: 4.88k, False: 2.03k]
  ------------------
  727|  4.88k|        freeaddrinfo(result);
  728|  4.88k|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  4.88k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  729|  4.88k|    }
  730|       |
  731|  2.03k|    if (source_host) {
  ------------------
  |  Branch (731:9): [True: 2.03k, False: 0]
  ------------------
  732|  2.03k|        struct addrinfo *interface_result;
  733|  2.03k|        if (!getaddrinfo(source_host, NULL, NULL, &interface_result)) {
  ------------------
  |  Branch (733:13): [True: 2.02k, False: 4]
  ------------------
  734|  2.02k|            int ret = bind(fd, interface_result->ai_addr, (socklen_t) interface_result->ai_addrlen);
  735|  2.02k|            freeaddrinfo(interface_result);
  736|  2.02k|            if (ret == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  2.02k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (736:17): [True: 0, False: 2.02k]
  ------------------
  737|      0|                bsd_close_socket(fd);
  738|      0|                freeaddrinfo(result);
  739|      0|                return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      0|#define LIBUS_SOCKET_ERROR -1
  ------------------
  740|      0|            }
  741|  2.02k|        }
  742|  2.03k|    }
  743|       |
  744|  2.03k|    connect(fd, result->ai_addr, (socklen_t) result->ai_addrlen);
  745|  2.03k|    freeaddrinfo(result);
  746|       |
  747|  2.03k|    return fd;
  748|  2.03k|}

default_is_low_prio_handler:
   25|   295k|int default_is_low_prio_handler(struct us_socket_t *s) {
   26|   295k|    return 0;
   27|   295k|}
us_socket_context_timestamp:
   31|  6.94k|unsigned short us_socket_context_timestamp(int ssl, struct us_socket_context_t *context) {
   32|  6.94k|    return context->timestamp;
   33|  6.94k|}
us_listen_socket_close:
   35|  6.80k|void us_listen_socket_close(int ssl, struct us_listen_socket_t *ls) {
   36|       |    /* us_listen_socket_t extends us_socket_t so we close in similar ways */
   37|  6.80k|    if (!us_socket_is_closed(0, &ls->s)) {
  ------------------
  |  Branch (37:9): [True: 6.80k, False: 0]
  ------------------
   38|  6.80k|        us_internal_socket_context_unlink_listen_socket(ls->s.context, ls);
   39|  6.80k|        us_poll_stop((struct us_poll_t *) &ls->s, ls->s.context->loop);
   40|  6.80k|        bsd_close_socket(us_poll_fd((struct us_poll_t *) &ls->s));
   41|       |
   42|       |        /* Link this socket to the close-list and let it be deleted after this iteration */
   43|  6.80k|        ls->s.next = ls->s.context->loop->data.closed_head;
   44|  6.80k|        ls->s.context->loop->data.closed_head = &ls->s;
   45|       |
   46|       |        /* Any socket with prev = context is marked as closed */
   47|  6.80k|        ls->s.prev = (struct us_socket_t *) ls->s.context;
   48|  6.80k|    }
   49|       |
   50|       |    /* We cannot immediately free a listen socket as we can be inside an accept loop */
   51|  6.80k|}
us_internal_socket_context_unlink_listen_socket:
   71|  6.80k|void us_internal_socket_context_unlink_listen_socket(struct us_socket_context_t *context, struct us_listen_socket_t *ls) {
   72|       |    /* We have to properly update the iterator used to sweep sockets for timeouts */
   73|  6.80k|    if (ls == (struct us_listen_socket_t *) context->iterator) {
  ------------------
  |  Branch (73:9): [True: 0, False: 6.80k]
  ------------------
   74|      0|        context->iterator = ls->s.next;
   75|      0|    }
   76|       |
   77|  6.80k|    if (ls->s.prev == ls->s.next) {
  ------------------
  |  Branch (77:9): [True: 6.80k, False: 0]
  ------------------
   78|  6.80k|        context->head_listen_sockets = 0;
   79|  6.80k|    } else {
   80|      0|        if (ls->s.prev) {
  ------------------
  |  Branch (80:13): [True: 0, False: 0]
  ------------------
   81|      0|            ls->s.prev->next = ls->s.next;
   82|      0|        } else {
   83|      0|            context->head_listen_sockets = (struct us_listen_socket_t *) ls->s.next;
   84|      0|        }
   85|      0|        if (ls->s.next) {
  ------------------
  |  Branch (85:13): [True: 0, False: 0]
  ------------------
   86|      0|            ls->s.next->prev = ls->s.prev;
   87|      0|        }
   88|      0|    }
   89|  6.80k|}
us_internal_socket_context_unlink_socket:
   91|  1.41M|void us_internal_socket_context_unlink_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
   92|       |    /* We have to properly update the iterator used to sweep sockets for timeouts */
   93|  1.41M|    if (s == context->iterator) {
  ------------------
  |  Branch (93:9): [True: 9.36k, False: 1.40M]
  ------------------
   94|  9.36k|        context->iterator = s->next;
   95|  9.36k|    }
   96|       |
   97|  1.41M|    if (s->prev == s->next) {
  ------------------
  |  Branch (97:9): [True: 250k, False: 1.16M]
  ------------------
   98|   250k|        context->head_sockets = 0;
   99|  1.16M|    } else {
  100|  1.16M|        if (s->prev) {
  ------------------
  |  Branch (100:13): [True: 651k, False: 512k]
  ------------------
  101|   651k|            s->prev->next = s->next;
  102|   651k|        } else {
  103|   512k|            context->head_sockets = s->next;
  104|   512k|        }
  105|  1.16M|        if (s->next) {
  ------------------
  |  Branch (105:13): [True: 1.14M, False: 19.5k]
  ------------------
  106|  1.14M|            s->next->prev = s->prev;
  107|  1.14M|        }
  108|  1.16M|    }
  109|  1.41M|}
us_internal_socket_context_link_listen_socket:
  112|  6.80k|void us_internal_socket_context_link_listen_socket(struct us_socket_context_t *context, struct us_listen_socket_t *ls) {
  113|  6.80k|    ls->s.context = context;
  114|  6.80k|    ls->s.next = (struct us_socket_t *) context->head_listen_sockets;
  115|  6.80k|    ls->s.prev = 0;
  116|  6.80k|    if (context->head_listen_sockets) {
  ------------------
  |  Branch (116:9): [True: 0, False: 6.80k]
  ------------------
  117|      0|        context->head_listen_sockets->s.prev = &ls->s;
  118|      0|    }
  119|  6.80k|    context->head_listen_sockets = ls;
  120|  6.80k|}
us_internal_socket_context_link_socket:
  123|  1.41M|void us_internal_socket_context_link_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
  124|  1.41M|    s->context = context;
  125|  1.41M|    s->next = context->head_sockets;
  126|  1.41M|    s->prev = 0;
  127|  1.41M|    if (context->head_sockets) {
  ------------------
  |  Branch (127:9): [True: 1.16M, False: 250k]
  ------------------
  128|  1.16M|        context->head_sockets->prev = s;
  129|  1.16M|    }
  130|  1.41M|    context->head_sockets = s;
  131|  1.41M|}
us_socket_context_loop:
  133|  2.73M|struct us_loop_t *us_socket_context_loop(int ssl, struct us_socket_context_t *context) {
  134|  2.73M|    return context->loop;
  135|  2.73M|}
us_socket_context_find_server_name_userdata:
  140|  6.94k|void *us_socket_context_find_server_name_userdata(int ssl, struct us_socket_context_t *context, const char *hostname_pattern) {
  141|       |#ifndef LIBUS_NO_SSL
  142|       |    if (ssl) {
  143|       |        return us_internal_ssl_socket_context_find_server_name_userdata((struct us_internal_ssl_socket_context_t *) context, hostname_pattern);
  144|       |    }
  145|       |#endif
  146|  6.94k|    return NULL;
  147|  6.94k|}
us_socket_context_remove_server_name:
  169|  6.94k|void us_socket_context_remove_server_name(int ssl, struct us_socket_context_t *context, const char *hostname_pattern) {
  170|       |#ifndef LIBUS_NO_SSL
  171|       |    if (ssl) {
  172|       |        us_internal_ssl_socket_context_remove_server_name((struct us_internal_ssl_socket_context_t *) context, hostname_pattern);
  173|       |    }
  174|       |#endif
  175|  6.94k|}
us_socket_context_on_server_name:
  182|  6.94k|void us_socket_context_on_server_name(int ssl, struct us_socket_context_t *context, void (*cb)(struct us_socket_context_t *, const char *hostname)) {
  183|       |#ifndef LIBUS_NO_SSL
  184|       |    if (ssl) {
  185|       |        us_internal_ssl_socket_context_on_server_name((struct us_internal_ssl_socket_context_t *) context, (void (*)(struct us_internal_ssl_socket_context_t *, const char *hostname)) cb);
  186|       |    }
  187|       |#endif
  188|  6.94k|}
us_socket_context_get_native_handle:
  192|  6.94k|void *us_socket_context_get_native_handle(int ssl, struct us_socket_context_t *context) {
  193|       |#ifndef LIBUS_NO_SSL
  194|       |    if (ssl) {
  195|       |        return us_internal_ssl_socket_context_get_native_handle((struct us_internal_ssl_socket_context_t *) context);
  196|       |    }
  197|       |#endif
  198|       |
  199|       |    /* There is no native handle for a non-SSL socket context */
  200|  6.94k|    return 0;
  201|  6.94k|}
us_create_socket_context:
  204|  27.7k|struct us_socket_context_t *us_create_socket_context(int ssl, struct us_loop_t *loop, int context_ext_size, struct us_socket_context_options_t options) {
  205|       |#ifndef LIBUS_NO_SSL
  206|       |    if (ssl) {
  207|       |        /* This function will call us, again, with SSL = false and a bigger ext_size */
  208|       |        return (struct us_socket_context_t *) us_internal_create_ssl_socket_context(loop, context_ext_size, options);
  209|       |    }
  210|       |#endif
  211|       |
  212|       |    /* This path is taken once either way - always BEFORE whatever SSL may do LATER.
  213|       |     * context_ext_size will however be modified larger in case of SSL, to hold SSL extensions */
  214|       |
  215|  27.7k|    struct us_socket_context_t *context = malloc(sizeof(struct us_socket_context_t) + context_ext_size);
  216|  27.7k|    context->loop = loop;
  217|  27.7k|    context->head_sockets = 0;
  218|  27.7k|    context->head_listen_sockets = 0;
  219|  27.7k|    context->iterator = 0;
  220|  27.7k|    context->next = 0;
  221|  27.7k|    context->is_low_prio = default_is_low_prio_handler;
  222|       |
  223|       |    /* Begin at 0 */
  224|  27.7k|    context->timestamp = 0;
  225|  27.7k|    context->long_timestamp = 0;
  226|  27.7k|    context->global_tick = 0;
  227|       |
  228|       |    /* Some new events must be set to null for backwards compatibility */
  229|  27.7k|    context->on_pre_open = 0;
  230|       |
  231|  27.7k|    us_internal_loop_link(loop, context);
  232|       |
  233|       |    /* If we are called from within SSL code, SSL code will make further changes to us */
  234|  27.7k|    return context;
  235|  27.7k|}
us_socket_context_free:
  237|  27.7k|void us_socket_context_free(int ssl, struct us_socket_context_t *context) {
  238|       |#ifndef LIBUS_NO_SSL
  239|       |    if (ssl) {
  240|       |        /* This function will call us again with SSL=false */
  241|       |        us_internal_ssl_socket_context_free((struct us_internal_ssl_socket_context_t *) context);
  242|       |        return;
  243|       |    }
  244|       |#endif
  245|       |
  246|       |    /* This path is taken once either way - always AFTER whatever SSL may do BEFORE.
  247|       |     * This is the opposite order compared to when creating the context - SSL code is cleaning up before non-SSL */
  248|       |
  249|  27.7k|    us_internal_loop_unlink(context->loop, context);
  250|  27.7k|    free(context);
  251|  27.7k|}
us_socket_context_listen:
  253|  6.94k|struct us_listen_socket_t *us_socket_context_listen(int ssl, struct us_socket_context_t *context, const char *host, int port, int options, int socket_ext_size) {
  254|       |#ifndef LIBUS_NO_SSL
  255|       |    if (ssl) {
  256|       |        return us_internal_ssl_socket_context_listen((struct us_internal_ssl_socket_context_t *) context, host, port, options, socket_ext_size);
  257|       |    }
  258|       |#endif
  259|       |
  260|  6.94k|    LIBUS_SOCKET_DESCRIPTOR listen_socket_fd = bsd_create_listen_socket(host, port, options);
  ------------------
  |  |   38|  6.94k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  261|       |
  262|  6.94k|    if (listen_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (262:9): [True: 139, False: 6.80k]
  ------------------
  263|    139|        return 0;
  264|    139|    }
  265|       |
  266|  6.80k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_listen_socket_t) - sizeof(struct us_poll_t));
  267|  6.80k|    us_poll_init(p, listen_socket_fd, POLL_TYPE_SEMI_SOCKET);
  268|  6.80k|    us_poll_start(p, context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  6.80k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  269|       |
  270|  6.80k|    struct us_listen_socket_t *ls = (struct us_listen_socket_t *) p;
  271|       |
  272|  6.80k|    ls->s.context = context;
  273|  6.80k|    ls->s.timeout = 255;
  274|  6.80k|    ls->s.long_timeout = 255;
  275|  6.80k|    ls->s.low_prio_state = 0;
  276|  6.80k|    ls->s.next = 0;
  277|  6.80k|    us_internal_socket_context_link_listen_socket(context, ls);
  278|       |
  279|  6.80k|    ls->socket_ext_size = socket_ext_size;
  280|       |
  281|  6.80k|    return ls;
  282|  6.94k|}
us_socket_context_connect:
  315|  6.94k|struct us_socket_t *us_socket_context_connect(int ssl, struct us_socket_context_t *context, const char *host, int port, const char *source_host, int options, int socket_ext_size) {
  316|       |#ifndef LIBUS_NO_SSL
  317|       |    if (ssl) {
  318|       |        return (struct us_socket_t *) us_internal_ssl_socket_context_connect((struct us_internal_ssl_socket_context_t *) context, host, port, source_host, options, socket_ext_size);
  319|       |    }
  320|       |#endif
  321|       |
  322|  6.94k|    LIBUS_SOCKET_DESCRIPTOR connect_socket_fd = bsd_create_connect_socket(host, port, source_host, options);
  ------------------
  |  |   38|  6.94k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  323|  6.94k|    if (connect_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.94k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (323:9): [True: 4.90k, False: 2.03k]
  ------------------
  324|  4.90k|        return 0;
  325|  4.90k|    }
  326|       |
  327|       |    /* Connect sockets are semi-sockets just like listen sockets */
  328|  2.03k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_socket_t) - sizeof(struct us_poll_t) + socket_ext_size);
  329|  2.03k|    us_poll_init(p, connect_socket_fd, POLL_TYPE_SEMI_SOCKET);
  330|  2.03k|    us_poll_start(p, context->loop, LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  2.03k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  331|       |
  332|  2.03k|    struct us_socket_t *connect_socket = (struct us_socket_t *) p;
  333|       |
  334|       |    /* Link it into context so that timeout fires properly */
  335|  2.03k|    connect_socket->context = context;
  336|  2.03k|    connect_socket->timeout = 255;
  337|  2.03k|    connect_socket->long_timeout = 255;
  338|  2.03k|    connect_socket->low_prio_state = 0;
  339|  2.03k|    us_internal_socket_context_link_socket(context, connect_socket);
  340|       |
  341|  2.03k|    return connect_socket;
  342|  6.94k|}
us_create_child_socket_context:
  373|  13.8k|struct us_socket_context_t *us_create_child_socket_context(int ssl, struct us_socket_context_t *context, int context_ext_size) {
  374|       |#ifndef LIBUS_NO_SSL
  375|       |    if (ssl) {
  376|       |        return (struct us_socket_context_t *) us_internal_create_child_ssl_socket_context((struct us_internal_ssl_socket_context_t *) context, context_ext_size);
  377|       |    }
  378|       |#endif
  379|       |
  380|       |    /* For TCP we simply create a new context as nothing is shared */
  381|  13.8k|    struct us_socket_context_options_t options = {0};
  382|  13.8k|    return us_create_socket_context(ssl, context->loop, context_ext_size, options);
  383|  13.8k|}
us_socket_context_adopt_socket:
  386|  40.4k|struct us_socket_t *us_socket_context_adopt_socket(int ssl, struct us_socket_context_t *context, struct us_socket_t *s, int ext_size) {
  387|       |#ifndef LIBUS_NO_SSL
  388|       |    if (ssl) {
  389|       |        return (struct us_socket_t *) us_internal_ssl_socket_context_adopt_socket((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t *) s, ext_size);
  390|       |    }
  391|       |#endif
  392|       |
  393|       |    /* Cannot adopt a closed socket */
  394|  40.4k|    if (us_socket_is_closed(ssl, s)) {
  ------------------
  |  Branch (394:9): [True: 0, False: 40.4k]
  ------------------
  395|      0|        return s;
  396|      0|    }
  397|       |
  398|  40.4k|    if (s->low_prio_state != 1) {
  ------------------
  |  Branch (398:9): [True: 40.4k, False: 0]
  ------------------
  399|       |        /* This properly updates the iterator if in on_timeout */
  400|  40.4k|        us_internal_socket_context_unlink_socket(s->context, s);
  401|  40.4k|    }
  402|       |
  403|  40.4k|    struct us_socket_t *new_s = (struct us_socket_t *) us_poll_resize(&s->p, s->context->loop, sizeof(struct us_socket_t) + ext_size);
  404|  40.4k|    new_s->timeout = 255;
  405|  40.4k|    new_s->long_timeout = 255;
  406|       |
  407|  40.4k|    if (new_s->low_prio_state == 1) {
  ------------------
  |  Branch (407:9): [True: 0, False: 40.4k]
  ------------------
  408|       |        /* update pointers in low-priority queue */
  409|      0|        if (!new_s->prev) new_s->context->loop->data.low_prio_head = new_s;
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|      0|        else new_s->prev->next = new_s;
  411|       |
  412|      0|        if (new_s->next) new_s->next->prev = new_s;
  ------------------
  |  Branch (412:13): [True: 0, False: 0]
  ------------------
  413|  40.4k|    } else {
  414|  40.4k|        us_internal_socket_context_link_socket(context, new_s);
  415|  40.4k|    }
  416|       |
  417|  40.4k|    return new_s;
  418|  40.4k|}
us_socket_context_on_open:
  426|  13.8k|void us_socket_context_on_open(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_open)(struct us_socket_t *s, int is_client, char *ip, int ip_length)) {
  427|       |#ifndef LIBUS_NO_SSL
  428|       |    if (ssl) {
  429|       |        us_internal_ssl_socket_context_on_open((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *, int,  char *, int)) on_open);
  430|       |        return;
  431|       |    }
  432|       |#endif
  433|       |
  434|  13.8k|    context->on_open = on_open;
  435|  13.8k|}
us_socket_context_on_close:
  437|  27.7k|void us_socket_context_on_close(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_close)(struct us_socket_t *s, int code, void *reason)) {
  438|       |#ifndef LIBUS_NO_SSL
  439|       |    if (ssl) {
  440|       |        us_internal_ssl_socket_context_on_close((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *, int code, void *reason)) on_close);
  441|       |        return;
  442|       |    }
  443|       |#endif
  444|       |
  445|  27.7k|    context->on_close = on_close;
  446|  27.7k|}
us_socket_context_on_data:
  448|  27.7k|void us_socket_context_on_data(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_data)(struct us_socket_t *s, char *data, int length)) {
  449|       |#ifndef LIBUS_NO_SSL
  450|       |    if (ssl) {
  451|       |        us_internal_ssl_socket_context_on_data((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *, char *, int)) on_data);
  452|       |        return;
  453|       |    }
  454|       |#endif
  455|       |
  456|  27.7k|    context->on_data = on_data;
  457|  27.7k|}
us_socket_context_on_writable:
  459|  27.7k|void us_socket_context_on_writable(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_writable)(struct us_socket_t *s)) {
  460|       |#ifndef LIBUS_NO_SSL
  461|       |    if (ssl) {
  462|       |        us_internal_ssl_socket_context_on_writable((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *)) on_writable);
  463|       |        return;
  464|       |    }
  465|       |#endif
  466|       |
  467|  27.7k|    context->on_writable = on_writable;
  468|  27.7k|}
us_socket_context_on_long_timeout:
  470|  13.8k|void us_socket_context_on_long_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_long_timeout)(struct us_socket_t *)) {
  471|       |#ifndef LIBUS_NO_SSL
  472|       |    if (ssl) {
  473|       |        us_internal_ssl_socket_context_on_long_timeout((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *)) on_long_timeout);
  474|       |        return;
  475|       |    }
  476|       |#endif
  477|       |
  478|  13.8k|    context->on_socket_long_timeout = on_long_timeout;
  479|  13.8k|}
us_socket_context_on_timeout:
  481|  20.8k|void us_socket_context_on_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_timeout)(struct us_socket_t *)) {
  482|       |#ifndef LIBUS_NO_SSL
  483|       |    if (ssl) {
  484|       |        us_internal_ssl_socket_context_on_timeout((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *)) on_timeout);
  485|       |        return;
  486|       |    }
  487|       |#endif
  488|       |
  489|  20.8k|    context->on_socket_timeout = on_timeout;
  490|  20.8k|}
us_socket_context_on_end:
  492|  27.7k|void us_socket_context_on_end(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_end)(struct us_socket_t *)) {
  493|       |#ifndef LIBUS_NO_SSL
  494|       |    if (ssl) {
  495|       |        us_internal_ssl_socket_context_on_end((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *)) on_end);
  496|       |        return;
  497|       |    }
  498|       |#endif
  499|       |
  500|  27.7k|    context->on_end = on_end;
  501|  27.7k|}
us_socket_context_on_connect_error:
  503|  6.94k|void us_socket_context_on_connect_error(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_connect_error)(struct us_socket_t *s, int code)) {
  504|       |#ifndef LIBUS_NO_SSL
  505|       |    if (ssl) {
  506|       |        us_internal_ssl_socket_context_on_connect_error((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *, int)) on_connect_error);
  507|       |        return;
  508|       |    }
  509|       |#endif
  510|       |    
  511|  6.94k|    context->on_connect_error = on_connect_error;
  512|  6.94k|}
us_socket_context_ext:
  514|  3.61M|void *us_socket_context_ext(int ssl, struct us_socket_context_t *context) {
  515|       |#ifndef LIBUS_NO_SSL
  516|       |    if (ssl) {
  517|       |        return us_internal_ssl_socket_context_ext((struct us_internal_ssl_socket_context_t *) context);
  518|       |    }
  519|       |#endif
  520|       |
  521|  3.61M|    return context + 1;
  522|  3.61M|}

us_loop_free:
   36|  6.94k|void us_loop_free(struct us_loop_t *loop) {
   37|  6.94k|    us_internal_loop_data_free(loop);
   38|  6.94k|    close(loop->fd);
   39|  6.94k|    free(loop);
   40|  6.94k|}
us_create_poll:
   43|  1.40M|struct us_poll_t *us_create_poll(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
   44|  1.40M|    if (!fallthrough) {
  ------------------
  |  Branch (44:9): [True: 1.38M, False: 20.8k]
  ------------------
   45|  1.38M|        loop->num_polls++;
   46|  1.38M|    }
   47|  1.40M|    return malloc(sizeof(struct us_poll_t) + ext_size);
   48|  1.40M|}
us_poll_free:
   51|  1.40M|void us_poll_free(struct us_poll_t *p, struct us_loop_t *loop) {
   52|  1.40M|    loop->num_polls--;
   53|  1.40M|    free(p);
   54|  1.40M|}
us_poll_ext:
   56|  39.0k|void *us_poll_ext(struct us_poll_t *p) {
   57|  39.0k|    return p + 1;
   58|  39.0k|}
us_poll_init:
   61|  1.40M|void us_poll_init(struct us_poll_t *p, LIBUS_SOCKET_DESCRIPTOR fd, int poll_type) {
   62|  1.40M|    p->state.fd = fd;
   63|  1.40M|    p->state.poll_type = poll_type;
   64|  1.40M|}
us_poll_events:
   66|  16.5M|int us_poll_events(struct us_poll_t *p) {
   67|  16.5M|    return ((p->state.poll_type & POLL_TYPE_POLLING_IN) ? LIBUS_SOCKET_READABLE : 0) | ((p->state.poll_type & POLL_TYPE_POLLING_OUT) ? LIBUS_SOCKET_WRITABLE : 0);
  ------------------
  |  |   27|  16.5M|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                  return ((p->state.poll_type & POLL_TYPE_POLLING_IN) ? LIBUS_SOCKET_READABLE : 0) | ((p->state.poll_type & POLL_TYPE_POLLING_OUT) ? LIBUS_SOCKET_WRITABLE : 0);
  ------------------
  |  |   28|  16.5M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (67:13): [True: 16.4M, False: 34.1k]
  |  Branch (67:89): [True: 506k, False: 16.0M]
  ------------------
   68|  16.5M|}
us_poll_fd:
   70|  14.1M|LIBUS_SOCKET_DESCRIPTOR us_poll_fd(struct us_poll_t *p) {
   71|  14.1M|    return p->state.fd;
   72|  14.1M|}
us_internal_poll_type:
   75|  14.4M|int us_internal_poll_type(struct us_poll_t *p) {
   76|  14.4M|    return p->state.poll_type & 3;
   77|  14.4M|}
us_internal_poll_set_type:
   80|  91.3k|void us_internal_poll_set_type(struct us_poll_t *p, int poll_type) {
   81|  91.3k|    p->state.poll_type = poll_type | (p->state.poll_type & 12);
   82|  91.3k|}
us_timer_ext:
   85|  2.71M|void *us_timer_ext(struct us_timer_t *timer) {
   86|  2.71M|    return ((struct us_internal_callback_t *) timer) + 1;
   87|  2.71M|}
us_create_loop:
   96|  6.94k|struct us_loop_t *us_create_loop(void *hint, void (*wakeup_cb)(struct us_loop_t *loop), void (*pre_cb)(struct us_loop_t *loop), void (*post_cb)(struct us_loop_t *loop), unsigned int ext_size) {
   97|  6.94k|    struct us_loop_t *loop = (struct us_loop_t *) malloc(sizeof(struct us_loop_t) + ext_size);
   98|  6.94k|    loop->num_polls = 0;
   99|       |    /* These could be accessed if we close a poll before starting the loop */
  100|  6.94k|    loop->num_ready_polls = 0;
  101|  6.94k|    loop->current_ready_poll = 0;
  102|       |
  103|  6.94k|#ifdef LIBUS_USE_EPOLL
  104|  6.94k|    loop->fd = epoll_create1(EPOLL_CLOEXEC);
  105|       |#else
  106|       |    loop->fd = kqueue();
  107|       |#endif
  108|       |
  109|  6.94k|    us_internal_loop_data_init(loop, wakeup_cb, pre_cb, post_cb);
  110|  6.94k|    return loop;
  111|  6.94k|}
us_loop_run:
  113|  6.94k|void us_loop_run(struct us_loop_t *loop) {
  114|  6.94k|    us_loop_integrate(loop);
  115|       |
  116|       |    /* While we have non-fallthrough polls we shouldn't fall through */
  117|  3.37M|    while (loop->num_polls) {
  ------------------
  |  Branch (117:12): [True: 3.36M, False: 6.94k]
  ------------------
  118|       |        /* Emit pre callback */
  119|  3.36M|        us_internal_loop_pre(loop);
  120|       |
  121|       |        /* Fetch ready polls */
  122|  3.36M|#ifdef LIBUS_USE_EPOLL
  123|  3.36M|        loop->num_ready_polls = epoll_wait(loop->fd, loop->ready_polls, 1024, -1);
  124|       |#else
  125|       |        loop->num_ready_polls = kevent(loop->fd, NULL, 0, loop->ready_polls, 1024, NULL);
  126|       |#endif
  127|       |
  128|       |        /* Iterate ready polls, dispatching them by type */
  129|  15.4M|        for (loop->current_ready_poll = 0; loop->current_ready_poll < loop->num_ready_polls; loop->current_ready_poll++) {
  ------------------
  |  Branch (129:44): [True: 12.1M, False: 3.36M]
  ------------------
  130|  12.1M|            struct us_poll_t *poll = GET_READY_POLL(loop, loop->current_ready_poll);
  ------------------
  |  |   28|  12.1M|#define GET_READY_POLL(loop, index) (struct us_poll_t *) loop->ready_polls[index].data.ptr
  ------------------
  131|       |            /* Any ready poll marked with nullptr will be ignored */
  132|  12.1M|            if (poll) {
  ------------------
  |  Branch (132:17): [True: 12.1M, False: 0]
  ------------------
  133|  12.1M|#ifdef LIBUS_USE_EPOLL
  134|  12.1M|                int events = loop->ready_polls[loop->current_ready_poll].events;
  135|  12.1M|                int error = loop->ready_polls[loop->current_ready_poll].events & (EPOLLERR | EPOLLHUP);
  136|       |#else
  137|       |                /* EVFILT_READ, EVFILT_TIME, EVFILT_USER are all mapped to LIBUS_SOCKET_READABLE */
  138|       |                int events = LIBUS_SOCKET_READABLE;
  139|       |                if (loop->ready_polls[loop->current_ready_poll].filter == EVFILT_WRITE) {
  140|       |                    events = LIBUS_SOCKET_WRITABLE;
  141|       |                }
  142|       |                int error = loop->ready_polls[loop->current_ready_poll].flags & (EV_ERROR | EV_EOF);
  143|       |#endif
  144|       |                /* Always filter all polls by what they actually poll for (callback polls always poll for readable) */
  145|  12.1M|                events &= us_poll_events(poll);
  146|  12.1M|                if (events || error) {
  ------------------
  |  Branch (146:21): [True: 8.34M, False: 3.79M]
  |  Branch (146:31): [True: 3.79M, False: 0]
  ------------------
  147|  12.1M|                    us_internal_dispatch_ready_poll(poll, error, events);
  148|  12.1M|                }
  149|  12.1M|            }
  150|  12.1M|        }
  151|       |        /* Emit post callback */
  152|  3.36M|        us_internal_loop_post(loop);
  153|  3.36M|    }
  154|  6.94k|}
us_internal_loop_update_pending_ready_polls:
  156|  1.40M|void us_internal_loop_update_pending_ready_polls(struct us_loop_t *loop, struct us_poll_t *old_poll, struct us_poll_t *new_poll, int old_events, int new_events) {
  157|  1.40M|#ifdef LIBUS_USE_EPOLL
  158|       |    /* Epoll only has one ready poll per poll */
  159|  1.40M|    int num_entries_possibly_remaining = 1;
  160|       |#else
  161|       |    /* Ready polls may contain same poll twice under kqueue, as one poll may hold two filters */
  162|       |    int num_entries_possibly_remaining = 2;//((old_events & LIBUS_SOCKET_READABLE) ? 1 : 0) + ((old_events & LIBUS_SOCKET_WRITABLE) ? 1 : 0);
  163|       |#endif
  164|       |
  165|       |    /* Todo: for kqueue if we track things in us_change_poll it is possible to have a fast path with no seeking in cases of:
  166|       |    * current poll being us AND we only poll for one thing */
  167|       |
  168|  2.79M|    for (int i = loop->current_ready_poll; i < loop->num_ready_polls && num_entries_possibly_remaining; i++) {
  ------------------
  |  Branch (168:44): [True: 2.73M, False: 58.5k]
  |  Branch (168:73): [True: 1.39M, False: 1.34M]
  ------------------
  169|  1.39M|        if (GET_READY_POLL(loop, i) == old_poll) {
  ------------------
  |  |   28|  1.39M|#define GET_READY_POLL(loop, index) (struct us_poll_t *) loop->ready_polls[index].data.ptr
  ------------------
  |  Branch (169:13): [True: 1.36M, False: 27.2k]
  ------------------
  170|       |
  171|       |            // if new events does not contain the ready events of this poll then remove (no we filter that out later on)
  172|  1.36M|            SET_READY_POLL(loop, i, new_poll);
  ------------------
  |  |   29|  1.36M|#define SET_READY_POLL(loop, index, poll) loop->ready_polls[index].data.ptr = poll
  ------------------
  173|       |
  174|  1.36M|            num_entries_possibly_remaining--;
  175|  1.36M|        }
  176|  1.39M|    }
  177|  1.40M|}
us_poll_resize:
  205|  40.4k|struct us_poll_t *us_poll_resize(struct us_poll_t *p, struct us_loop_t *loop, unsigned int ext_size) {
  206|  40.4k|    int events = us_poll_events(p);
  207|       |
  208|  40.4k|    struct us_poll_t *new_p = realloc(p, sizeof(struct us_poll_t) + ext_size);
  209|  40.4k|    if (p != new_p && events) {
  ------------------
  |  Branch (209:9): [True: 0, False: 40.4k]
  |  Branch (209:23): [True: 0, False: 0]
  ------------------
  210|      0|#ifdef LIBUS_USE_EPOLL
  211|       |        /* Hack: forcefully update poll by stripping away already set events */
  212|      0|        new_p->state.poll_type = us_internal_poll_type(new_p);
  213|      0|        us_poll_change(new_p, loop, events);
  214|       |#else
  215|       |        /* Forcefully update poll by resetting them with new_p as user data */
  216|       |        kqueue_change(loop->fd, new_p->state.fd, 0, events, new_p);
  217|       |#endif
  218|       |
  219|       |        /* This is needed for epoll also (us_change_poll doesn't update the old poll) */
  220|      0|        us_internal_loop_update_pending_ready_polls(loop, p, new_p, events, events);
  221|      0|    }
  222|       |
  223|  40.4k|    return new_p;
  224|  40.4k|}
us_poll_start:
  226|  1.40M|void us_poll_start(struct us_poll_t *p, struct us_loop_t *loop, int events) {
  227|  1.40M|    p->state.poll_type = us_internal_poll_type(p) | ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0);
  ------------------
  |  |   27|  1.40M|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                  p->state.poll_type = us_internal_poll_type(p) | ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0);
  ------------------
  |  |   28|  1.40M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (227:54): [True: 1.40M, False: 2.03k]
  |  Branch (227:118): [True: 2.03k, False: 1.40M]
  ------------------
  228|       |
  229|  1.40M|#ifdef LIBUS_USE_EPOLL
  230|  1.40M|    struct epoll_event event;
  231|  1.40M|    event.events = events;
  232|  1.40M|    event.data.ptr = p;
  233|  1.40M|    epoll_ctl(loop->fd, EPOLL_CTL_ADD, p->state.fd, &event);
  234|       |#else
  235|       |    kqueue_change(loop->fd, p->state.fd, 0, events, p);
  236|       |#endif
  237|  1.40M|}
us_poll_change:
  239|   390k|void us_poll_change(struct us_poll_t *p, struct us_loop_t *loop, int events) {
  240|   390k|    int old_events = us_poll_events(p);
  241|   390k|    if (old_events != events) {
  ------------------
  |  Branch (241:9): [True: 247k, False: 142k]
  ------------------
  242|       |
  243|   247k|        p->state.poll_type = us_internal_poll_type(p) | ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0);
  ------------------
  |  |   27|   247k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                      p->state.poll_type = us_internal_poll_type(p) | ((events & LIBUS_SOCKET_READABLE) ? POLL_TYPE_POLLING_IN : 0) | ((events & LIBUS_SOCKET_WRITABLE) ? POLL_TYPE_POLLING_OUT : 0);
  ------------------
  |  |   28|   247k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (243:58): [True: 219k, False: 28.1k]
  |  Branch (243:122): [True: 132k, False: 115k]
  ------------------
  244|       |
  245|   247k|#ifdef LIBUS_USE_EPOLL
  246|   247k|        struct epoll_event event;
  247|   247k|        event.events = events;
  248|   247k|        event.data.ptr = p;
  249|   247k|        epoll_ctl(loop->fd, EPOLL_CTL_MOD, p->state.fd, &event);
  250|       |#else
  251|       |        kqueue_change(loop->fd, p->state.fd, old_events, events, p);
  252|       |#endif
  253|       |        /* Set all removed events to null-polls in pending ready poll list */
  254|       |        //us_internal_loop_update_pending_ready_polls(loop, p, p, old_events, events);
  255|   247k|    }
  256|   390k|}
us_poll_stop:
  258|  1.40M|void us_poll_stop(struct us_poll_t *p, struct us_loop_t *loop) {
  259|  1.40M|    int old_events = us_poll_events(p);
  260|  1.40M|    int new_events = 0;
  261|  1.40M|#ifdef LIBUS_USE_EPOLL
  262|  1.40M|    struct epoll_event event;
  263|  1.40M|    epoll_ctl(loop->fd, EPOLL_CTL_DEL, p->state.fd, &event);
  264|       |#else
  265|       |    if (old_events) {
  266|       |        kqueue_change(loop->fd, p->state.fd, old_events, new_events, NULL);
  267|       |    }
  268|       |#endif
  269|       |
  270|       |    /* Disable any instance of us in the pending ready poll list */
  271|  1.40M|    us_internal_loop_update_pending_ready_polls(loop, p, 0, old_events, new_events);
  272|  1.40M|}
us_internal_accept_poll_event:
  274|  8.13M|unsigned int us_internal_accept_poll_event(struct us_poll_t *p) {
  275|  8.13M|#ifdef LIBUS_USE_EPOLL
  276|  8.13M|    int fd = us_poll_fd(p);
  277|  8.13M|    uint64_t buf;
  278|  8.13M|    int read_length = read(fd, &buf, 8);
  279|  8.13M|    (void)read_length;
  280|  8.13M|    return buf;
  281|       |#else
  282|       |    /* Kqueue has no underlying FD for timers or user events */
  283|       |    return 0;
  284|       |#endif
  285|  8.13M|}
us_create_timer:
  289|  13.8k|struct us_timer_t *us_create_timer(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
  290|  13.8k|    struct us_poll_t *p = us_create_poll(loop, fallthrough, sizeof(struct us_internal_callback_t) - sizeof(struct us_poll_t) + ext_size);
  291|  13.8k|    int timerfd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC);
  292|  13.8k|    if (timerfd == -1) {
  ------------------
  |  Branch (292:9): [True: 0, False: 13.8k]
  ------------------
  293|      0|      return NULL;
  294|      0|    }
  295|  13.8k|    us_poll_init(p, timerfd, POLL_TYPE_CALLBACK);
  296|       |
  297|  13.8k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  298|  13.8k|    cb->loop = loop;
  299|  13.8k|    cb->cb_expects_the_loop = 0;
  300|  13.8k|    cb->leave_poll_ready = 0;
  301|       |
  302|  13.8k|    return (struct us_timer_t *) cb;
  303|  13.8k|}
us_timer_close:
  325|  13.8k|void us_timer_close(struct us_timer_t *timer) {
  326|  13.8k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) timer;
  327|       |
  328|  13.8k|    us_poll_stop(&cb->p, cb->loop);
  329|  13.8k|    close(us_poll_fd(&cb->p));
  330|       |
  331|       |    /* (regular) sockets are the only polls which are not freed immediately */
  332|  13.8k|    us_poll_free((struct us_poll_t *) timer, cb->loop);
  333|  13.8k|}
us_timer_set:
  335|  13.8k|void us_timer_set(struct us_timer_t *t, void (*cb)(struct us_timer_t *t), int ms, int repeat_ms) {
  336|  13.8k|    struct us_internal_callback_t *internal_cb = (struct us_internal_callback_t *) t;
  337|       |
  338|  13.8k|    internal_cb->cb = (void (*)(struct us_internal_callback_t *)) cb;
  339|       |
  340|  13.8k|    struct itimerspec timer_spec = {
  341|  13.8k|        {repeat_ms / 1000, (long) (repeat_ms % 1000) * (long) 1000000},
  342|  13.8k|        {ms / 1000, (long) (ms % 1000) * (long) 1000000}
  343|  13.8k|    };
  344|       |
  345|  13.8k|    timerfd_settime(us_poll_fd((struct us_poll_t *) t), 0, &timer_spec, NULL);
  346|  13.8k|    us_poll_start((struct us_poll_t *) t, internal_cb->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  13.8k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  347|  13.8k|}
us_internal_create_async:
  374|  6.94k|struct us_internal_async *us_internal_create_async(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
  375|  6.94k|    struct us_poll_t *p = us_create_poll(loop, fallthrough, sizeof(struct us_internal_callback_t) - sizeof(struct us_poll_t) + ext_size);
  376|  6.94k|    us_poll_init(p, eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC), POLL_TYPE_CALLBACK);
  377|       |
  378|  6.94k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  379|  6.94k|    cb->loop = loop;
  380|  6.94k|    cb->cb_expects_the_loop = 1;
  381|  6.94k|    cb->leave_poll_ready = 0;
  382|       |
  383|  6.94k|    return (struct us_internal_async *) cb;
  384|  6.94k|}
us_internal_async_close:
  387|  6.94k|void us_internal_async_close(struct us_internal_async *a) {
  388|  6.94k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) a;
  389|       |
  390|  6.94k|    us_poll_stop(&cb->p, cb->loop);
  391|  6.94k|    close(us_poll_fd(&cb->p));
  392|       |
  393|       |    /* (regular) sockets are the only polls which are not freed immediately */
  394|  6.94k|    us_poll_free((struct us_poll_t *) a, cb->loop);
  395|  6.94k|}
us_internal_async_set:
  397|  6.94k|void us_internal_async_set(struct us_internal_async *a, void (*cb)(struct us_internal_async *)) {
  398|  6.94k|    struct us_internal_callback_t *internal_cb = (struct us_internal_callback_t *) a;
  399|       |
  400|  6.94k|    internal_cb->cb = (void (*)(struct us_internal_callback_t *)) cb;
  401|       |
  402|  6.94k|    us_poll_start((struct us_poll_t *) a, internal_cb->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  6.94k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  403|  6.94k|}
us_internal_async_wakeup:
  405|  9.97k|void us_internal_async_wakeup(struct us_internal_async *a) {
  406|  9.97k|    uint64_t one = 1;
  407|  9.97k|    int written = write(us_poll_fd((struct us_poll_t *) a), &one, 8);
  408|  9.97k|    (void)written;
  409|  9.97k|}

us_internal_loop_data_init:
   26|  6.94k|    void (*pre_cb)(struct us_loop_t *loop), void (*post_cb)(struct us_loop_t *loop)) {
   27|  6.94k|    loop->data.sweep_timer = us_create_timer(loop, 1, 0);
   28|  6.94k|    loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   22|  6.94k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
                  loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   26|  6.94k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
   29|  6.94k|    loop->data.ssl_data = 0;
   30|  6.94k|    loop->data.head = 0;
   31|  6.94k|    loop->data.iterator = 0;
   32|  6.94k|    loop->data.closed_head = 0;
   33|  6.94k|    loop->data.low_prio_head = 0;
   34|  6.94k|    loop->data.low_prio_budget = 0;
   35|       |
   36|  6.94k|    loop->data.pre_cb = pre_cb;
   37|  6.94k|    loop->data.post_cb = post_cb;
   38|  6.94k|    loop->data.iteration_nr = 0;
   39|       |
   40|  6.94k|    loop->data.wakeup_async = us_internal_create_async(loop, 1, 0);
   41|  6.94k|    us_internal_async_set(loop->data.wakeup_async, (void (*)(struct us_internal_async *)) wakeup_cb);
   42|  6.94k|}
us_internal_loop_data_free:
   44|  6.94k|void us_internal_loop_data_free(struct us_loop_t *loop) {
   45|       |#ifndef LIBUS_NO_SSL
   46|       |    us_internal_free_loop_ssl_data(loop);
   47|       |#endif
   48|       |
   49|  6.94k|    free(loop->data.recv_buf);
   50|       |
   51|  6.94k|    us_timer_close(loop->data.sweep_timer);
   52|  6.94k|    us_internal_async_close(loop->data.wakeup_async);
   53|  6.94k|}
us_wakeup_loop:
   55|  9.97k|void us_wakeup_loop(struct us_loop_t *loop) {
   56|  9.97k|    us_internal_async_wakeup(loop->data.wakeup_async);
   57|  9.97k|}
us_internal_loop_link:
   59|  27.7k|void us_internal_loop_link(struct us_loop_t *loop, struct us_socket_context_t *context) {
   60|       |    /* Insert this context as the head of loop */
   61|  27.7k|    context->next = loop->data.head;
   62|  27.7k|    context->prev = 0;
   63|  27.7k|    if (loop->data.head) {
  ------------------
  |  Branch (63:9): [True: 20.8k, False: 6.94k]
  ------------------
   64|  20.8k|        loop->data.head->prev = context;
   65|  20.8k|    }
   66|  27.7k|    loop->data.head = context;
   67|  27.7k|}
us_internal_loop_unlink:
   70|  27.7k|void us_internal_loop_unlink(struct us_loop_t *loop, struct us_socket_context_t *context) {
   71|  27.7k|    if (loop->data.head == context) {
  ------------------
  |  Branch (71:9): [True: 13.8k, False: 13.8k]
  ------------------
   72|  13.8k|        loop->data.head = context->next;
   73|  13.8k|        if (loop->data.head) {
  ------------------
  |  Branch (73:13): [True: 6.94k, False: 6.94k]
  ------------------
   74|  6.94k|            loop->data.head->prev = 0;
   75|  6.94k|        }
   76|  13.8k|    } else {
   77|  13.8k|        context->prev->next = context->next;
   78|  13.8k|        if (context->next) {
  ------------------
  |  Branch (78:13): [True: 0, False: 13.8k]
  ------------------
   79|      0|            context->next->prev = context->prev;
   80|      0|        }
   81|  13.8k|    }
   82|  27.7k|}
us_internal_timer_sweep:
   85|  2.75M|void us_internal_timer_sweep(struct us_loop_t *loop) {
   86|  2.75M|    struct us_internal_loop_data_t *loop_data = &loop->data;
   87|       |    /* For all socket contexts in this loop */
   88|  13.7M|    for (loop_data->iterator = loop_data->head; loop_data->iterator; loop_data->iterator = loop_data->iterator->next) {
  ------------------
  |  Branch (88:49): [True: 11.0M, False: 2.75M]
  ------------------
   89|       |
   90|  11.0M|        struct us_socket_context_t *context = loop_data->iterator;
   91|       |
   92|       |        /* Update this context's timestamps (this could be moved to loop and done once) */
   93|  11.0M|        context->global_tick++;
   94|  11.0M|        unsigned char short_ticks = context->timestamp = context->global_tick % 240;
   95|  11.0M|        unsigned char long_ticks = context->long_timestamp = (context->global_tick / 15) % 240;
   96|       |
   97|       |        /* Begin at head */
   98|  11.0M|        struct us_socket_t *s = context->head_sockets;
   99|  11.0M|        while (s) {
  ------------------
  |  Branch (99:16): [True: 173k, False: 10.8M]
  ------------------
  100|       |            /* Seek until end or timeout found (tightest loop) */
  101|   346k|            while (1) {
  ------------------
  |  Branch (101:20): [Folded - Ignored]
  ------------------
  102|       |                /* We only read from 1 random cache line here */
  103|   346k|                if (short_ticks == s->timeout || long_ticks == s->long_timeout) {
  ------------------
  |  Branch (103:21): [True: 11.9k, False: 334k]
  |  Branch (103:50): [True: 0, False: 334k]
  ------------------
  104|  11.9k|                    break;
  105|  11.9k|                }
  106|       |
  107|       |                /* Did we reach the end without a find? */
  108|   334k|                if ((s = s->next) == 0) {
  ------------------
  |  Branch (108:21): [True: 161k, False: 173k]
  ------------------
  109|   161k|                    goto next_context;
  110|   161k|                }
  111|   334k|            }
  112|       |
  113|       |            /* Here we have a timeout to emit (slow path) */
  114|  11.9k|            context->iterator = s;
  115|       |
  116|  11.9k|            if (short_ticks == s->timeout) {
  ------------------
  |  Branch (116:17): [True: 11.9k, False: 0]
  ------------------
  117|  11.9k|                s->timeout = 255;
  118|  11.9k|                context->on_socket_timeout(s);
  119|  11.9k|            }
  120|       |
  121|  11.9k|            if (context->iterator == s && long_ticks == s->long_timeout) {
  ------------------
  |  Branch (121:17): [True: 2.54k, False: 9.36k]
  |  Branch (121:43): [True: 0, False: 2.54k]
  ------------------
  122|      0|                s->long_timeout = 255;
  123|      0|                context->on_socket_long_timeout(s);
  124|      0|            }   
  125|       |
  126|       |            /* Check for unlink / link (if the event handler did not modify the chain, we step 1) */
  127|  11.9k|            if (s == context->iterator) {
  ------------------
  |  Branch (127:17): [True: 2.54k, False: 9.36k]
  ------------------
  128|  2.54k|                s = s->next;
  129|  9.36k|            } else {
  130|       |                /* The iterator was changed by event handler */
  131|  9.36k|                s = context->iterator;
  132|  9.36k|            }
  133|  11.9k|        }
  134|       |        /* We always store a 0 to context->iterator here since we are no longer iterating this context */
  135|  11.0M|        next_context:
  136|  11.0M|        context->iterator = 0;
  137|  11.0M|    }
  138|  2.75M|}
us_internal_handle_low_priority_sockets:
  145|  3.36M|void us_internal_handle_low_priority_sockets(struct us_loop_t *loop) {
  146|  3.36M|    struct us_internal_loop_data_t *loop_data = &loop->data;
  147|  3.36M|    struct us_socket_t *s;
  148|       |
  149|  3.36M|    loop_data->low_prio_budget = MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION;
  150|       |
  151|  3.36M|    for (s = loop_data->low_prio_head; s && loop_data->low_prio_budget > 0; s = loop_data->low_prio_head, loop_data->low_prio_budget--) {
  ------------------
  |  Branch (151:40): [True: 0, False: 3.36M]
  |  Branch (151:45): [True: 0, False: 0]
  ------------------
  152|       |        /* Unlink this socket from the low-priority queue */
  153|      0|        loop_data->low_prio_head = s->next;
  154|      0|        if (s->next) s->next->prev = 0;
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|        s->next = 0;
  156|       |
  157|      0|        us_internal_socket_context_link_socket(s->context, s);
  158|      0|        us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) | LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|      0|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  159|       |
  160|      0|        s->low_prio_state = 2;
  161|      0|    }
  162|  3.36M|}
us_internal_free_closed_sockets:
  165|  3.36M|void us_internal_free_closed_sockets(struct us_loop_t *loop) {
  166|       |    /* Free all closed sockets (maybe it is better to reverse order?) */
  167|  3.36M|    if (loop->data.closed_head) {
  ------------------
  |  Branch (167:9): [True: 261k, False: 3.10M]
  ------------------
  168|  1.64M|        for (struct us_socket_t *s = loop->data.closed_head; s; ) {
  ------------------
  |  Branch (168:62): [True: 1.38M, False: 261k]
  ------------------
  169|  1.38M|            struct us_socket_t *next = s->next;
  170|  1.38M|            us_poll_free((struct us_poll_t *) s, loop);
  171|  1.38M|            s = next;
  172|  1.38M|        }
  173|   261k|        loop->data.closed_head = 0;
  174|   261k|    }
  175|  3.36M|}
sweep_timer_cb:
  177|  2.75M|void sweep_timer_cb(struct us_internal_callback_t *cb) {
  178|  2.75M|    us_internal_timer_sweep(cb->loop);
  179|  2.75M|}
us_loop_iteration_number:
  181|  6.94k|long long us_loop_iteration_number(struct us_loop_t *loop) {
  182|  6.94k|    return loop->data.iteration_nr;
  183|  6.94k|}
us_internal_loop_pre:
  186|  3.36M|void us_internal_loop_pre(struct us_loop_t *loop) {
  187|  3.36M|    loop->data.iteration_nr++;
  188|  3.36M|    us_internal_handle_low_priority_sockets(loop);
  189|  3.36M|    loop->data.pre_cb(loop);
  190|  3.36M|}
us_internal_loop_post:
  192|  3.36M|void us_internal_loop_post(struct us_loop_t *loop) {
  193|  3.36M|    us_internal_free_closed_sockets(loop);
  194|  3.36M|    loop->data.post_cb(loop);
  195|  3.36M|}
us_adopt_accepted_socket:
  198|  1.37M|    unsigned int socket_ext_size, char *addr_ip, int addr_ip_length) {
  199|       |#ifndef LIBUS_NO_SSL
  200|       |    if (ssl) {
  201|       |        return (struct us_socket_t *)us_internal_ssl_adopt_accepted_socket((struct us_internal_ssl_socket_context_t *)context, accepted_fd,
  202|       |            socket_ext_size, addr_ip, addr_ip_length);
  203|       |    }
  204|       |#endif
  205|  1.37M|    struct us_poll_t *accepted_p = us_create_poll(context->loop, 0, sizeof(struct us_socket_t) - sizeof(struct us_poll_t) + socket_ext_size);
  206|  1.37M|    us_poll_init(accepted_p, accepted_fd, POLL_TYPE_SOCKET);
  207|  1.37M|    us_poll_start(accepted_p, context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  1.37M|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  208|       |
  209|  1.37M|    struct us_socket_t *s = (struct us_socket_t *) accepted_p;
  210|       |
  211|  1.37M|    s->context = context;
  212|  1.37M|    s->timeout = 255;
  213|  1.37M|    s->long_timeout = 255;
  214|  1.37M|    s->low_prio_state = 0;
  215|       |
  216|       |    /* We always use nodelay */
  217|  1.37M|    bsd_socket_nodelay(accepted_fd, 1);
  218|       |
  219|  1.37M|    us_internal_socket_context_link_socket(context, s);
  220|       |
  221|  1.37M|    context->on_open(s, 0, addr_ip, addr_ip_length);
  222|  1.37M|    return s;
  223|  1.37M|}
us_internal_dispatch_ready_poll:
  225|  12.1M|void us_internal_dispatch_ready_poll(struct us_poll_t *p, int error, int events) {
  226|  12.1M|    switch (us_internal_poll_type(p)) {
  ------------------
  |  Branch (226:13): [True: 0, False: 12.1M]
  ------------------
  227|  8.13M|    case POLL_TYPE_CALLBACK: {
  ------------------
  |  Branch (227:5): [True: 8.13M, False: 4.00M]
  ------------------
  228|  8.13M|            struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  229|       |            /* Timers, asyncs should accept (read), while UDP sockets should obviously not */
  230|  8.13M|            if (!cb->leave_poll_ready) {
  ------------------
  |  Branch (230:17): [True: 8.13M, False: 0]
  ------------------
  231|       |                /* Let's just have this macro to silence the CodeQL alert regarding empty function when using libuv */
  232|  8.13M|    #ifndef LIBUS_USE_LIBUV
  233|  8.13M|                us_internal_accept_poll_event(p);
  234|  8.13M|    #endif
  235|  8.13M|            }
  236|  8.13M|            cb->cb(cb->cb_expects_the_loop ? (struct us_internal_callback_t *) cb->loop : (struct us_internal_callback_t *) &cb->p);
  ------------------
  |  Branch (236:20): [True: 2.66M, False: 5.46M]
  ------------------
  237|  8.13M|        }
  238|  8.13M|        break;
  239|  2.43M|    case POLL_TYPE_SEMI_SOCKET: {
  ------------------
  |  Branch (239:5): [True: 2.43M, False: 9.69M]
  ------------------
  240|       |            /* Both connect and listen sockets are semi-sockets
  241|       |             * but they poll for different events */
  242|  2.43M|            if (us_poll_events(p) == LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|  2.43M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (242:17): [True: 1.98k, False: 2.43M]
  ------------------
  243|  1.98k|                struct us_socket_t *s = (struct us_socket_t *) p;
  244|       |
  245|       |                /* It is perfectly possible to come here with an error */
  246|  1.98k|                if (error) {
  ------------------
  |  Branch (246:21): [True: 1.76k, False: 225]
  ------------------
  247|       |                    /* Emit error, close without emitting on_close */
  248|  1.76k|                    s->context->on_connect_error(s, 0);
  249|  1.76k|                    us_socket_close_connecting(0, s);
  250|  1.76k|                } else {
  251|       |                    /* All sockets poll for readable */
  252|    225|                    us_poll_change(p, s->context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|    225|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  253|       |
  254|       |                    /* We always use nodelay */
  255|    225|                    bsd_socket_nodelay(us_poll_fd(p), 1);
  256|       |
  257|       |                    /* We are now a proper socket */
  258|    225|                    us_internal_poll_set_type(p, POLL_TYPE_SOCKET);
  259|       |
  260|       |                    /* If we used a connection timeout we have to reset it here */
  261|    225|                    us_socket_timeout(0, s, 0);
  262|       |
  263|    225|                    s->context->on_open(s, 1, 0, 0);
  264|    225|                }
  265|  2.43M|            } else {
  266|  2.43M|                struct us_listen_socket_t *listen_socket = (struct us_listen_socket_t *) p;
  267|  2.43M|                struct bsd_addr_t addr;
  268|       |
  269|  2.43M|                LIBUS_SOCKET_DESCRIPTOR client_fd = bsd_accept_socket(us_poll_fd(p), &addr);
  ------------------
  |  |   38|  2.43M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  270|  2.43M|                if (client_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  2.43M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (270:21): [True: 2.21M, False: 218k]
  ------------------
  271|       |                    /* Todo: start timer here */
  272|       |
  273|  2.21M|                } else {
  274|       |
  275|       |                    /* Todo: stop timer if any */
  276|       |
  277|  1.37M|                    do {
  278|  1.37M|                        struct us_socket_context_t *context = us_socket_context(0, &listen_socket->s);
  279|       |                        /* See if we want to export the FD or keep it here (this event can be unset) */
  280|  1.37M|                        if (context->on_pre_open == 0 || context->on_pre_open(context, client_fd) == client_fd) {
  ------------------
  |  Branch (280:29): [True: 1.37M, False: 0]
  |  Branch (280:58): [True: 0, False: 0]
  ------------------
  281|       |
  282|       |                            /* Adopt the newly accepted socket */
  283|  1.37M|                            us_adopt_accepted_socket(0, context,
  284|  1.37M|                                client_fd, listen_socket->socket_ext_size, bsd_addr_get_ip(&addr), bsd_addr_get_ip_length(&addr));
  285|       |
  286|       |                            /* Exit accept loop if listen socket was closed in on_open handler */
  287|  1.37M|                            if (us_socket_is_closed(0, &listen_socket->s)) {
  ------------------
  |  Branch (287:33): [True: 0, False: 1.37M]
  ------------------
  288|      0|                                break;
  289|      0|                            }
  290|       |
  291|  1.37M|                        }
  292|       |
  293|  1.37M|                    } while ((client_fd = bsd_accept_socket(us_poll_fd(p), &addr)) != LIBUS_SOCKET_ERROR);
  ------------------
  |  |   44|  1.37M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (293:30): [True: 1.15M, False: 218k]
  ------------------
  294|   218k|                }
  295|  2.43M|            }
  296|  2.43M|        }
  297|      0|        break;
  298|  1.50k|    case POLL_TYPE_SOCKET_SHUT_DOWN:
  ------------------
  |  Branch (298:5): [True: 1.50k, False: 12.1M]
  ------------------
  299|  1.56M|    case POLL_TYPE_SOCKET: {
  ------------------
  |  Branch (299:5): [True: 1.56M, False: 10.5M]
  ------------------
  300|       |            /* We should only use s, no p after this point */
  301|  1.56M|            struct us_socket_t *s = (struct us_socket_t *) p;
  302|       |
  303|       |            /* Such as epollerr epollhup */
  304|  1.56M|            if (error) {
  ------------------
  |  Branch (304:17): [True: 1.23M, False: 330k]
  ------------------
  305|       |                /* Todo: decide what code we give here */
  306|  1.23M|                s = us_socket_close(0, s, 0, NULL);
  307|  1.23M|                return;
  308|  1.23M|            }
  309|       |
  310|   330k|            if (events & LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|   330k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (310:17): [True: 40.3k, False: 290k]
  ------------------
  311|       |                /* Note: if we failed a write as a socket of one loop then adopted
  312|       |                 * to another loop, this will be wrong. Absurd case though */
  313|  40.3k|                s->context->loop->data.last_write_failed = 0;
  314|       |
  315|  40.3k|                s = s->context->on_writable(s);
  316|       |
  317|  40.3k|                if (us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (317:21): [True: 195, False: 40.1k]
  ------------------
  318|    195|                    return;
  319|    195|                }
  320|       |
  321|       |                /* If we have no failed write or if we shut down, then stop polling for more writable */
  322|  40.1k|                if (!s->context->loop->data.last_write_failed || us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (322:21): [True: 3.06k, False: 37.0k]
  |  Branch (322:66): [True: 0, False: 37.0k]
  ------------------
  323|  3.06k|                    us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  3.06k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  324|  3.06k|                }
  325|  40.1k|            }
  326|       |
  327|   330k|            if (events & LIBUS_SOCKET_READABLE) {
  ------------------
  |  |   27|   330k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  |  Branch (327:17): [True: 295k, False: 34.9k]
  ------------------
  328|       |                /* Contexts may prioritize down sockets that are currently readable, e.g. when SSL handshake has to be done.
  329|       |                 * SSL handshakes are CPU intensive, so we limit the number of handshakes per loop iteration, and move the rest
  330|       |                 * to the low-priority queue */
  331|   295k|                if (s->context->is_low_prio(s)) {
  ------------------
  |  Branch (331:21): [True: 0, False: 295k]
  ------------------
  332|      0|                    if (s->low_prio_state == 2) {
  ------------------
  |  Branch (332:25): [True: 0, False: 0]
  ------------------
  333|      0|                        s->low_prio_state = 0; /* Socket has been delayed and now it's time to process incoming data for one iteration */
  334|      0|                    } else if (s->context->loop->data.low_prio_budget > 0) {
  ------------------
  |  Branch (334:32): [True: 0, False: 0]
  ------------------
  335|      0|                        s->context->loop->data.low_prio_budget--; /* Still having budget for this iteration - do normal processing */
  336|      0|                    } else {
  337|      0|                        us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|      0|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  338|      0|                        us_internal_socket_context_unlink_socket(s->context, s);
  339|       |
  340|       |                        /* Link this socket to the low-priority queue - we use a LIFO queue, to prioritize newer clients that are
  341|       |                         * maybe not already timeouted - sounds unfair, but works better in real-life with smaller client-timeouts
  342|       |                         * under high load */
  343|      0|                        s->prev = 0;
  344|      0|                        s->next = s->context->loop->data.low_prio_head;
  345|      0|                        if (s->next) s->next->prev = s;
  ------------------
  |  Branch (345:29): [True: 0, False: 0]
  ------------------
  346|      0|                        s->context->loop->data.low_prio_head = s;
  347|       |
  348|      0|                        s->low_prio_state = 1;
  349|       |
  350|      0|                        break;
  351|      0|                    }
  352|      0|                }
  353|       |
  354|   295k|                int length;
  355|   295k|                read_more:
  356|   295k|                length = bsd_recv(us_poll_fd(&s->p), s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, LIBUS_RECV_BUFFER_LENGTH, 0);
  ------------------
  |  |   26|   295k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
                              length = bsd_recv(us_poll_fd(&s->p), s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, LIBUS_RECV_BUFFER_LENGTH, 0);
  ------------------
  |  |   22|   295k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  357|   295k|                if (length > 0) {
  ------------------
  |  Branch (357:21): [True: 264k, False: 31.0k]
  ------------------
  358|   264k|                    s = s->context->on_data(s, s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, length);
  ------------------
  |  |   26|   264k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
  359|       |
  360|       |                    /* If we filled the entire recv buffer, we need to immediately read again since otherwise a
  361|       |                     * pending hangup event in the same even loop iteration can close the socket before we get
  362|       |                     * the chance to read again next iteration */
  363|   264k|                    if (length == LIBUS_RECV_BUFFER_LENGTH && s && !us_socket_is_closed(0, s)) {
  ------------------
  |  |   22|   528k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  |  Branch (363:25): [True: 0, False: 264k]
  |  Branch (363:63): [True: 0, False: 0]
  |  Branch (363:68): [True: 0, False: 0]
  ------------------
  364|      0|                        goto read_more;
  365|      0|                    }
  366|       |
  367|   264k|                } else if (!length) {
  ------------------
  |  Branch (367:28): [True: 28.3k, False: 2.66k]
  ------------------
  368|  28.3k|                    if (us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (368:25): [True: 194, False: 28.1k]
  ------------------
  369|       |                        /* We got FIN back after sending it */
  370|       |                        /* Todo: We should give "CLEAN SHUTDOWN" as reason here */
  371|    194|                        s = us_socket_close(0, s, 0, NULL);
  372|  28.1k|                    } else {
  373|       |                        /* We got FIN, so stop polling for readable */
  374|  28.1k|                        us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  28.1k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  375|  28.1k|                        s = s->context->on_end(s);
  376|  28.1k|                    }
  377|  28.3k|                } else if (length == LIBUS_SOCKET_ERROR && !bsd_would_block()) {
  ------------------
  |  |   44|  5.33k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (377:28): [True: 2.66k, False: 0]
  |  Branch (377:60): [True: 0, False: 2.66k]
  ------------------
  378|       |                    /* Todo: decide also here what kind of reason we should give */
  379|      0|                    s = us_socket_close(0, s, 0, NULL);
  380|      0|                }
  381|   295k|            }
  382|   330k|        }
  383|   330k|        break;
  384|  12.1M|    }
  385|  12.1M|}
us_loop_integrate:
  388|  6.94k|void us_loop_integrate(struct us_loop_t *loop) {
  389|  6.94k|    us_timer_set(loop->data.sweep_timer, (void (*)(struct us_timer_t *)) sweep_timer_cb, LIBUS_TIMEOUT_GRANULARITY * 1000, LIBUS_TIMEOUT_GRANULARITY * 1000);
  ------------------
  |  |   24|  6.94k|#define LIBUS_TIMEOUT_GRANULARITY 4
  ------------------
                  us_timer_set(loop->data.sweep_timer, (void (*)(struct us_timer_t *)) sweep_timer_cb, LIBUS_TIMEOUT_GRANULARITY * 1000, LIBUS_TIMEOUT_GRANULARITY * 1000);
  ------------------
  |  |   24|  6.94k|#define LIBUS_TIMEOUT_GRANULARITY 4
  ------------------
  390|  6.94k|}
us_loop_ext:
  392|  12.1M|void *us_loop_ext(struct us_loop_t *loop) {
  393|  12.1M|    return loop + 1;
  394|  12.1M|}

us_socket_local_port:
   28|  2.03k|int us_socket_local_port(int ssl, struct us_socket_t *s) {
   29|  2.03k|    struct bsd_addr_t addr;
   30|  2.03k|    if (bsd_local_addr(us_poll_fd(&s->p), &addr)) {
  ------------------
  |  Branch (30:9): [True: 2.03k, False: 0]
  ------------------
   31|  2.03k|        return -1;
   32|  2.03k|    } else {
   33|      0|        return bsd_addr_get_port(&addr);
   34|      0|    }
   35|  2.03k|}
us_socket_shutdown_read:
   46|    844|void us_socket_shutdown_read(int ssl, struct us_socket_t *s) {
   47|       |    /* This syscall is idempotent so no extra check is needed */
   48|    844|    bsd_shutdown_socket_read(us_poll_fd((struct us_poll_t *) s));
   49|    844|}
us_socket_remote_address:
   51|  39.0k|void us_socket_remote_address(int ssl, struct us_socket_t *s, char *buf, int *length) {
   52|  39.0k|    struct bsd_addr_t addr;
   53|  39.0k|    if (bsd_remote_addr(us_poll_fd(&s->p), &addr) || *length < bsd_addr_get_ip_length(&addr)) {
  ------------------
  |  Branch (53:9): [True: 0, False: 39.0k]
  |  Branch (53:54): [True: 0, False: 39.0k]
  ------------------
   54|      0|        *length = 0;
   55|  39.0k|    } else {
   56|  39.0k|        *length = bsd_addr_get_ip_length(&addr);
   57|  39.0k|        memcpy(buf, bsd_addr_get_ip(&addr), *length);
   58|  39.0k|    }
   59|  39.0k|}
us_socket_context:
   61|  7.39M|struct us_socket_context_t *us_socket_context(int ssl, struct us_socket_t *s) {
   62|  7.39M|    return s->context;
   63|  7.39M|}
us_socket_timeout:
   65|  1.70M|void us_socket_timeout(int ssl, struct us_socket_t *s, unsigned int seconds) {
   66|  1.70M|    if (seconds) {
  ------------------
  |  Branch (66:9): [True: 1.63M, False: 69.4k]
  ------------------
   67|  1.63M|        s->timeout = ((unsigned int)s->context->timestamp + ((seconds + 3) >> 2)) % 240;
   68|  1.63M|    } else {
   69|  69.4k|        s->timeout = 255;
   70|  69.4k|    }
   71|  1.70M|}
us_socket_long_timeout:
   73|  40.4k|void us_socket_long_timeout(int ssl, struct us_socket_t *s, unsigned int minutes) {
   74|  40.4k|    if (minutes) {
  ------------------
  |  Branch (74:9): [True: 0, False: 40.4k]
  ------------------
   75|      0|        s->long_timeout = ((unsigned int)s->context->long_timestamp + minutes) % 240;
   76|  40.4k|    } else {
   77|  40.4k|        s->long_timeout = 255;
   78|  40.4k|    }
   79|  40.4k|}
us_socket_flush:
   81|    225|void us_socket_flush(int ssl, struct us_socket_t *s) {
   82|    225|    if (!us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (82:9): [True: 225, False: 0]
  ------------------
   83|    225|        bsd_socket_flush(us_poll_fd((struct us_poll_t *) s));
   84|    225|    }
   85|    225|}
us_socket_is_closed:
   87|  4.99M|int us_socket_is_closed(int ssl, struct us_socket_t *s) {
   88|  4.99M|    return s->prev == (struct us_socket_t *) s->context;
   89|  4.99M|}
us_socket_is_established:
   91|  2.03k|int us_socket_is_established(int ssl, struct us_socket_t *s) {
   92|       |    /* Everything that is not POLL_TYPE_SEMI_SOCKET is established */
   93|  2.03k|    return us_internal_poll_type((struct us_poll_t *) s) != POLL_TYPE_SEMI_SOCKET;
   94|  2.03k|}
us_socket_close_connecting:
   97|  1.76k|struct us_socket_t *us_socket_close_connecting(int ssl, struct us_socket_t *s) {
   98|  1.76k|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (98:9): [True: 1.76k, False: 0]
  ------------------
   99|  1.76k|        us_internal_socket_context_unlink_socket(s->context, s);
  100|  1.76k|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
  101|  1.76k|        bsd_close_socket(us_poll_fd((struct us_poll_t *) s));
  102|       |
  103|       |        /* Link this socket to the close-list and let it be deleted after this iteration */
  104|  1.76k|        s->next = s->context->loop->data.closed_head;
  105|  1.76k|        s->context->loop->data.closed_head = s;
  106|       |
  107|       |        /* Any socket with prev = context is marked as closed */
  108|  1.76k|        s->prev = (struct us_socket_t *) s->context;
  109|       |
  110|       |        //return s->context->on_close(s, code, reason);
  111|  1.76k|    }
  112|  1.76k|    return s;
  113|  1.76k|}
us_socket_close:
  116|  1.37M|struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, void *reason) {
  117|  1.37M|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (117:9): [True: 1.37M, False: 0]
  ------------------
  118|  1.37M|        if (s->low_prio_state == 1) {
  ------------------
  |  Branch (118:13): [True: 0, False: 1.37M]
  ------------------
  119|       |            /* Unlink this socket from the low-priority queue */
  120|      0|            if (!s->prev) s->context->loop->data.low_prio_head = s->next;
  ------------------
  |  Branch (120:17): [True: 0, False: 0]
  ------------------
  121|      0|            else s->prev->next = s->next;
  122|       |
  123|      0|            if (s->next) s->next->prev = s->prev;
  ------------------
  |  Branch (123:17): [True: 0, False: 0]
  ------------------
  124|       |
  125|      0|            s->prev = 0;
  126|      0|            s->next = 0;
  127|      0|            s->low_prio_state = 0;
  128|  1.37M|        } else {
  129|  1.37M|            us_internal_socket_context_unlink_socket(s->context, s);
  130|  1.37M|        }
  131|  1.37M|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
  132|  1.37M|        bsd_close_socket(us_poll_fd((struct us_poll_t *) s));
  133|       |
  134|       |        /* Link this socket to the close-list and let it be deleted after this iteration */
  135|  1.37M|        s->next = s->context->loop->data.closed_head;
  136|  1.37M|        s->context->loop->data.closed_head = s;
  137|       |
  138|       |        /* Any socket with prev = context is marked as closed */
  139|  1.37M|        s->prev = (struct us_socket_t *) s->context;
  140|       |
  141|  1.37M|        return s->context->on_close(s, code, reason);
  142|  1.37M|    }
  143|      0|    return s;
  144|  1.37M|}
us_socket_get_native_handle:
  148|  39.0k|void *us_socket_get_native_handle(int ssl, struct us_socket_t *s) {
  149|       |#ifndef LIBUS_NO_SSL
  150|       |    if (ssl) {
  151|       |        return us_internal_ssl_socket_get_native_handle((struct us_internal_ssl_socket_t *) s);
  152|       |    }
  153|       |#endif
  154|       |
  155|  39.0k|    return (void *) (uintptr_t) us_poll_fd((struct us_poll_t *) s);
  156|  39.0k|}
us_socket_write:
  173|   282k|int us_socket_write(int ssl, struct us_socket_t *s, const char *data, int length, int msg_more) {
  174|       |#ifndef LIBUS_NO_SSL
  175|       |    if (ssl) {
  176|       |        return us_internal_ssl_socket_write((struct us_internal_ssl_socket_t *) s, data, length, msg_more);
  177|       |    }
  178|       |#endif
  179|       |
  180|   282k|    if (us_socket_is_closed(ssl, s) || us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (180:9): [True: 0, False: 282k]
  |  Branch (180:40): [True: 0, False: 282k]
  ------------------
  181|      0|        return 0;
  182|      0|    }
  183|       |
  184|   282k|    int written = bsd_send(us_poll_fd(&s->p), data, length, msg_more);
  185|   282k|    if (written != length) {
  ------------------
  |  Branch (185:9): [True: 267k, False: 14.6k]
  ------------------
  186|   267k|        s->context->loop->data.last_write_failed = 1;
  187|   267k|        us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   27|   267k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                      us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|   267k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  188|   267k|    }
  189|       |
  190|   282k|    return written < 0 ? 0 : written;
  ------------------
  |  Branch (190:12): [True: 11.2k, False: 271k]
  ------------------
  191|   282k|}
us_socket_ext:
  193|  5.69M|void *us_socket_ext(int ssl, struct us_socket_t *s) {
  194|       |#ifndef LIBUS_NO_SSL
  195|       |    if (ssl) {
  196|       |        return us_internal_ssl_socket_ext((struct us_internal_ssl_socket_t *) s);
  197|       |    }
  198|       |#endif
  199|       |
  200|  5.69M|    return s + 1;
  201|  5.69M|}
us_socket_is_shut_down:
  203|   709k|int us_socket_is_shut_down(int ssl, struct us_socket_t *s) {
  204|       |#ifndef LIBUS_NO_SSL
  205|       |    if (ssl) {
  206|       |        return us_internal_ssl_socket_is_shut_down((struct us_internal_ssl_socket_t *) s);
  207|       |    }
  208|       |#endif
  209|       |
  210|   709k|    return us_internal_poll_type(&s->p) == POLL_TYPE_SOCKET_SHUT_DOWN;
  211|   709k|}
us_socket_shutdown:
  213|  91.1k|void us_socket_shutdown(int ssl, struct us_socket_t *s) {
  214|       |#ifndef LIBUS_NO_SSL
  215|       |    if (ssl) {
  216|       |        us_internal_ssl_socket_shutdown((struct us_internal_ssl_socket_t *) s);
  217|       |        return;
  218|       |    }
  219|       |#endif
  220|       |
  221|       |    /* Todo: should we emit on_close if calling shutdown on an already half-closed socket?
  222|       |     * We need more states in that case, we need to track RECEIVED_FIN
  223|       |     * so far, the app has to track this and call close as needed */
  224|  91.1k|    if (!us_socket_is_closed(ssl, s) && !us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (224:9): [True: 91.1k, False: 0]
  |  Branch (224:41): [True: 91.1k, False: 0]
  ------------------
  225|  91.1k|        us_internal_poll_set_type(&s->p, POLL_TYPE_SOCKET_SHUT_DOWN);
  226|  91.1k|        us_poll_change(&s->p, s->context->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  91.1k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  227|  91.1k|        bsd_shutdown_socket(us_poll_fd((struct us_poll_t *) s));
  228|  91.1k|    }
  229|  91.1k|}

