_ZN3uWS12TemplatedAppILb0EEC2ENS_20SocketContextOptionsE:
  217|  6.03k|    TemplatedApp(SocketContextOptions options = {}) {
  218|  6.03k|        httpContext = HttpContext<SSL>::create(Loop::get(), options);
  219|  6.03k|    }
_ZNK3uWS20SocketContextOptionscv27us_socket_context_options_tEv:
   71|  6.03k|        operator struct us_socket_context_options_t() const {
   72|  6.03k|            struct us_socket_context_options_t socket_context_options;
   73|  6.03k|            memcpy(&socket_context_options, this, sizeof(SocketContextOptions));
   74|  6.03k|            return socket_context_options;
   75|  6.03k|        }
_ZN3uWS12TemplatedAppILb0EED2Ev:
  177|  12.0k|    ~TemplatedApp() {
  178|       |        /* Let's just put everything here */
  179|  12.0k|        if (httpContext) {
  ------------------
  |  Branch (179:13): [True: 6.03k, False: 6.03k]
  ------------------
  180|  6.03k|            httpContext->free();
  181|       |
  182|       |            /* Free all our webSocketContexts in a type less way */
  183|  12.0k|            for (auto &webSocketContextDeleter : webSocketContextDeleters) {
  ------------------
  |  Branch (183:48): [True: 12.0k, False: 6.03k]
  ------------------
  184|  12.0k|                webSocketContextDeleter();
  185|  12.0k|            }
  186|  6.03k|        }
  187|       |
  188|       |        /* Delete TopicTree */
  189|  12.0k|        if (topicTree) {
  ------------------
  |  Branch (189:13): [True: 6.03k, False: 6.03k]
  ------------------
  190|  6.03k|            delete topicTree;
  191|       |
  192|       |            /* And unregister loop callbacks */
  193|       |            /* We must unregister any loop post handler here */
  194|  6.03k|            Loop::get()->removePostHandler(topicTree);
  195|  6.03k|            Loop::get()->removePreHandler(topicTree);
  196|  6.03k|        }
  197|  12.0k|    }
EpollHelloWorld.cpp:_ZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EE:
  263|  12.0k|    TemplatedApp &&ws(std::string pattern, WebSocketBehavior<UserData> &&behavior) {
  264|       |        /* Don't compile if alignment rules cannot be satisfied */
  265|  12.0k|        static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
  266|  12.0k|        "µWebSockets cannot satisfy UserData alignment requirements. You need to recompile µSockets with LIBUS_EXT_ALIGNMENT adjusted accordingly.");
  267|       |
  268|  12.0k|        if (!httpContext) {
  ------------------
  |  Branch (268:13): [True: 0, False: 12.0k]
  ------------------
  269|      0|            return std::move(*this);
  270|      0|        }
  271|       |
  272|       |        /* Terminate on misleading idleTimeout values */
  273|  12.0k|        if (behavior.idleTimeout && behavior.idleTimeout < 8) {
  ------------------
  |  Branch (273:13): [True: 12.0k, False: 0]
  |  Branch (273:37): [True: 0, False: 12.0k]
  ------------------
  274|      0|            std::cerr << "Error: idleTimeout must be either 0 or greater than 8!" << std::endl;
  275|      0|            std::terminate();
  276|      0|        }
  277|       |
  278|       |        /* Maximum idleTimeout is 16 minutes */
  279|  12.0k|        if (behavior.idleTimeout > 240 * 4) {
  ------------------
  |  Branch (279:13): [True: 0, False: 12.0k]
  ------------------
  280|      0|            std::cerr << "Error: idleTimeout must not be greater than 960 seconds!" << std::endl;
  281|      0|            std::terminate();
  282|      0|        }
  283|       |
  284|       |        /* Maximum maxLifetime is 4 hours */
  285|  12.0k|        if (behavior.maxLifetime > 240) {
  ------------------
  |  Branch (285:13): [True: 0, False: 12.0k]
  ------------------
  286|      0|            std::cerr << "Error: maxLifetime must not be greater than 240 minutes!" << std::endl;
  287|      0|            std::terminate();
  288|      0|        }
  289|       |
  290|       |        /* If we don't have a TopicTree yet, create one now */
  291|  12.0k|        if (!topicTree) {
  ------------------
  |  Branch (291:13): [True: 6.03k, False: 6.03k]
  ------------------
  292|       |
  293|  6.03k|            bool needsUncork = false;
  294|  6.03k|            topicTree = new TopicTree<TopicTreeMessage, TopicTreeBigMessage>([needsUncork](Subscriber *s, TopicTreeMessage &message, TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags flags) mutable {
  295|       |                /* Subscriber's user is the socket */
  296|       |                /* Unfortunately we need to cast is to PerSocketData = int
  297|       |                 * since many different WebSocketContexts use the same
  298|       |                 * TopicTree now */
  299|  6.03k|                auto *ws = (WebSocket<SSL, true, int> *) s->user;
  300|       |
  301|       |                /* If this is the first message we try and cork */
  302|  6.03k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::FIRST) {
  303|  6.03k|                    if (ws->canCork() && !ws->isCorked()) {
  304|  6.03k|                        ((AsyncSocket<SSL> *)ws)->cork();
  305|  6.03k|                        needsUncork = true;
  306|  6.03k|                    }
  307|  6.03k|                }
  308|       |
  309|       |                /* If we ever overstep maxBackpresure, exit immediately */
  310|  6.03k|                if (WebSocket<SSL, true, int>::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) {
  311|  6.03k|                    if (needsUncork) {
  312|  6.03k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  313|  6.03k|                        needsUncork = false;
  314|  6.03k|                    }
  315|       |                    /* Stop draining */
  316|  6.03k|                    return true;
  317|  6.03k|                }
  318|       |
  319|       |                /* If this is the last message we uncork if we are corked */
  320|  6.03k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::LAST) {
  321|       |                    /* We should not uncork in all cases? */
  322|  6.03k|                    if (needsUncork) {
  323|  6.03k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  324|  6.03k|                    }
  325|  6.03k|                }
  326|       |
  327|       |                /* Success */
  328|  6.03k|                return false;
  329|  6.03k|            });
  330|       |
  331|       |            /* And hook it up with the loop */
  332|       |            /* We empty for both pre and post just to make sure */
  333|  6.03k|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  334|       |                /* Commit pub/sub batches every loop iteration */
  335|  6.03k|                topicTree->drain();
  336|  6.03k|            });
  337|       |
  338|  6.03k|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  339|       |                /* Commit pub/sub batches every loop iteration */
  340|  6.03k|                topicTree->drain();
  341|  6.03k|            });
  342|  6.03k|        }
  343|       |
  344|       |        /* Every route has its own websocket context with its own behavior and user data type */
  345|  12.0k|        auto *webSocketContext = WebSocketContext<SSL, true, UserData>::create(Loop::get(), (us_socket_context_t *) httpContext, topicTree);
  346|       |
  347|       |        /* We need to clear this later on */
  348|  12.0k|        webSocketContextDeleters.push_back([webSocketContext]() {
  349|  12.0k|            webSocketContext->free();
  350|  12.0k|        });
  351|       |
  352|       |        /* We also keep this list for easy closing */
  353|  12.0k|        webSocketContexts.push_back((void *)webSocketContext);
  354|       |
  355|       |        /* Quick fix to disable any compression if set */
  356|       |#ifdef UWS_NO_ZLIB
  357|       |        behavior.compression = DISABLED;
  358|       |#endif
  359|       |
  360|       |        /* If we are the first one to use compression, initialize it */
  361|  12.0k|        if (behavior.compression) {
  ------------------
  |  Branch (361:13): [True: 6.03k, False: 6.03k]
  ------------------
  362|  6.03k|            LoopData *loopData = (LoopData *) us_loop_ext(us_socket_context_loop(SSL, webSocketContext->getSocketContext()));
  363|       |
  364|       |            /* Initialize loop's deflate inflate streams */
  365|  6.03k|            if (!loopData->zlibContext) {
  ------------------
  |  Branch (365:17): [True: 6.03k, False: 0]
  ------------------
  366|  6.03k|                loopData->zlibContext = new ZlibContext;
  367|  6.03k|                loopData->inflationStream = new InflationStream(CompressOptions::DEDICATED_DECOMPRESSOR);
  368|  6.03k|                loopData->deflationStream = new DeflationStream(CompressOptions::DEDICATED_COMPRESSOR);
  369|  6.03k|            }
  370|  6.03k|        }
  371|       |
  372|       |        /* Copy all handlers */
  373|  12.0k|        webSocketContext->getExt()->openHandler = std::move(behavior.open);
  374|  12.0k|        webSocketContext->getExt()->messageHandler = std::move(behavior.message);
  375|  12.0k|        webSocketContext->getExt()->drainHandler = std::move(behavior.drain);
  376|  12.0k|        webSocketContext->getExt()->subscriptionHandler = std::move(behavior.subscription);
  377|  12.0k|        webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true, UserData> *ws, int code, std::string_view message) mutable {
  378|  12.0k|            if (closeHandler) {
  379|  12.0k|                closeHandler(ws, code, message);
  380|  12.0k|            }
  381|       |
  382|       |            /* Destruct user data after returning from close handler */
  383|  12.0k|            ((UserData *) ws->getUserData())->~UserData();
  384|  12.0k|        });
  385|  12.0k|        webSocketContext->getExt()->pingHandler = std::move(behavior.ping);
  386|  12.0k|        webSocketContext->getExt()->pongHandler = std::move(behavior.pong);
  387|       |
  388|       |        /* Copy settings */
  389|  12.0k|        webSocketContext->getExt()->maxPayloadLength = behavior.maxPayloadLength;
  390|  12.0k|        webSocketContext->getExt()->maxBackpressure = behavior.maxBackpressure;
  391|  12.0k|        webSocketContext->getExt()->closeOnBackpressureLimit = behavior.closeOnBackpressureLimit;
  392|  12.0k|        webSocketContext->getExt()->resetIdleTimeoutOnSend = behavior.resetIdleTimeoutOnSend;
  393|  12.0k|        webSocketContext->getExt()->sendPingsAutomatically = behavior.sendPingsAutomatically;
  394|  12.0k|        webSocketContext->getExt()->maxLifetime = behavior.maxLifetime;
  395|  12.0k|        webSocketContext->getExt()->compression = behavior.compression;
  396|       |
  397|       |        /* Calculate idleTimeoutCompnents */
  398|  12.0k|        webSocketContext->getExt()->calculateIdleTimeoutCompnents(behavior.idleTimeout);
  399|       |
  400|  12.0k|        httpContext->onHttp("GET", pattern, [webSocketContext, behavior = std::move(behavior)](auto *res, auto *req) mutable {
  401|       |
  402|       |            /* If we have this header set, it's a websocket */
  403|  12.0k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  404|  12.0k|            if (secWebSocketKey.length() == 24) {
  405|       |
  406|       |                /* Emit upgrade handler */
  407|  12.0k|                if (behavior.upgrade) {
  408|       |
  409|       |                    /* Nasty, ugly Safari 15 hack */
  410|  12.0k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  411|  12.0k|                        std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  412|  12.0k|                        memset((void *) secWebSocketExtensions.data(), ' ', secWebSocketExtensions.length());
  413|  12.0k|                    }
  414|       |
  415|  12.0k|                    behavior.upgrade(res, req, (struct us_socket_context_t *) webSocketContext);
  416|  12.0k|                } else {
  417|       |                    /* Default handler upgrades to WebSocket */
  418|  12.0k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  419|  12.0k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  420|       |
  421|       |                    /* Safari 15 hack */
  422|  12.0k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  423|  12.0k|                        secWebSocketExtensions = "";
  424|  12.0k|                    }
  425|       |
  426|  12.0k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  427|  12.0k|                }
  428|       |
  429|       |                /* We are going to get uncorked by the Http get return */
  430|       |
  431|       |                /* We do not need to check for any close or shutdown here as we immediately return from get handler */
  432|       |
  433|  12.0k|            } else {
  434|       |                /* Tell the router that we did not handle this request */
  435|  12.0k|                req->setYield(true);
  436|  12.0k|            }
  437|  12.0k|        }, true);
  438|  12.0k|        return std::move(*this);
  439|  12.0k|    }
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE_clESH_:
  333|  1.45M|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  334|       |                /* Commit pub/sub batches every loop iteration */
  335|  1.45M|                topicTree->drain();
  336|  1.45M|            });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE0_clESH_:
  338|  1.45M|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  339|       |                /* Commit pub/sub batches every loop iteration */
  340|  1.45M|                topicTree->drain();
  341|  1.45M|            });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlvE_clEv:
  348|  12.0k|        webSocketContextDeleters.push_back([webSocketContext]() {
  349|  12.0k|            webSocketContext->free();
  350|  12.0k|        });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPNS_9WebSocketILb0ELb1ES3_EEiNS5_17basic_string_viewIcS8_EEE_clESI_iSK_:
  377|  33.5k|        webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true, UserData> *ws, int code, std::string_view message) mutable {
  378|  33.5k|            if (closeHandler) {
  ------------------
  |  Branch (378:17): [True: 32.3k, False: 1.20k]
  ------------------
  379|  32.3k|                closeHandler(ws, code, message);
  380|  32.3k|            }
  381|       |
  382|       |            /* Destruct user data after returning from close handler */
  383|  33.5k|            ((UserData *) ws->getUserData())->~UserData();
  384|  33.5k|        });
EpollHelloWorld.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPSD_PT0_E_clINS_12HttpResponseILb0EEENS_11HttpRequestEEEDaSG_SI_:
  400|  46.0k|        httpContext->onHttp("GET", pattern, [webSocketContext, behavior = std::move(behavior)](auto *res, auto *req) mutable {
  401|       |
  402|       |            /* If we have this header set, it's a websocket */
  403|  46.0k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  404|  46.0k|            if (secWebSocketKey.length() == 24) {
  ------------------
  |  Branch (404:17): [True: 33.5k, False: 12.4k]
  ------------------
  405|       |
  406|       |                /* Emit upgrade handler */
  407|  33.5k|                if (behavior.upgrade) {
  ------------------
  |  Branch (407:21): [True: 0, False: 33.5k]
  ------------------
  408|       |
  409|       |                    /* Nasty, ugly Safari 15 hack */
  410|      0|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  ------------------
  |  Branch (410:25): [True: 0, False: 0]
  ------------------
  411|      0|                        std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  412|      0|                        memset((void *) secWebSocketExtensions.data(), ' ', secWebSocketExtensions.length());
  413|      0|                    }
  414|       |
  415|      0|                    behavior.upgrade(res, req, (struct us_socket_context_t *) webSocketContext);
  416|  33.5k|                } else {
  417|       |                    /* Default handler upgrades to WebSocket */
  418|  33.5k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  419|  33.5k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  420|       |
  421|       |                    /* Safari 15 hack */
  422|  33.5k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  ------------------
  |  Branch (422:25): [True: 206, False: 33.3k]
  ------------------
  423|    206|                        secWebSocketExtensions = "";
  424|    206|                    }
  425|       |
  426|  33.5k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  427|  33.5k|                }
  428|       |
  429|       |                /* We are going to get uncorked by the Http get return */
  430|       |
  431|       |                /* We do not need to check for any close or shutdown here as we immediately return from get handler */
  432|       |
  433|  33.5k|            } else {
  434|       |                /* Tell the router that we did not handle this request */
  435|  12.4k|                req->setYield(true);
  436|  12.4k|            }
  437|  46.0k|        }, true);
_ZN3uWS20hasBrokenCompressionENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   29|  33.5k|    inline bool hasBrokenCompression(std::string_view userAgent) {
   30|  33.5k|        size_t posStart = userAgent.find(" Version/15.");
   31|  33.5k|        if (posStart == std::string_view::npos) return false;
  ------------------
  |  Branch (31:13): [True: 26.3k, False: 7.23k]
  ------------------
   32|  7.23k|        posStart += 12;
   33|       |
   34|  7.23k|        size_t posEnd = userAgent.find(' ', posStart);
   35|  7.23k|        if (posEnd == std::string_view::npos) return false;
  ------------------
  |  Branch (35:13): [True: 414, False: 6.81k]
  ------------------
   36|       |
   37|  6.81k|        unsigned int minorVersion = 0;
   38|  6.81k|        auto result = std::from_chars(userAgent.data() + posStart, userAgent.data() + posEnd, minorVersion);
   39|  6.81k|        if (result.ec != std::errc()) return false;
  ------------------
  |  Branch (39:13): [True: 1.16k, False: 5.65k]
  ------------------
   40|  5.65k|        if (result.ptr != userAgent.data() + posEnd) return false; // do not accept trailing chars
  ------------------
  |  Branch (40:13): [True: 3.03k, False: 2.62k]
  ------------------
   41|  2.62k|        if (minorVersion > 3) return false; // we target just Safari 15.0 - 15.3
  ------------------
  |  Branch (41:13): [True: 1.78k, False: 841]
  ------------------
   42|       |
   43|    841|        if (userAgent.find(" Safari/", posEnd) == std::string_view::npos) return false;
  ------------------
  |  Branch (43:13): [True: 635, False: 206]
  ------------------
   44|       |
   45|    206|        return true;
   46|    841|    }
_ZN3uWS12TemplatedAppILb0EE3getENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  457|  6.03k|    TemplatedApp &&get(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  458|  6.03k|        if (httpContext) {
  ------------------
  |  Branch (458:13): [True: 6.03k, False: 0]
  ------------------
  459|  6.03k|            httpContext->onHttp("GET", pattern, std::move(handler));
  460|  6.03k|        }
  461|  6.03k|        return std::move(*this);
  462|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE4postENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  464|  6.03k|    TemplatedApp &&post(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  465|  6.03k|        if (httpContext) {
  ------------------
  |  Branch (465:13): [True: 6.03k, False: 0]
  ------------------
  466|  6.03k|            httpContext->onHttp("POST", pattern, std::move(handler));
  467|  6.03k|        }
  468|  6.03k|        return std::move(*this);
  469|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE3anyENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEON5ofats13any_invocableIFvPNS_12HttpResponseILb0EEEPNS_11HttpRequestEEEE:
  521|  6.03k|    TemplatedApp &&any(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
  522|  6.03k|        if (httpContext) {
  ------------------
  |  Branch (522:13): [True: 6.03k, False: 0]
  ------------------
  523|  6.03k|            httpContext->onHttp("*", pattern, std::move(handler));
  524|  6.03k|        }
  525|  6.03k|        return std::move(*this);
  526|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE6listenEiON5ofats13any_invocableIFvP18us_listen_socket_tEEE:
  547|  6.03k|    TemplatedApp &&listen(int port, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler) {
  548|  6.03k|        handler(httpContext ? httpContext->listen(nullptr, port, 0) : nullptr);
  ------------------
  |  Branch (548:17): [True: 6.03k, False: 0]
  ------------------
  549|  6.03k|        return std::move(*this);
  550|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EEC2EOS1_:
  202|  6.03k|    TemplatedApp(TemplatedApp &&other) {
  203|       |        /* Move HttpContext */
  204|  6.03k|        httpContext = other.httpContext;
  205|  6.03k|        other.httpContext = nullptr;
  206|       |
  207|       |        /* Move webSocketContextDeleters */
  208|  6.03k|        webSocketContextDeleters = std::move(other.webSocketContextDeleters);
  209|       |
  210|  6.03k|        webSocketContexts = std::move(other.webSocketContexts);
  211|       |
  212|       |        /* Move TopicTree */
  213|  6.03k|        topicTree = other.topicTree;
  214|  6.03k|        other.topicTree = nullptr;
  215|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE13addServerNameENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_20SocketContextOptionsE:
   95|  6.03k|    TemplatedApp &&addServerName(std::string hostname_pattern, SocketContextOptions options = {}) {
   96|       |
   97|       |        /* Do nothing if not even on SSL */
   98|  6.03k|        if constexpr (SSL) {
  ------------------
  |  Branch (98:23): [Folded - Ignored]
  ------------------
   99|       |            /* First we create a new router for this domain */
  100|  6.03k|            auto *domainRouter = new HttpRouter<typename HttpContextData<SSL>::RouterData>();
  101|       |
  102|  6.03k|            us_socket_context_add_server_name(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str(), options, domainRouter);
  103|  6.03k|        }
  104|       |
  105|  6.03k|        return std::move(*this);
  106|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE16removeServerNameENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  108|  6.03k|    TemplatedApp &&removeServerName(std::string hostname_pattern) {
  109|       |    
  110|       |        /* This will do for now, would be better if us_socket_context_remove_server_name returned the user data */
  111|  6.03k|        auto *domainRouter = us_socket_context_find_server_name_userdata(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str());
  112|  6.03k|        if (domainRouter) {
  ------------------
  |  Branch (112:13): [True: 0, False: 6.03k]
  ------------------
  113|      0|            delete (HttpRouter<typename HttpContextData<SSL>::RouterData> *) domainRouter;
  114|      0|        }
  115|       |
  116|  6.03k|        us_socket_context_remove_server_name(SSL, (struct us_socket_context_t *) httpContext, hostname_pattern.c_str());
  117|  6.03k|        return std::move(*this);
  118|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE17missingServerNameEN5ofats13any_invocableIFvPKcEEE:
  120|  6.03k|    TemplatedApp &&missingServerName(MoveOnlyFunction<void(const char *hostname)> handler) {
  121|       |
  122|  6.03k|        if (!constructorFailed()) {
  ------------------
  |  Branch (122:13): [True: 6.03k, False: 0]
  ------------------
  123|  6.03k|            httpContext->getSocketContextData()->missingServerNameHandler = std::move(handler);
  124|       |
  125|  6.03k|            us_socket_context_on_server_name(SSL, (struct us_socket_context_t *) httpContext, [](struct us_socket_context_t *context, const char *hostname) {
  126|       |
  127|       |                /* This is the only requirements of being friends with HttpContextData */
  128|  6.03k|                HttpContext<SSL> *httpContext = (HttpContext<SSL> *) context;
  129|  6.03k|                httpContext->getSocketContextData()->missingServerNameHandler(hostname);
  130|  6.03k|            });
  131|  6.03k|        }
  132|       |
  133|  6.03k|        return std::move(*this);
  134|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE17constructorFailedEv:
  221|  6.03k|    bool constructorFailed() {
  222|  6.03k|        return !httpContext;
  223|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE15getNativeHandleEv:
  137|  6.03k|    void *getNativeHandle() {
  138|  6.03k|        return us_socket_context_get_native_handle(SSL, (struct us_socket_context_t *) httpContext);
  139|  6.03k|    }
_ZN3uWS12TemplatedAppILb0EE3runEv:
  570|  6.03k|    TemplatedApp &&run() {
  571|  6.03k|        uWS::run();
  572|  6.03k|        return std::move(*this);
  573|  6.03k|    }

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

_ZN3uWS15AsyncSocketDataILb0EEC2Ev:
   82|  2.12M|    AsyncSocketData() = default;
_ZN3uWS12BackPressureC2Ev:
   32|  2.12M|    BackPressure() = default;
_ZN3uWS12BackPressure6lengthEv:
   44|  1.45M|    size_t length() {
   45|  1.45M|        return buffer.length() - pendingRemoval;
   46|  1.45M|    }
_ZN3uWS12BackPressure4dataEv:
   57|   152k|    const char *data() {
   58|   152k|        return buffer.data() + pendingRemoval;
   59|   152k|    }
_ZN3uWS12BackPressure5eraseEj:
   36|   109k|    void erase(unsigned int length) {
   37|   109k|        pendingRemoval += length;
   38|       |        /* Always erase a minimum of 1/32th the current backpressure */
   39|   109k|        if (pendingRemoval > (buffer.length() >> 5)) {
  ------------------
  |  Branch (39:13): [True: 47.2k, False: 61.8k]
  ------------------
   40|  47.2k|            buffer.erase(0, pendingRemoval);
   41|  47.2k|            pendingRemoval = 0;
   42|  47.2k|        }
   43|   109k|    }
_ZN3uWS12BackPressure6appendEPKcm:
   33|   142k|    void append(const char *data, size_t length) {
   34|   142k|        buffer.append(data, length);
   35|   142k|    }
_ZN3uWS12BackPressure5clearEv:
   47|  3.82k|    void clear() {
   48|  3.82k|        pendingRemoval = 0;
   49|  3.82k|        buffer.clear();
   50|  3.82k|    }
_ZN3uWS12BackPressure11totalLengthEv:
   64|   112k|    size_t totalLength() {
   65|   112k|        return buffer.length();
   66|   112k|    }
_ZN3uWS12BackPressure6resizeEm:
   54|  19.7k|    void resize(size_t length) {
   55|  19.7k|        buffer.resize(length + pendingRemoval);
   56|  19.7k|    }
_ZN3uWS12BackPressureC2EOS0_:
   28|  67.1k|    BackPressure(BackPressure &&other) {
   29|  67.1k|        buffer = std::move(other.buffer);
   30|  67.1k|        pendingRemoval = other.pendingRemoval;
   31|  67.1k|    }
_ZN3uWS15AsyncSocketDataILb0EEC2EONS_12BackPressureE:
   77|  33.5k|    AsyncSocketData(BackPressure &&backpressure) : buffer(std::move(backpressure)) {
   78|       |
   79|  33.5k|    }

_ZN3uWS11BloomFilter5resetEv:
   75|  51.0k|    void reset() {
   76|  51.0k|        filter.reset();
   77|  51.0k|    }
_ZN3uWS11BloomFilter3addENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   64|   124k|    void add(std::string_view key) {
   65|   124k|        if (key.length() >= 2) {
  ------------------
  |  Branch (65:13): [True: 116k, False: 7.88k]
  ------------------
   66|   116k|            ScrambleArea s = getFeatures(key);
   67|   116k|            s.val = perfectHash(s.val);
   68|   116k|            filter[s.p[0]] = 1;
   69|   116k|            filter[s.p[1]] = 1;
   70|   116k|            filter[s.p[2]] = 1;
   71|   116k|            filter[s.p[3]] = 1;
   72|   116k|        }
   73|   124k|    }
_ZN3uWS11BloomFilter11getFeaturesENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   41|   536k|    ScrambleArea getFeatures(std::string_view key) {
   42|   536k|        ScrambleArea s;
   43|   536k|        s.p[0] = reinterpret_cast<const unsigned char&>(key[0]);
   44|   536k|        s.p[1] = reinterpret_cast<const unsigned char&>(key[key.length() - 1]);
   45|   536k|        s.p[2] = reinterpret_cast<const unsigned char&>(key[key.length() - 2]);
   46|   536k|        s.p[3] = reinterpret_cast<const unsigned char&>(key[key.length() >> 1]);
   47|   536k|        return s;
   48|   536k|    }
_ZN3uWS11BloomFilter11perfectHashEj:
   32|   536k|    static inline uint32_t perfectHash(uint32_t features) {
   33|   536k|        return features *= 1843993368;
   34|   536k|    }
_ZN3uWS11BloomFilter9mightHaveENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   51|   420k|    bool mightHave(std::string_view key) {
   52|   420k|        if (key.length() < 2) {
  ------------------
  |  Branch (52:13): [True: 0, False: 420k]
  ------------------
   53|      0|            return true;
   54|      0|        }
   55|       |    
   56|   420k|        ScrambleArea s = getFeatures(key);
   57|   420k|        s.val = perfectHash(s.val);
   58|   420k|        return filter[s.p[0]] &&
  ------------------
  |  Branch (58:16): [True: 176k, False: 243k]
  ------------------
   59|   420k|        filter[s.p[1]] &&
  ------------------
  |  Branch (59:9): [True: 109k, False: 67.0k]
  ------------------
   60|   420k|        filter[s.p[2]] &&
  ------------------
  |  Branch (60:9): [True: 107k, False: 1.86k]
  ------------------
   61|   420k|        filter[s.p[3]];
  ------------------
  |  Branch (61:9): [True: 107k, False: 419]
  ------------------
   62|   420k|    }

_ZN3uWS24isParsingChunkedEncodingEj:
   95|  35.9k|    inline bool isParsingChunkedEncoding(unsigned int state) {
   96|  35.9k|        return state & ~STATE_SIZE_MASK;
   97|  35.9k|    }
_ZN3uWS13ChunkIteratorC2EPNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEPjb:
  201|  36.9k|        ChunkIterator(std::string_view *data, unsigned int *state, bool trailer = false) : data(data), state(state), trailer(trailer) {
  202|  36.9k|            chunk = uWS::getNextChunk(*data, *state, trailer);
  203|  36.9k|        }
EpollHelloWorld.cpp:_ZN3uWSL12getNextChunkERNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERjb:
  104|  72.4k|    static std::optional<std::string_view> getNextChunk(std::string_view &data, unsigned int &state, bool trailer = false) {
  105|       |
  106|  77.1k|        while (data.length()) {
  ------------------
  |  Branch (106:16): [True: 41.9k, False: 35.2k]
  ------------------
  107|       |
  108|       |            // if in "drop trailer mode", just drop up to what we have as size
  109|  41.9k|            if (((state & STATE_IS_CHUNKED) == 0) && hasChunkSize(state) && chunkSize(state)) {
  ------------------
  |  Branch (109:17): [True: 1.00k, False: 40.9k]
  |  Branch (109:54): [True: 1.00k, False: 0]
  |  Branch (109:77): [True: 1.00k, False: 0]
  ------------------
  110|       |
  111|       |                //printf("Parsing trailer now\n");
  112|       |
  113|  1.99k|                while(data.length() && chunkSize(state)) {
  ------------------
  |  Branch (113:23): [True: 1.51k, False: 472]
  |  Branch (113:40): [True: 1.51k, False: 0]
  ------------------
  114|  1.51k|                    data.remove_prefix(1);
  115|  1.51k|                    decChunkSize(state, 1);
  116|       |
  117|  1.51k|                    if (chunkSize(state) == 0) {
  ------------------
  |  Branch (117:25): [True: 534, False: 984]
  ------------------
  118|       |
  119|       |                        /* This is an actual place where we need 0 as state */
  120|    534|                        state = 0;
  121|       |
  122|       |                        /* The parser MUST stop consuming here */
  123|    534|                        return std::nullopt;
  124|    534|                    }
  125|  1.51k|                }
  126|    472|                continue;
  127|  1.00k|            }
  128|       |
  129|  40.9k|            if (!hasChunkSize(state)) {
  ------------------
  |  Branch (129:17): [True: 5.91k, False: 35.0k]
  ------------------
  130|  5.91k|                consumeHexNumber(data, state);
  131|  5.91k|                if (isParsingInvalidChunkedEncoding(state)) {
  ------------------
  |  Branch (131:21): [True: 1.04k, False: 4.87k]
  ------------------
  132|  1.04k|                    return std::nullopt;
  133|  1.04k|                }
  134|  4.87k|                if (hasChunkSize(state) && chunkSize(state) == 2) {
  ------------------
  |  Branch (134:21): [True: 3.35k, False: 1.51k]
  |  Branch (134:44): [True: 1.01k, False: 2.33k]
  ------------------
  135|       |
  136|       |                    //printf("Setting state to trailer-parsing and emitting empty chunk\n");
  137|       |
  138|       |                    // set trailer state and increase size to 4
  139|  1.01k|                    if (trailer) {
  ------------------
  |  Branch (139:25): [True: 0, False: 1.01k]
  ------------------
  140|      0|                        state = 4 /*| STATE_IS_CHUNKED*/ | STATE_HAS_SIZE;
  141|  1.01k|                    } else {
  142|  1.01k|                        state = 2 /*| STATE_IS_CHUNKED*/ | STATE_HAS_SIZE;
  143|  1.01k|                    }
  144|       |
  145|  1.01k|                    return std::string_view(nullptr, 0);
  146|  1.01k|                }
  147|  3.85k|                continue;
  148|  4.87k|            }
  149|       |
  150|       |            // do we have data to emit all?
  151|  35.0k|            if (data.length() >= chunkSize(state)) {
  ------------------
  |  Branch (151:17): [True: 1.76k, False: 33.2k]
  ------------------
  152|       |                // emit all but 2 bytes then reset state to 0 and goto beginning
  153|       |                // not fin
  154|  1.76k|                std::string_view emitSoon;
  155|  1.76k|                bool shouldEmit = false;
  156|  1.76k|                if (chunkSize(state) > 2) {
  ------------------
  |  Branch (156:21): [True: 1.39k, False: 362]
  ------------------
  157|  1.39k|                    emitSoon = std::string_view(data.data(), chunkSize(state) - 2);
  158|  1.39k|                    shouldEmit = true;
  159|  1.39k|                }
  160|  1.76k|                data.remove_prefix(chunkSize(state));
  161|  1.76k|                state = STATE_IS_CHUNKED;
  162|  1.76k|                if (shouldEmit) {
  ------------------
  |  Branch (162:21): [True: 1.39k, False: 362]
  ------------------
  163|  1.39k|                    return emitSoon;
  164|  1.39k|                }
  165|    362|                continue;
  166|  33.2k|            } else {
  167|       |                /* We will consume all our input data */
  168|  33.2k|                std::string_view emitSoon;
  169|  33.2k|                if (chunkSize(state) > 2) {
  ------------------
  |  Branch (169:21): [True: 33.0k, False: 194]
  ------------------
  170|  33.0k|                    unsigned int maximalAppEmit = chunkSize(state) - 2;
  171|  33.0k|                    if (data.length() > maximalAppEmit) {
  ------------------
  |  Branch (171:25): [True: 287, False: 32.8k]
  ------------------
  172|    287|                        emitSoon = data.substr(0, maximalAppEmit);
  173|  32.8k|                    } else {
  174|       |                        //cb(data);
  175|  32.8k|                        emitSoon = data;
  176|  32.8k|                    }
  177|  33.0k|                }
  178|  33.2k|                decChunkSize(state, (unsigned int) data.length());
  179|  33.2k|                state |= STATE_IS_CHUNKED;
  180|       |                // new: decrease data by its size (bug)
  181|  33.2k|                data.remove_prefix(data.length()); // ny bug fix för getNextChunk
  182|  33.2k|                if (emitSoon.length()) {
  ------------------
  |  Branch (182:21): [True: 33.0k, False: 194]
  ------------------
  183|  33.0k|                    return emitSoon;
  184|  33.0k|                } else {
  185|    194|                    return std::nullopt;
  186|    194|                }
  187|  33.2k|            }
  188|  35.0k|        }
  189|       |
  190|  35.2k|        return std::nullopt;
  191|  72.4k|    }
_ZN3uWS12hasChunkSizeEj:
   90|  46.8k|    inline bool hasChunkSize(unsigned int state) {
   91|  46.8k|        return state & STATE_HAS_SIZE;
   92|  46.8k|    }
_ZN3uWS9chunkSizeEj:
   38|   155k|    inline unsigned int chunkSize(unsigned int state) {
   39|   155k|        return state & STATE_SIZE_MASK;
   40|   155k|    }
_ZN3uWS12decChunkSizeERjj:
   81|  34.8k|    inline void decChunkSize(unsigned int &state, unsigned int by) {
   82|       |
   83|       |        //unsigned int bits = state & STATE_IS_CHUNKED;
   84|       |
   85|  34.8k|        state = (state & ~STATE_SIZE_MASK) | (chunkSize(state) - by);
   86|       |
   87|       |        //state |= bits;
   88|  34.8k|    }
_ZN3uWS16consumeHexNumberERNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERj:
   43|  5.91k|    inline void consumeHexNumber(std::string_view &data, unsigned int &state) {
   44|       |        /* Consume everything higher than 32 */
   45|  12.9k|        while (data.length() && data.data()[0] > 32) {
  ------------------
  |  Branch (45:16): [True: 12.0k, False: 878]
  |  Branch (45:33): [True: 8.10k, False: 3.99k]
  ------------------
   46|       |
   47|  8.10k|            unsigned char digit = (unsigned char)data.data()[0];
   48|  8.10k|            if (digit >= 'a') {
  ------------------
  |  Branch (48:17): [True: 3.58k, False: 4.51k]
  ------------------
   49|  3.58k|                digit = (unsigned char) (digit - ('a' - ':'));
   50|  4.51k|            } else if (digit >= 'A') {
  ------------------
  |  Branch (50:24): [True: 1.62k, False: 2.89k]
  ------------------
   51|  1.62k|                digit = (unsigned char) (digit - ('A' - ':'));
   52|  1.62k|            }
   53|       |
   54|  8.10k|            unsigned int number = ((unsigned int) digit - (unsigned int) '0');
   55|       |
   56|  8.10k|            if (number > 16 || (chunkSize(state) & STATE_SIZE_OVERFLOW)) {
  ------------------
  |  Branch (56:17): [True: 831, False: 7.26k]
  |  Branch (56:32): [True: 216, False: 7.05k]
  ------------------
   57|  1.04k|                state = STATE_IS_ERROR;
   58|  1.04k|                return;
   59|  1.04k|            }
   60|       |
   61|       |            // extract state bits
   62|  7.05k|            unsigned int bits = /*state &*/ STATE_IS_CHUNKED;
   63|       |
   64|  7.05k|            state = (state & STATE_SIZE_MASK) * 16u + number;
   65|       |
   66|  7.05k|            state |= bits;
   67|  7.05k|            data.remove_prefix(1);
   68|  7.05k|        }
   69|       |        /* Consume everything not /n */
   70|  13.9k|        while (data.length() && data.data()[0] != '\n') {
  ------------------
  |  Branch (70:16): [True: 12.4k, False: 1.51k]
  |  Branch (70:33): [True: 9.08k, False: 3.35k]
  ------------------
   71|  9.08k|            data.remove_prefix(1);
   72|  9.08k|        }
   73|       |        /* Now we stand on \n so consume it and enable size */
   74|  4.87k|        if (data.length()) {
  ------------------
  |  Branch (74:13): [True: 3.35k, False: 1.51k]
  ------------------
   75|  3.35k|            state += 2; // include the two last /r/n
   76|  3.35k|            state |= STATE_HAS_SIZE | STATE_IS_CHUNKED;
   77|  3.35k|            data.remove_prefix(1);
   78|  3.35k|        }
   79|  4.87k|    }
_ZN3uWS13ChunkIterator5beginEv:
  209|  36.9k|        ChunkIterator begin() {
  210|  36.9k|            return *this;
  211|  36.9k|        }
_ZN3uWS13ChunkIterator3endEv:
  213|  36.9k|        ChunkIterator end() {
  214|  36.9k|            return ChunkIterator();
  215|  36.9k|        }
_ZN3uWS13ChunkIteratorC2Ev:
  205|  36.9k|        ChunkIterator() {
  206|       |
  207|  36.9k|        }
_ZNK3uWS13ChunkIteratorneERKS0_:
  224|  72.4k|        bool operator!=(const ChunkIterator &other) const {
  225|  72.4k|            return other.chunk.has_value() != chunk.has_value();
  226|  72.4k|        }
_ZN3uWS13ChunkIteratordeEv:
  217|  35.5k|        std::string_view operator*() {
  218|  35.5k|            if (!chunk.has_value()) {
  ------------------
  |  Branch (218:17): [True: 0, False: 35.5k]
  ------------------
  219|      0|                std::abort();
  220|      0|            }
  221|  35.5k|            return chunk.value();
  222|  35.5k|        }
_ZN3uWS13ChunkIteratorppEv:
  228|  35.5k|        ChunkIterator &operator++() {
  229|  35.5k|            chunk = uWS::getNextChunk(*data, *state, trailer);
  230|  35.5k|            return *this;
  231|  35.5k|        }
_ZN3uWS31isParsingInvalidChunkedEncodingEj:
   99|  42.8k|    inline bool isParsingInvalidChunkedEncoding(unsigned int state) {
  100|  42.8k|        return state == STATE_IS_ERROR;
  101|  42.8k|    }

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

_ZN3uWS10HttpParser17consumePostPaddedEPcjPvS2_ON5ofats13any_invocableIFS2_S2_PNS_11HttpRequestEEEEONS4_IFS2_S2_NSt3__117basic_string_viewIcNSA_11char_traitsIcEEEEbEEE:
  527|   368k|    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) {
  528|       |
  529|       |        /* This resets BloomFilter by construction, but later we also reset it again.
  530|       |         * Optimize this to skip resetting twice (req could be made global) */
  531|   368k|        HttpRequest req;
  532|       |
  533|   368k|        if (remainingStreamingBytes) {
  ------------------
  |  Branch (533:13): [True: 34.7k, False: 333k]
  ------------------
  534|       |
  535|       |            /* It's either chunked or with a content-length */
  536|  34.7k|            if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (536:17): [True: 33.7k, False: 1.00k]
  ------------------
  537|  33.7k|                std::string_view dataToConsume(data, length);
  538|  33.7k|                for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (538:33): [True: 32.7k, False: 33.7k]
  ------------------
  539|  32.7k|                    dataHandler(user, chunk, chunk.length() == 0);
  540|  32.7k|                }
  541|  33.7k|                if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (541:21): [True: 399, False: 33.3k]
  ------------------
  542|    399|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  543|    399|                }
  544|  33.3k|                data = (char *) dataToConsume.data();
  545|  33.3k|                length = (unsigned int) dataToConsume.length();
  546|  33.3k|            } else {
  547|       |                // this is exactly the same as below!
  548|       |                // todo: refactor this
  549|  1.00k|                if (remainingStreamingBytes >= length) {
  ------------------
  |  Branch (549:21): [True: 810, False: 195]
  ------------------
  550|    810|                    void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
  551|    810|                    remainingStreamingBytes -= length;
  552|    810|                    return {0, returnedUser};
  553|    810|                } else {
  554|    195|                    void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  555|       |
  556|    195|                    data += remainingStreamingBytes;
  557|    195|                    length -= remainingStreamingBytes;
  558|       |
  559|    195|                    remainingStreamingBytes = 0;
  560|       |
  561|    195|                    if (returnedUser != user) {
  ------------------
  |  Branch (561:25): [True: 0, False: 195]
  ------------------
  562|      0|                        return {0, returnedUser};
  563|      0|                    }
  564|    195|                }
  565|  1.00k|            }
  566|       |
  567|   333k|        } else if (fallback.length()) {
  ------------------
  |  Branch (567:20): [True: 14.6k, False: 319k]
  ------------------
  568|  14.6k|            unsigned int had = (unsigned int) fallback.length();
  569|       |
  570|  14.6k|            size_t maxCopyDistance = std::min<size_t>(MAX_FALLBACK_SIZE - fallback.length(), (size_t) length);
  571|       |
  572|       |            /* We don't want fallback to be short string optimized, since we want to move it */
  573|  14.6k|            fallback.reserve(fallback.length() + maxCopyDistance + std::max<unsigned int>(MINIMUM_HTTP_POST_PADDING, sizeof(std::string)));
  574|  14.6k|            fallback.append(data, maxCopyDistance);
  575|       |
  576|       |            // break here on break
  577|  14.6k|            std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<true>(fallback.data(), (unsigned int) fallback.length(), user, reserved, &req, requestHandler, dataHandler);
  578|  14.6k|            if (consumed.second != user) {
  ------------------
  |  Branch (578:17): [True: 4.56k, False: 10.1k]
  ------------------
  579|  4.56k|                return consumed;
  580|  4.56k|            }
  581|       |
  582|  10.1k|            if (consumed.first) {
  ------------------
  |  Branch (582:17): [True: 2.16k, False: 7.94k]
  ------------------
  583|       |
  584|       |                /* This logic assumes that we consumed everything in fallback buffer.
  585|       |                 * This is critically important, as we will get an integer overflow in case
  586|       |                 * of "had" being larger than what we consumed, and that we would drop data */
  587|  2.16k|                fallback.clear();
  588|  2.16k|                data += consumed.first - had;
  589|  2.16k|                length -= consumed.first - had;
  590|       |
  591|  2.16k|                if (remainingStreamingBytes) {
  ------------------
  |  Branch (591:21): [True: 1.18k, False: 983]
  ------------------
  592|       |                    /* It's either chunked or with a content-length */
  593|  1.18k|                    if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (593:25): [True: 665, False: 516]
  ------------------
  594|    665|                        std::string_view dataToConsume(data, length);
  595|    665|                        for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (595:41): [True: 500, False: 665]
  ------------------
  596|    500|                            dataHandler(user, chunk, chunk.length() == 0);
  597|    500|                        }
  598|    665|                        if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (598:29): [True: 200, False: 465]
  ------------------
  599|    200|                            return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  600|    200|                        }
  601|    465|                        data = (char *) dataToConsume.data();
  602|    465|                        length = (unsigned int) dataToConsume.length();
  603|    516|                    } else {
  604|       |                        // this is exactly the same as above!
  605|    516|                        if (remainingStreamingBytes >= (unsigned int) length) {
  ------------------
  |  Branch (605:29): [True: 310, False: 206]
  ------------------
  606|    310|                            void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
  607|    310|                            remainingStreamingBytes -= length;
  608|    310|                            return {0, returnedUser};
  609|    310|                        } else {
  610|    206|                            void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  611|       |
  612|    206|                            data += remainingStreamingBytes;
  613|    206|                            length -= remainingStreamingBytes;
  614|       |
  615|    206|                            remainingStreamingBytes = 0;
  616|       |
  617|    206|                            if (returnedUser != user) {
  ------------------
  |  Branch (617:33): [True: 0, False: 206]
  ------------------
  618|      0|                                return {0, returnedUser};
  619|      0|                            }
  620|    206|                        }
  621|    516|                    }
  622|  1.18k|                }
  623|       |
  624|  7.94k|            } else {
  625|  7.94k|                if (fallback.length() == MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (625:21): [True: 195, False: 7.75k]
  ------------------
  626|    195|                    return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  627|    195|                }
  628|  7.75k|                return {0, user};
  629|  7.94k|            }
  630|  10.1k|        }
  631|       |
  632|   354k|        std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<false>(data, length, user, reserved, &req, requestHandler, dataHandler);
  633|   354k|        if (consumed.second != user) {
  ------------------
  |  Branch (633:13): [True: 307k, False: 47.0k]
  ------------------
  634|   307k|            return consumed;
  635|   307k|        }
  636|       |
  637|  47.0k|        data += consumed.first;
  638|  47.0k|        length -= consumed.first;
  639|       |
  640|  47.0k|        if (length) {
  ------------------
  |  Branch (640:13): [True: 9.22k, False: 37.8k]
  ------------------
  641|  9.22k|            if (length < MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (641:17): [True: 9.22k, False: 0]
  ------------------
  642|  9.22k|                fallback.append(data, length);
  643|  9.22k|            } else {
  644|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  645|      0|            }
  646|  9.22k|        }
  647|       |
  648|       |        // added for now
  649|  47.0k|        return {0, user};
  650|  47.0k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi1EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|  14.6k|    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) {
  398|       |
  399|       |        /* How much data we CONSUMED (to throw away) */
  400|  14.6k|        unsigned int consumedTotal = 0;
  401|  14.6k|        unsigned int err = 0;
  402|       |
  403|       |        /* Fence two bytes past end of our buffer (buffer has post padded margins).
  404|       |         * This is to always catch scan for \r but not for \r\n. */
  405|  14.6k|        data[length] = '\r';
  406|  14.6k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|  14.6k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 14.6k, False: 0]
  |  Branch (408:47): [True: 6.72k, False: 7.94k]
  ------------------
  409|  6.72k|            data += consumed;
  410|  6.72k|            length -= consumed;
  411|  6.72k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|  6.72k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|  6.72k|            req->bf.reset();
  418|  31.3k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 24.6k, False: 6.72k]
  ------------------
  419|  24.6k|                req->bf.add(h->key);
  420|  24.6k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|  6.72k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 432, False: 6.29k]
  ------------------
  424|    432|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    432|            }
  426|       |
  427|       |            /* RFC 9112 6.3
  428|       |            * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  429|       |            * the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt
  430|       |            * to perform request smuggling (Section 11.2) or response splitting (Section 11.1) and
  431|       |            * ought to be handled as an error. */
  432|  6.29k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|  6.29k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|  6.29k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 876, False: 5.41k]
  |  Branch (434:52): [True: 204, False: 672]
  ------------------
  435|       |                /* Returning fullptr is the same as calling the errorHandler */
  436|       |                /* We could be smart and set an error in the context along with this, to indicate what 
  437|       |                 * http error response we might want to return */
  438|    204|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|    204|            }
  440|       |
  441|       |            /* Parse query */
  442|  6.08k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|  6.08k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 473, False: 5.61k]
  ------------------
  444|       |
  445|       |            /* If returned socket is not what we put in we need
  446|       |             * to break here as we either have upgraded to
  447|       |             * WebSockets or otherwise closed the socket. */
  448|  6.08k|            void *returnedUser = requestHandler(user, req);
  449|  6.08k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 3.51k, False: 2.57k]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|  3.51k|                return {consumedTotal, returnedUser};
  452|  3.51k|            }
  453|       |
  454|       |            /* The rules at play here according to RFC 9112 for requests are essentially:
  455|       |             * If both content-length and transfer-encoding then invalid message; must break.
  456|       |             * If has transfer-encoding then must be chunked regardless of value.
  457|       |             * If content-length then fixed length even if 0.
  458|       |             * If none of the above then fixed length is 0. */
  459|       |
  460|       |            /* RFC 9112 6.3
  461|       |             * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  462|       |             * the Transfer-Encoding overrides the Content-Length. */
  463|  2.57k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 665, False: 1.91k]
  ------------------
  464|       |
  465|       |                /* If a proxy sent us the transfer-encoding header that 100% means it must be chunked or else the proxy is
  466|       |                 * not RFC 9112 compliant. Therefore it is always better to assume this is the case, since that entirely eliminates 
  467|       |                 * all forms of transfer-encoding obfuscation tricks. We just rely on the header. */
  468|       |
  469|       |                /* RFC 9112 6.3
  470|       |                 * If a Transfer-Encoding header field is present in a request and the chunked transfer coding is not the
  471|       |                 * final encoding, the message body length cannot be determined reliably; the server MUST respond with the
  472|       |                 * 400 (Bad Request) status code and then close the connection. */
  473|       |
  474|       |                /* In this case we fail later by having the wrong interpretation (assuming chunked).
  475|       |                 * This could be made stricter but makes no difference either way, unless forwarding the identical message as a proxy. */
  476|       |
  477|    665|                remainingStreamingBytes = STATE_IS_CHUNKED;
  478|       |                /* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */
  479|    665|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (479:21): [Folded - Ignored]
  ------------------
  480|       |                    /* Go ahead and parse it (todo: better heuristics for emitting FIN to the app level) */
  481|      0|                    std::string_view dataToConsume(data, length);
  482|      0|                    for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (482:37): [True: 0, False: 0]
  ------------------
  483|      0|                        dataHandler(user, chunk, chunk.length() == 0);
  484|      0|                    }
  485|      0|                    if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (485:25): [True: 0, False: 0]
  ------------------
  486|      0|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  487|      0|                    }
  488|      0|                    unsigned int consumed = (length - (unsigned int) dataToConsume.length());
  489|      0|                    data = (char *) dataToConsume.data();
  490|      0|                    length = (unsigned int) dataToConsume.length();
  491|      0|                    consumedTotal += consumed;
  492|      0|                }
  493|  1.91k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 1.12k, False: 786]
  ------------------
  494|  1.12k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|  1.12k|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 414, False: 713]
  ------------------
  496|       |                    /* Parser error */
  497|    414|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|    414|                }
  499|       |
  500|    713|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (500:21): [Folded - Ignored]
  ------------------
  501|      0|                    unsigned int emittable = std::min<unsigned int>(remainingStreamingBytes, length);
  502|      0|                    dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
  503|      0|                    remainingStreamingBytes -= emittable;
  504|       |
  505|      0|                    data += emittable;
  506|      0|                    length -= emittable;
  507|      0|                    consumedTotal += emittable;
  508|      0|                }
  509|    786|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|    786|                dataHandler(user, {}, true);
  512|    786|            }
  513|       |
  514|       |            /* Consume minimally should break as easrly as possible */
  515|  2.16k|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (515:17): [Folded - Ignored]
  ------------------
  516|  2.16k|                break;
  517|  2.16k|            }
  518|  2.16k|        }
  519|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  520|  10.1k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 0, False: 10.1k]
  ------------------
  521|      0|            return {err, FULLPTR};
  522|      0|        }
  523|  10.1k|        return {consumedTotal, user};
  524|  10.1k|    }
_ZN3uWS10HttpParser10getHeadersEPcS1_PNS_11HttpRequest6HeaderEPvRj:
  286|   341k|    static unsigned int getHeaders(char *postPaddedBuffer, char *end, struct HttpRequest::Header *headers, void *reserved, unsigned int &err) {
  287|   341k|        char *preliminaryKey, *preliminaryValue, *start = postPaddedBuffer;
  288|       |
  289|       |        #ifdef UWS_WITH_PROXY
  290|       |            /* ProxyParser is passed as reserved parameter */
  291|       |            ProxyParser *pp = (ProxyParser *) reserved;
  292|       |
  293|       |            /* Parse PROXY protocol */
  294|       |            auto [done, offset] = pp->parse({postPaddedBuffer, (size_t) (end - postPaddedBuffer)});
  295|       |            if (!done) {
  296|       |                /* We do not reset the ProxyParser (on filure) since it is tied to this
  297|       |                * connection, which is really only supposed to ever get one PROXY frame
  298|       |                * anyways. We do however allow multiple PROXY frames to be sent (overwrites former). */
  299|       |                return 0;
  300|       |            } else {
  301|       |                /* We have consumed this data so skip it */
  302|       |                postPaddedBuffer += offset;
  303|       |            }
  304|       |        #else
  305|       |            /* This one is unused */
  306|   341k|            (void) reserved;
  307|   341k|            (void) end;
  308|   341k|        #endif
  309|       |
  310|       |        /* It is critical for fallback buffering logic that we only return with success
  311|       |         * if we managed to parse a complete HTTP request (minus data). Returning success
  312|       |         * for PROXY means we can end up succeeding, yet leaving bytes in the fallback buffer
  313|       |         * which is then removed, and our counters to flip due to overflow and we end up with a crash */
  314|       |
  315|       |        /* The request line is different from the field names / field values */
  316|   341k|        if (!(postPaddedBuffer = consumeRequestLine(postPaddedBuffer, headers[0]))) {
  ------------------
  |  Branch (316:13): [True: 273k, False: 68.1k]
  ------------------
  317|       |            /* Error - invalid request line */
  318|       |            /* Assuming it is 505 HTTP Version Not Supported */
  319|   273k|            err = HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED;
  320|   273k|            return 0;
  321|   273k|        }
  322|  68.1k|        headers++;
  323|       |
  324|   169k|        for (unsigned int i = 1; i < HttpRequest::MAX_HEADERS - 1; i++) {
  ------------------
  |  Branch (324:34): [True: 169k, False: 194]
  ------------------
  325|       |            /* Lower case and consume the field name */
  326|   169k|            preliminaryKey = postPaddedBuffer;
  327|   169k|            postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
  328|   169k|            headers->key = std::string_view(preliminaryKey, (size_t) (postPaddedBuffer - preliminaryKey));
  329|       |
  330|       |            /* We should not accept whitespace between key and colon, so colon must foloow immediately */
  331|   169k|            if (postPaddedBuffer[0] != ':') {
  ------------------
  |  Branch (331:17): [True: 7.15k, False: 162k]
  ------------------
  332|       |                /* Error: invalid chars in field name */
  333|  7.15k|                return 0;
  334|  7.15k|            }
  335|   162k|            postPaddedBuffer++;
  336|       |
  337|   162k|            preliminaryValue = postPaddedBuffer;
  338|       |            /* The goal of this call is to find next "\r\n", or any invalid field value chars, fast */
  339|   163k|            while (true) {
  ------------------
  |  Branch (339:20): [Folded - Ignored]
  ------------------
  340|   163k|                postPaddedBuffer = (char *) tryConsumeFieldValue(postPaddedBuffer);
  341|       |                /* If this is not CR then we caught some stinky invalid char on the way */
  342|   163k|                if (postPaddedBuffer[0] != '\r') {
  ------------------
  |  Branch (342:21): [True: 1.96k, False: 161k]
  ------------------
  343|       |                    /* If TAB then keep searching */
  344|  1.96k|                    if (postPaddedBuffer[0] == '\t') {
  ------------------
  |  Branch (344:25): [True: 1.03k, False: 925]
  ------------------
  345|  1.03k|                        postPaddedBuffer++;
  346|  1.03k|                        continue;
  347|  1.03k|                    }
  348|       |                    /* Error - invalid chars in field value */
  349|    925|                    return 0;
  350|  1.96k|                }
  351|   161k|                break;
  352|   163k|            }
  353|       |            /* We fence end[0] with \r, followed by end[1] being something that is "not \n", to signify "not found".
  354|       |                * This way we can have this one single check to see if we found \r\n WITHIN our allowed search space. */
  355|   161k|            if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (355:17): [True: 153k, False: 7.32k]
  ------------------
  356|       |                /* Store this header, it is valid */
  357|   153k|                headers->value = std::string_view(preliminaryValue, (size_t) (postPaddedBuffer - preliminaryValue));
  358|   153k|                postPaddedBuffer += 2;
  359|       |
  360|       |                /* Trim trailing whitespace (SP, HTAB) */
  361|   180k|                while (headers->value.length() && headers->value.back() < 33) {
  ------------------
  |  Branch (361:24): [True: 134k, False: 46.0k]
  |  Branch (361:51): [True: 26.6k, False: 107k]
  ------------------
  362|  26.6k|                    headers->value.remove_suffix(1);
  363|  26.6k|                }
  364|       |
  365|       |                /* Trim initial whitespace (SP, HTAB) */
  366|   184k|                while (headers->value.length() && headers->value.front() < 33) {
  ------------------
  |  Branch (366:24): [True: 138k, False: 46.0k]
  |  Branch (366:51): [True: 30.8k, False: 107k]
  ------------------
  367|  30.8k|                    headers->value.remove_prefix(1);
  368|  30.8k|                }
  369|       |                
  370|   153k|                headers++;
  371|       |
  372|       |                /* We definitely have at least one header (or request line), so check if we are done */
  373|   153k|                if (*postPaddedBuffer == '\r') {
  ------------------
  |  Branch (373:21): [True: 52.5k, False: 101k]
  ------------------
  374|  52.5k|                    if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (374:25): [True: 51.0k, False: 1.57k]
  ------------------
  375|       |                        /* This cann take the very last header space */
  376|  51.0k|                        headers->key = std::string_view(nullptr, 0);
  377|  51.0k|                        return (unsigned int) ((postPaddedBuffer + 2) - start);
  378|  51.0k|                    } else {
  379|       |                        /* \r\n\r plus non-\n letter is malformed request, or simply out of search space */
  380|  1.57k|                        return 0;
  381|  1.57k|                    }
  382|  52.5k|                }
  383|   153k|            } else {
  384|       |                /* We are either out of search space or this is a malformed request */
  385|  7.32k|                return 0;
  386|  7.32k|            }
  387|   161k|        }
  388|       |        /* We ran out of header space, too large request */
  389|    194|        return 0;
  390|  68.1k|    }
_ZN3uWS10HttpParser18consumeRequestLineEPcRNS_11HttpRequest6HeaderE:
  242|   341k|    static inline char *consumeRequestLine(char *data, HttpRequest::Header &header) {
  243|       |        /* Scan until single SP, assume next is / (origin request) */
  244|   341k|        char *start = data;
  245|       |        /* This catches the post padded CR and fails */
  246|   659k|        while (data[0] > 32) data++;
  ------------------
  |  Branch (246:16): [True: 318k, False: 341k]
  ------------------
  247|   341k|        if (data[0] == 32 && data[1] == '/') {
  ------------------
  |  Branch (247:13): [True: 73.4k, False: 268k]
  |  Branch (247:30): [True: 70.8k, False: 2.65k]
  ------------------
  248|  70.8k|            header.key = {start, (size_t) (data - start)};
  249|  70.8k|            data++;
  250|       |            /* Scan for less than 33 (catches post padded CR and fails) */
  251|  70.8k|            start = data;
  252|   116k|            for (; true; data += 8) {
  ------------------
  |  Branch (252:20): [Folded - Ignored]
  ------------------
  253|   116k|                uint64_t word;
  254|   116k|                memcpy(&word, data, sizeof(uint64_t));
  255|   116k|                if (hasLess(word, 33)) {
  ------------------
  |  Branch (255:21): [True: 70.8k, False: 45.8k]
  ------------------
  256|   331k|                    while (*(unsigned char *)data > 32) data++;
  ------------------
  |  Branch (256:28): [True: 261k, False: 70.8k]
  ------------------
  257|       |                    /* Now we stand on space */
  258|  70.8k|                    header.value = {start, (size_t) (data - start)};
  259|       |                    /* Check that the following is http 1.1 */
  260|  70.8k|                    if (memcmp(" HTTP/1.1\r\n", data, 11) == 0) {
  ------------------
  |  Branch (260:25): [True: 68.1k, False: 2.65k]
  ------------------
  261|  68.1k|                        return data + 11;
  262|  68.1k|                    }
  263|  2.65k|                    return nullptr;
  264|  70.8k|                }
  265|   116k|            }
  266|  70.8k|        }
  267|   270k|        return nullptr;
  268|   341k|    }
_ZN3uWS10HttpParser7hasLessEmm:
  206|   839k|    static inline uint64_t hasLess(uint64_t x, uint64_t n) {
  207|   839k|        return (((x)-~0ULL/255*(n))&~(x)&~0ULL/255*128);
  208|   839k|    }
_ZN3uWS10HttpParser16consumeFieldNameEPc:
  226|   169k|    static inline void *consumeFieldName(char *p) {
  227|   304k|        for (; true; p += 8) {
  ------------------
  |  Branch (227:16): [Folded - Ignored]
  ------------------
  228|   304k|            uint64_t word;
  229|   304k|            memcpy(&word, p, sizeof(uint64_t));
  230|   304k|            if (notFieldNameWord(word)) {
  ------------------
  |  Branch (230:17): [True: 169k, False: 135k]
  ------------------
  231|   625k|                while (isFieldNameByte(*(unsigned char *)p)) {
  ------------------
  |  Branch (231:24): [True: 456k, False: 169k]
  ------------------
  232|   456k|                    *(p++) |= 0x20;
  233|   456k|                }
  234|   169k|                return (void *)p;
  235|   169k|            }
  236|   135k|            word |= 0x2020202020202020ull;
  237|   135k|            memcpy(p, &word, sizeof(uint64_t));
  238|   135k|        }
  239|   169k|    }
_ZN3uWS10HttpParser16notFieldNameWordEm:
  218|   304k|    static inline bool notFieldNameWord(uint64_t x) {
  219|   304k|        return hasLess(x, '-') |
  220|   304k|        hasBetween(x, '-', '0') |
  221|   304k|        hasBetween(x, '9', 'A') |
  222|   304k|        hasBetween(x, 'Z', 'a') |
  223|   304k|        hasMore(x, 'z');
  224|   304k|    }
_ZN3uWS10HttpParser10hasBetweenEmmm:
  214|   914k|    static inline uint64_t hasBetween(uint64_t x, uint64_t m, uint64_t n) {
  215|   914k|        return (( (~0ULL/255*(127+(n))-((x)&~0ULL/255*127)) &~(x)& (((x)&~0ULL/255*127)+~0ULL/255*(127-(m))) )&~0ULL/255*128);
  216|   914k|    }
_ZN3uWS10HttpParser7hasMoreEmm:
  210|   304k|    static inline uint64_t hasMore(uint64_t x, uint64_t n) {
  211|   304k|        return (( ((x)+~0ULL/255*(127-(n))) |(x))&~0ULL/255*128);
  212|   304k|    }
_ZN3uWS10HttpParser15isFieldNameByteEh:
  199|   625k|    static inline bool isFieldNameByte(unsigned char x) {
  200|   625k|        return (x == '-') |
  201|   625k|        ((x > '/') & (x < ':')) |
  202|   625k|        ((x > '@') & (x < '[')) |
  203|   625k|        ((x > 96) & (x < '{'));
  204|   625k|    }
_ZN3uWS10HttpParser20tryConsumeFieldValueEPc:
  274|   163k|    static inline void *tryConsumeFieldValue(char *p) {
  275|   418k|        for (; true; p += 8) {
  ------------------
  |  Branch (275:16): [Folded - Ignored]
  ------------------
  276|   418k|            uint64_t word;
  277|   418k|            memcpy(&word, p, sizeof(uint64_t));
  278|   418k|            if (hasLess(word, 32)) {
  ------------------
  |  Branch (278:17): [True: 163k, False: 255k]
  ------------------
  279|   429k|                while (*(unsigned char *)p > 31) p++;
  ------------------
  |  Branch (279:24): [True: 266k, False: 163k]
  ------------------
  280|   163k|                return (void *)p;
  281|   163k|            }
  282|   418k|        }
  283|   163k|    }
_ZN3uWS11HttpRequest9getHeaderENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  103|   420k|    std::string_view getHeader(std::string_view lowerCasedHeader) {
  104|   420k|        if (bf.mightHave(lowerCasedHeader)) {
  ------------------
  |  Branch (104:13): [True: 107k, False: 313k]
  ------------------
  105|   206k|            for (Header *h = headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (105:39): [True: 205k, False: 454]
  ------------------
  106|   205k|                if (h->key.length() == lowerCasedHeader.length() && !strncmp(h->key.data(), lowerCasedHeader.data(), lowerCasedHeader.length())) {
  ------------------
  |  Branch (106:21): [True: 109k, False: 96.1k]
  |  Branch (106:69): [True: 106k, False: 2.92k]
  ------------------
  107|   106k|                    return h->value;
  108|   106k|                }
  109|   205k|            }
  110|   107k|        }
  111|   313k|        return std::string_view(nullptr, 0);
  112|   420k|    }
_ZN3uWS10HttpParser17toUnsignedIntegerENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  178|  2.75k|    static unsigned int toUnsignedInteger(std::string_view str) {
  179|       |        /* We assume at least 32-bit integer giving us safely 999999999 (9 number of 9s) */
  180|  2.75k|        if (str.length() > 9) {
  ------------------
  |  Branch (180:13): [True: 402, False: 2.35k]
  ------------------
  181|    402|            return UINT_MAX;
  182|    402|        }
  183|       |
  184|  2.35k|        unsigned int unsignedIntegerValue = 0;
  185|  6.41k|        for (char c : str) {
  ------------------
  |  Branch (185:21): [True: 6.41k, False: 1.88k]
  ------------------
  186|       |            /* As long as the letter is 0-9 we cannot overflow. */
  187|  6.41k|            if (c < '0' || c > '9') {
  ------------------
  |  Branch (187:17): [True: 48, False: 6.36k]
  |  Branch (187:28): [True: 424, False: 5.93k]
  ------------------
  188|    472|                return UINT_MAX;
  189|    472|            }
  190|  5.93k|            unsignedIntegerValue = unsignedIntegerValue * 10u + ((unsigned int) c - (unsigned int) '0');
  191|  5.93k|        }
  192|  1.88k|        return unsignedIntegerValue;
  193|  2.35k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi0EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|   354k|    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) {
  398|       |
  399|       |        /* How much data we CONSUMED (to throw away) */
  400|   354k|        unsigned int consumedTotal = 0;
  401|   354k|        unsigned int err = 0;
  402|       |
  403|       |        /* Fence two bytes past end of our buffer (buffer has post padded margins).
  404|       |         * This is to always catch scan for \r but not for \r\n. */
  405|   354k|        data[length] = '\r';
  406|   354k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|   364k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 326k, False: 37.8k]
  |  Branch (408:47): [True: 44.2k, False: 282k]
  ------------------
  409|  44.2k|            data += consumed;
  410|  44.2k|            length -= consumed;
  411|  44.2k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|  44.2k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|  44.2k|            req->bf.reset();
  418|   143k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 99.6k, False: 44.2k]
  ------------------
  419|  99.6k|                req->bf.add(h->key);
  420|  99.6k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|  44.2k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 329, False: 43.9k]
  ------------------
  424|    329|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    329|            }
  426|       |
  427|       |            /* RFC 9112 6.3
  428|       |            * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  429|       |            * the Transfer-Encoding overrides the Content-Length. Such a message might indicate an attempt
  430|       |            * to perform request smuggling (Section 11.2) or response splitting (Section 11.1) and
  431|       |            * ought to be handled as an error. */
  432|  43.9k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|  43.9k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|  43.9k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 2.84k, False: 41.1k]
  |  Branch (434:52): [True: 238, False: 2.60k]
  ------------------
  435|       |                /* Returning fullptr is the same as calling the errorHandler */
  436|       |                /* We could be smart and set an error in the context along with this, to indicate what 
  437|       |                 * http error response we might want to return */
  438|    238|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|    238|            }
  440|       |
  441|       |            /* Parse query */
  442|  43.7k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|  43.7k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 12.3k, False: 31.3k]
  ------------------
  444|       |
  445|       |            /* If returned socket is not what we put in we need
  446|       |             * to break here as we either have upgraded to
  447|       |             * WebSockets or otherwise closed the socket. */
  448|  43.7k|            void *returnedUser = requestHandler(user, req);
  449|  43.7k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 32.5k, False: 11.1k]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|  32.5k|                return {consumedTotal, returnedUser};
  452|  32.5k|            }
  453|       |
  454|       |            /* The rules at play here according to RFC 9112 for requests are essentially:
  455|       |             * If both content-length and transfer-encoding then invalid message; must break.
  456|       |             * If has transfer-encoding then must be chunked regardless of value.
  457|       |             * If content-length then fixed length even if 0.
  458|       |             * If none of the above then fixed length is 0. */
  459|       |
  460|       |            /* RFC 9112 6.3
  461|       |             * If a message is received with both a Transfer-Encoding and a Content-Length header field,
  462|       |             * the Transfer-Encoding overrides the Content-Length. */
  463|  11.1k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 2.56k, False: 8.55k]
  ------------------
  464|       |
  465|       |                /* If a proxy sent us the transfer-encoding header that 100% means it must be chunked or else the proxy is
  466|       |                 * not RFC 9112 compliant. Therefore it is always better to assume this is the case, since that entirely eliminates 
  467|       |                 * all forms of transfer-encoding obfuscation tricks. We just rely on the header. */
  468|       |
  469|       |                /* RFC 9112 6.3
  470|       |                 * If a Transfer-Encoding header field is present in a request and the chunked transfer coding is not the
  471|       |                 * final encoding, the message body length cannot be determined reliably; the server MUST respond with the
  472|       |                 * 400 (Bad Request) status code and then close the connection. */
  473|       |
  474|       |                /* In this case we fail later by having the wrong interpretation (assuming chunked).
  475|       |                 * This could be made stricter but makes no difference either way, unless forwarding the identical message as a proxy. */
  476|       |
  477|  2.56k|                remainingStreamingBytes = STATE_IS_CHUNKED;
  478|       |                /* If consume minimally, we do not want to consume anything but we want to mark this as being chunked */
  479|  2.56k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (479:21): [Folded - Ignored]
  ------------------
  480|       |                    /* Go ahead and parse it (todo: better heuristics for emitting FIN to the app level) */
  481|  2.56k|                    std::string_view dataToConsume(data, length);
  482|  2.56k|                    for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (482:37): [True: 2.26k, False: 2.56k]
  ------------------
  483|  2.26k|                        dataHandler(user, chunk, chunk.length() == 0);
  484|  2.26k|                    }
  485|  2.56k|                    if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (485:25): [True: 448, False: 2.11k]
  ------------------
  486|    448|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  487|    448|                    }
  488|  2.11k|                    unsigned int consumed = (length - (unsigned int) dataToConsume.length());
  489|  2.11k|                    data = (char *) dataToConsume.data();
  490|  2.11k|                    length = (unsigned int) dataToConsume.length();
  491|  2.11k|                    consumedTotal += consumed;
  492|  2.11k|                }
  493|  8.55k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 1.63k, False: 6.92k]
  ------------------
  494|  1.63k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|  1.63k|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 460, False: 1.17k]
  ------------------
  496|       |                    /* Parser error */
  497|    460|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|    460|                }
  499|       |
  500|  1.17k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (500:21): [Folded - Ignored]
  ------------------
  501|  1.17k|                    unsigned int emittable = std::min<unsigned int>(remainingStreamingBytes, length);
  502|  1.17k|                    dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
  503|  1.17k|                    remainingStreamingBytes -= emittable;
  504|       |
  505|  1.17k|                    data += emittable;
  506|  1.17k|                    length -= emittable;
  507|  1.17k|                    consumedTotal += emittable;
  508|  1.17k|                }
  509|  6.92k|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|  6.92k|                dataHandler(user, {}, true);
  512|  6.92k|            }
  513|       |
  514|       |            /* Consume minimally should break as easrly as possible */
  515|  10.2k|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (515:17): [Folded - Ignored]
  ------------------
  516|      0|                break;
  517|      0|            }
  518|  10.2k|        }
  519|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  520|   320k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 273k, False: 47.0k]
  ------------------
  521|   273k|            return {err, FULLPTR};
  522|   273k|        }
  523|  47.0k|        return {consumedTotal, user};
  524|   320k|    }
_ZN3uWS11HttpRequest9isAncientEv:
   60|  49.6k|    bool isAncient() {
   61|  49.6k|        return ancientHttp;
   62|  49.6k|    }
_ZN3uWS11HttpRequest22getCaseSensitiveMethodEv:
  123|  49.6k|    std::string_view getCaseSensitiveMethod() {
  124|  49.6k|        return std::string_view(headers->key.data(), headers->key.length());
  125|  49.6k|    }
_ZN3uWS11HttpRequest6getUrlEv:
  114|  49.6k|    std::string_view getUrl() {
  115|  49.6k|        return std::string_view(headers->value.data(), querySeparator);
  116|  49.6k|    }
_ZN3uWS11HttpRequest8setYieldEb:
   99|  73.0k|    void setYield(bool yield) {
  100|  73.0k|        didYield = yield;
  101|  73.0k|    }
_ZN3uWS11HttpRequest13setParametersENSt3__14pairIiPNS1_17basic_string_viewIcNS1_11char_traitsIcEEEEEE:
  154|  60.6k|    void setParameters(std::pair<int, std::string_view *> parameters) {
  155|  60.6k|        currentParameters = parameters;
  156|  60.6k|    }
_ZN3uWS11HttpRequest8getYieldEv:
   64|  60.6k|    bool getYield() {
   65|  60.6k|        return didYield;
   66|  60.6k|    }
_ZN3uWS11HttpRequest8getQueryEv:
  137|  11.1k|    std::string_view getQuery() {
  138|  11.1k|        if (querySeparator < headers->value.length()) {
  ------------------
  |  Branch (138:13): [True: 4.04k, False: 7.14k]
  ------------------
  139|       |            /* Strip the initial ? */
  140|  4.04k|            return std::string_view(headers->value.data() + querySeparator + 1, headers->value.length() - querySeparator - 1);
  141|  7.14k|        } else {
  142|  7.14k|            return std::string_view(nullptr, 0);
  143|  7.14k|        }
  144|  11.1k|    }
_ZN3uWS11HttpRequest12getParameterEt:
  158|  10.1k|    std::string_view getParameter(unsigned short index) {
  159|  10.1k|        if (currentParameters.first < (int) index) {
  ------------------
  |  Branch (159:13): [True: 6.73k, False: 3.36k]
  ------------------
  160|  6.73k|            return {};
  161|  6.73k|        } else {
  162|  3.36k|            return currentParameters.second[index];
  163|  3.36k|        }
  164|  10.1k|    }
_ZN3uWS11HttpRequest8getQueryENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  147|  3.36k|    std::string_view getQuery(std::string_view key) {
  148|       |        /* Raw querystring including initial '?' sign */
  149|  3.36k|        std::string_view queryString = std::string_view(headers->value.data() + querySeparator, headers->value.length() - querySeparator);
  150|       |
  151|  3.36k|        return getDecodedQueryValue(key, queryString);
  152|  3.36k|    }

_ZN3uWS12HttpResponseILb0EE12hasRespondedEv:
  490|  27.3k|    bool hasResponded() {
  491|  27.3k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  492|       |
  493|  27.3k|        return !(httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING);
  494|  27.3k|    }
_ZN3uWS12HttpResponseILb0EE19getHttpResponseDataEv:
   52|   432k|    HttpResponseData<SSL> *getHttpResponseData() {
   53|   432k|        return (HttpResponseData<SSL> *) Super::getAsyncSocketData();
   54|   432k|    }
_ZN3uWS12HttpResponseILb0EE13writeContinueEv:
  377|    213|    HttpResponse *writeContinue() {
  378|    213|        Super::write("HTTP/1.1 100 Continue\r\n\r\n", 25);
  379|    213|        return this;
  380|    213|    }
EpollHelloWorld.cpp:_ZN3uWS12HttpResponseILb0EE7upgradeIZ4testvE13PerSocketDataEEvOT_NSt3__117basic_string_viewIcNS6_11char_traitsIcEEEESA_SA_P19us_socket_context_t:
  239|  33.5k|            struct us_socket_context_t *webSocketContext) {
  240|       |
  241|       |        /* Extract needed parameters from WebSocketContextData */
  242|  33.5k|        WebSocketContextData<SSL, UserData> *webSocketContextData = (WebSocketContextData<SSL, UserData> *) us_socket_context_ext(SSL, webSocketContext);
  243|       |
  244|       |        /* Note: OpenSSL can be used here to speed this up somewhat */
  245|  33.5k|        char secWebSocketAccept[29] = {};
  246|  33.5k|        WebSocketHandshake::generate(secWebSocketKey.data(), secWebSocketAccept);
  247|       |
  248|  33.5k|        writeStatus("101 Switching Protocols")
  249|  33.5k|            ->writeHeader("Upgrade", "websocket")
  250|  33.5k|            ->writeHeader("Connection", "Upgrade")
  251|  33.5k|            ->writeHeader("Sec-WebSocket-Accept", secWebSocketAccept);
  252|       |
  253|       |        /* Select first subprotocol if present */
  254|  33.5k|        if (secWebSocketProtocol.length()) {
  ------------------
  |  Branch (254:13): [True: 966, False: 32.5k]
  ------------------
  255|    966|            writeHeader("Sec-WebSocket-Protocol", secWebSocketProtocol.substr(0, secWebSocketProtocol.find(',')));
  256|    966|        }
  257|       |
  258|       |        /* Negotiate compression */
  259|  33.5k|        bool perMessageDeflate = false;
  260|  33.5k|        CompressOptions compressOptions = CompressOptions::DISABLED;
  261|  33.5k|        if (secWebSocketExtensions.length() && webSocketContextData->compression != DISABLED) {
  ------------------
  |  Branch (261:13): [True: 4.57k, False: 28.9k]
  |  Branch (261:48): [True: 4.38k, False: 194]
  ------------------
  262|       |
  263|       |            /* Make sure to map SHARED_DECOMPRESSOR to windowBits = 0, not 1  */
  264|  4.38k|            int wantedInflationWindow = 0;
  265|  4.38k|            if ((webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) != CompressOptions::SHARED_DECOMPRESSOR) {
  ------------------
  |  Branch (265:17): [True: 4.38k, False: 0]
  ------------------
  266|  4.38k|                wantedInflationWindow = (webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) >> 8;
  267|  4.38k|            }
  268|       |
  269|       |            /* Map from selected compressor (this automatically maps SHARED_COMPRESSOR to windowBits 0, not 1) */
  270|  4.38k|            int wantedCompressionWindow = (webSocketContextData->compression & CompressOptions::_COMPRESSOR_MASK) >> 4;
  271|       |
  272|  4.38k|            auto [negCompression, negCompressionWindow, negInflationWindow, negResponse] =
  273|  4.38k|            negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
  274|  4.38k|                                        secWebSocketExtensions);
  275|       |
  276|  4.38k|            if (negCompression) {
  ------------------
  |  Branch (276:17): [True: 2.78k, False: 1.59k]
  ------------------
  277|  2.78k|                perMessageDeflate = true;
  278|       |
  279|       |                /* Map from negotiated windowBits to compressor and decompressor */
  280|  2.78k|                if (negCompressionWindow == 0) {
  ------------------
  |  Branch (280:21): [True: 2.78k, False: 0]
  ------------------
  281|  2.78k|                    compressOptions = CompressOptions::SHARED_COMPRESSOR;
  282|  2.78k|                } else {
  283|      0|                    compressOptions = (CompressOptions) ((uint32_t) (negCompressionWindow << 4)
  284|      0|                                                        | (uint32_t) (negCompressionWindow - 7));
  285|       |
  286|       |                    /* If we are dedicated and have the 3kb then correct any 4kb to 3kb,
  287|       |                     * (they both share the windowBits = 9) */
  288|      0|                    if (webSocketContextData->compression & DEDICATED_COMPRESSOR_3KB) {
  ------------------
  |  Branch (288:25): [True: 0, False: 0]
  ------------------
  289|      0|                        compressOptions = DEDICATED_COMPRESSOR_3KB;
  290|      0|                    }
  291|      0|                }
  292|       |
  293|       |                /* Here we modify the above compression with negotiated decompressor */
  294|  2.78k|                if (negInflationWindow == 0) {
  ------------------
  |  Branch (294:21): [True: 2.78k, False: 0]
  ------------------
  295|  2.78k|                    compressOptions = CompressOptions(compressOptions | CompressOptions::SHARED_DECOMPRESSOR);
  296|  2.78k|                } else {
  297|      0|                    compressOptions = CompressOptions(compressOptions | (negInflationWindow << 8));
  298|      0|                }
  299|       |
  300|  2.78k|                writeHeader("Sec-WebSocket-Extensions", negResponse);
  301|  2.78k|            }
  302|  4.38k|        }
  303|       |
  304|  33.5k|        internalEnd({nullptr, 0}, 0, false, false);
  305|       |
  306|       |        /* Grab the httpContext from res */
  307|  33.5k|        HttpContext<SSL> *httpContext = (HttpContext<SSL> *) us_socket_context(SSL, (struct us_socket_t *) this);
  308|       |
  309|       |        /* Move any backpressure out of HttpResponse */
  310|  33.5k|        BackPressure backpressure(std::move(((AsyncSocketData<SSL> *) getHttpResponseData())->buffer));
  311|       |
  312|       |        /* Destroy HttpResponseData */
  313|  33.5k|        getHttpResponseData()->~HttpResponseData();
  314|       |
  315|       |        /* Before we adopt and potentially change socket, check if we are corked */
  316|  33.5k|        bool wasCorked = Super::isCorked();
  317|       |
  318|       |        /* Adopting a socket invalidates it, do not rely on it directly to carry any data */
  319|  33.5k|        WebSocket<SSL, true, UserData> *webSocket = (WebSocket<SSL, true, UserData> *) us_socket_context_adopt_socket(SSL,
  320|  33.5k|                    (us_socket_context_t *) webSocketContext, (us_socket_t *) this, sizeof(WebSocketData) + sizeof(UserData));
  321|       |
  322|       |        /* For whatever reason we were corked, update cork to the new socket */
  323|  33.5k|        if (wasCorked) {
  ------------------
  |  Branch (323:13): [True: 33.5k, False: 0]
  ------------------
  324|  33.5k|            webSocket->AsyncSocket<SSL>::corkUnchecked();
  325|  33.5k|        }
  326|       |
  327|       |        /* Initialize websocket with any moved backpressure intact */
  328|  33.5k|        webSocket->init(perMessageDeflate, compressOptions, std::move(backpressure));
  329|       |
  330|       |        /* We should only mark this if inside the parser; if upgrading "async" we cannot set this */
  331|  33.5k|        HttpContextData<SSL> *httpContextData = httpContext->getSocketContextData();
  332|  33.5k|        if (httpContextData->isParsingHttp) {
  ------------------
  |  Branch (332:13): [True: 33.5k, False: 0]
  ------------------
  333|       |            /* We need to tell the Http parser that we changed socket */
  334|  33.5k|            httpContextData->upgradedWebSocket = webSocket;
  335|  33.5k|        }
  336|       |
  337|       |        /* Arm maxLifetime timeout */
  338|  33.5k|        us_socket_long_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->maxLifetime);
  339|       |
  340|       |        /* Arm idleTimeout */
  341|  33.5k|        us_socket_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->idleTimeoutComponents.first);
  342|       |
  343|       |        /* Move construct the UserData right before calling open handler */
  344|  33.5k|        new (webSocket->getUserData()) UserData(std::move(userData));
  345|       |
  346|       |        /* Emit open event and start the timeout */
  347|  33.5k|        if (webSocketContextData->openHandler) {
  ------------------
  |  Branch (347:13): [True: 32.3k, False: 1.20k]
  ------------------
  348|  32.3k|            webSocketContextData->openHandler(webSocket);
  349|  32.3k|        }
  350|  33.5k|    }
_ZN3uWS12HttpResponseILb0EE11writeStatusENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  383|   282k|    HttpResponse *writeStatus(std::string_view status) {
  384|   282k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  385|       |
  386|       |        /* Do not allow writing more than one status */
  387|   282k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_STATUS_CALLED) {
  ------------------
  |  Branch (387:13): [True: 236k, False: 46.1k]
  ------------------
  388|   236k|            return this;
  389|   236k|        }
  390|       |
  391|       |        /* Update status */
  392|  46.1k|        httpResponseData->state |= HttpResponseData<SSL>::HTTP_STATUS_CALLED;
  393|       |
  394|  46.1k|        Super::write("HTTP/1.1 ", 9);
  395|  46.1k|        Super::write(status.data(), (int) status.length());
  396|  46.1k|        Super::write("\r\n", 2);
  397|  46.1k|        return this;
  398|   282k|    }
_ZN3uWS12HttpResponseILb0EE11writeHeaderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_:
  401|   199k|    HttpResponse *writeHeader(std::string_view key, std::string_view value) {
  402|   199k|        writeStatus(HTTP_200_OK);
  403|       |
  404|   199k|        Super::write(key.data(), (int) key.length());
  405|   199k|        Super::write(": ", 2);
  406|   199k|        Super::write(value.data(), (int) value.length());
  407|   199k|        Super::write("\r\n", 2);
  408|   199k|        return this;
  409|   199k|    }
_ZN3uWS12HttpResponseILb0EE11internalEndENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEmbbb:
   92|  46.1k|    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|  46.1k|        writeStatus(HTTP_200_OK);
   95|       |
   96|       |        /* If no total size given then assume this chunk is everything */
   97|  46.1k|        if (!totalSize) {
  ------------------
  |  Branch (97:13): [True: 35.2k, False: 10.8k]
  ------------------
   98|  35.2k|            totalSize = data.length();
   99|  35.2k|        }
  100|       |
  101|  46.1k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  102|       |
  103|       |        /* In some cases, such as when refusing huge data we want to close the connection when drained */
  104|  46.1k|        if (closeConnection) {
  ------------------
  |  Branch (104:13): [True: 0, False: 46.1k]
  ------------------
  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|  46.1k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED) {
  ------------------
  |  Branch (118:13): [True: 2.28k, False: 43.8k]
  ------------------
  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|  2.28k|            if (data.length()) {
  ------------------
  |  Branch (123:17): [True: 607, False: 1.68k]
  ------------------
  124|    607|                Super::write("\r\n", 2);
  125|    607|                writeUnsignedHex((unsigned int) data.length());
  126|    607|                Super::write("\r\n", 2);
  127|       |
  128|       |                /* Ignoring optional for now */
  129|    607|                Super::write(data.data(), (int) data.length());
  130|    607|            }
  131|       |
  132|       |            /* Terminating 0 chunk */
  133|  2.28k|            Super::write("\r\n0\r\n\r\n", 7);
  134|       |
  135|  2.28k|            httpResponseData->markDone();
  136|       |
  137|       |            /* We need to check if we should close this socket here now */
  138|  2.28k|            if (!Super::isCorked()) {
  ------------------
  |  Branch (138:17): [True: 0, False: 2.28k]
  ------------------
  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|  2.28k|            Super::timeout(HTTP_TIMEOUT_S);
  154|  2.28k|            return true;
  155|  43.8k|        } else {
  156|       |            /* Write content-length on first call */
  157|  43.8k|            if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_END_CALLED)) {
  ------------------
  |  Branch (157:17): [True: 43.8k, False: 0]
  ------------------
  158|       |                /* Write mark, this propagates to WebSockets too */
  159|  43.8k|                writeMark();
  160|       |
  161|       |                /* WebSocket upgrades does not allow content-length */
  162|  43.8k|                if (allowContentLength) {
  ------------------
  |  Branch (162:21): [True: 10.2k, False: 33.5k]
  ------------------
  163|       |                    /* Even zero is a valid content-length */
  164|  10.2k|                    Super::write("Content-Length: ", 16);
  165|  10.2k|                    writeUnsigned64(totalSize);
  166|  10.2k|                    Super::write("\r\n\r\n", 4);
  167|  33.5k|                } else {
  168|  33.5k|                    Super::write("\r\n", 2);
  169|  33.5k|                }
  170|       |
  171|       |                /* Mark end called */
  172|  43.8k|                httpResponseData->state |= HttpResponseData<SSL>::HTTP_END_CALLED;
  173|  43.8k|            }
  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|  43.8k|            size_t written = 0;
  180|  43.8k|            bool failed = false;
  181|  54.1k|            while (written < data.length() && !failed) {
  ------------------
  |  Branch (181:20): [True: 10.2k, False: 43.8k]
  |  Branch (181:47): [True: 10.2k, False: 0]
  ------------------
  182|       |                /* uSockets only deals with int sizes, so pass chunks of max signed int size */
  183|  10.2k|                auto writtenFailed = Super::write(data.data() + written, (int) std::min<size_t>(data.length() - written, INT_MAX), optional);
  184|       |
  185|  10.2k|                written += (size_t) writtenFailed.first;
  186|  10.2k|                failed = writtenFailed.second;
  187|  10.2k|            }
  188|       |
  189|  43.8k|            httpResponseData->offset += written;
  190|       |
  191|       |            /* Success is when we wrote the entire thing without any failures */
  192|  43.8k|            bool success = written == data.length() && !failed;
  ------------------
  |  Branch (192:28): [True: 43.8k, False: 0]
  |  Branch (192:56): [True: 43.3k, False: 481]
  ------------------
  193|       |
  194|       |            /* If we are now at the end, start a timeout. Also start a timeout if we failed. */
  195|  43.8k|            if (!success || httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (195:17): [True: 481, False: 43.3k]
  |  Branch (195:29): [True: 43.3k, False: 0]
  ------------------
  196|  43.8k|                Super::timeout(HTTP_TIMEOUT_S);
  197|  43.8k|            }
  198|       |
  199|       |            /* Remove onAborted function if we reach the end */
  200|  43.8k|            if (httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (200:17): [True: 43.8k, False: 0]
  ------------------
  201|  43.8k|                httpResponseData->markDone();
  202|       |
  203|       |                /* We need to check if we should close this socket here now */
  204|  43.8k|                if (!Super::isCorked()) {
  ------------------
  |  Branch (204:21): [True: 0, False: 43.8k]
  ------------------
  205|      0|                    if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (205:25): [True: 0, False: 0]
  ------------------
  206|      0|                        if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (206:29): [True: 0, False: 0]
  ------------------
  207|      0|                            if (((AsyncSocket<SSL> *) this)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (207:33): [True: 0, False: 0]
  ------------------
  208|      0|                                ((AsyncSocket<SSL> *) this)->shutdown();
  209|       |                                /* We need to force close after sending FIN since we want to hinder
  210|       |                                * clients from keeping to send their huge data */
  211|      0|                                ((AsyncSocket<SSL> *) this)->close();
  212|      0|                            }
  213|      0|                        }
  214|      0|                    }
  215|      0|                }
  216|  43.8k|            }
  217|       |
  218|  43.8k|            return success;
  219|  43.8k|        }
  220|  46.1k|    }
_ZN3uWS12HttpResponseILb0EE16writeUnsignedHexEj:
   57|  3.58k|    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|  3.58k|        char buf[16];
   61|  3.58k|        int length = utils::u32toaHex(value, buf);
   62|       |
   63|       |        /* For now we do this copy */
   64|  3.58k|        Super::write(buf, length);
   65|  3.58k|    }
_ZN3uWS12HttpResponseILb0EE9writeMarkEv:
   77|  46.1k|    void writeMark() {
   78|       |        /* Date is always written */
   79|  46.1k|        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|  46.1k|#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
   83|  46.1k|        if (!Super::getLoopData()->noMark) {
  ------------------
  |  Branch (83:13): [True: 46.1k, False: 0]
  ------------------
   84|       |            /* We only expose major version */
   85|  46.1k|            writeHeader("uWebSockets", "20");
   86|  46.1k|        }
   87|  46.1k|#endif
   88|  46.1k|    }
_ZN3uWS12HttpResponseILb0EE15writeUnsigned64Em:
   68|  10.2k|    void writeUnsigned64(uint64_t value) {
   69|  10.2k|        char buf[20];
   70|  10.2k|        int length = utils::u64toa(value, buf);
   71|       |
   72|       |        /* For now we do this copy */
   73|  10.2k|        Super::write(buf, length);
   74|  10.2k|    }
_ZN3uWS12HttpResponseILb0EE5writeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  443|  2.97k|    bool write(std::string_view data) {
  444|  2.97k|        writeStatus(HTTP_200_OK);
  445|       |
  446|       |        /* Do not allow sending 0 chunks, they mark end of response */
  447|  2.97k|        if (!data.length()) {
  ------------------
  |  Branch (447:13): [True: 0, False: 2.97k]
  ------------------
  448|       |            /* If you called us, then according to you it was fine to call us so it's fine to still call us */
  449|      0|            return true;
  450|      0|        }
  451|       |
  452|  2.97k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  453|       |
  454|  2.97k|        if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED)) {
  ------------------
  |  Branch (454:13): [True: 2.28k, False: 691]
  ------------------
  455|       |            /* Write mark on first call to write */
  456|  2.28k|            writeMark();
  457|       |
  458|  2.28k|            writeHeader("Transfer-Encoding", "chunked");
  459|  2.28k|            httpResponseData->state |= HttpResponseData<SSL>::HTTP_WRITE_CALLED;
  460|  2.28k|        }
  461|       |
  462|  2.97k|        Super::write("\r\n", 2);
  463|  2.97k|        writeUnsignedHex((unsigned int) data.length());
  464|  2.97k|        Super::write("\r\n", 2);
  465|       |
  466|  2.97k|        auto [written, failed] = Super::write(data.data(), (int) data.length());
  467|  2.97k|        if (failed) {
  ------------------
  |  Branch (467:13): [True: 379, False: 2.60k]
  ------------------
  468|    379|            Super::timeout(HTTP_TIMEOUT_S);
  469|    379|        }
  470|       |
  471|       |        /* If we did not fail the write, accept more */
  472|  2.97k|        return !failed;
  473|  2.97k|    }
_ZN3uWS12HttpResponseILb0EE3endENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEb:
  432|  12.5k|    void end(std::string_view data = {}, bool closeConnection = false) {
  433|  12.5k|        internalEnd(data, data.length(), false, true, closeConnection);
  434|  12.5k|    }
_ZN3uWS12HttpResponseILb0EE9onAbortedEON5ofats13any_invocableIFvvEEE:
  558|  2.73k|    HttpResponse *onAborted(MoveOnlyFunction<void()> &&handler) {
  559|  2.73k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  560|       |
  561|  2.73k|        httpResponseData->onAborted = std::move(handler);
  562|  2.73k|        return this;
  563|  2.73k|    }
_ZN3uWS12HttpResponseILb0EE6onDataEON5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEbEEE:
  566|  2.73k|    void onData(MoveOnlyFunction<void(std::string_view, bool)> &&handler) {
  567|  2.73k|        HttpResponseData<SSL> *data = getHttpResponseData();
  568|  2.73k|        data->inStream = std::move(handler);
  569|       |
  570|       |        /* Always reset this counter here */
  571|  2.73k|        data->received_bytes_per_timeout = 0;
  572|  2.73k|    }
_ZN3uWS12HttpResponseILb0EE4corkEON5ofats13any_invocableIFvvEEE:
  497|  1.59k|    HttpResponse *cork(MoveOnlyFunction<void()> &&handler) {
  498|  1.59k|        if (!Super::isCorked() && Super::canCork()) {
  ------------------
  |  Branch (498:13): [True: 0, False: 1.59k]
  |  Branch (498:35): [True: 0, False: 0]
  ------------------
  499|      0|            Super::cork();
  500|      0|            handler();
  501|       |
  502|       |            /* The only way we could possibly have changed the corked socket during handler call, would be if 
  503|       |             * the HTTP socket was upgraded to WebSocket and caused a realloc. Because of this we cannot use "this"
  504|       |             * from here downwards. The corking is done with corkUnchecked() in upgrade. It steals cork. */
  505|      0|            auto *newCorkedSocket = Super::corkedSocket();
  506|       |
  507|       |            /* If nobody is corked, it means most probably that large amounts of data has
  508|       |             * been written and the cork buffer has already been sent off and uncorked.
  509|       |             * We are done here, if that is the case. */
  510|      0|            if (!newCorkedSocket) {
  ------------------
  |  Branch (510:17): [True: 0, False: 0]
  ------------------
  511|      0|                return this;
  512|      0|            }
  513|       |
  514|       |            /* Timeout on uncork failure, since most writes will succeed while corked */
  515|      0|            auto [written, failed] = static_cast<Super *>(newCorkedSocket)->uncork();
  516|       |
  517|       |            /* If we are no longer an HTTP socket then early return the new "this".
  518|       |             * We don't want to even overwrite timeout as it is set in upgrade already. */
  519|      0|            if (this != newCorkedSocket) {
  ------------------
  |  Branch (519:17): [True: 0, False: 0]
  ------------------
  520|      0|                return static_cast<HttpResponse *>(newCorkedSocket);
  521|      0|            }
  522|       |
  523|      0|            if (failed) {
  ------------------
  |  Branch (523:17): [True: 0, False: 0]
  ------------------
  524|       |                /* For now we only have one single timeout so let's use it */
  525|       |                /* This behavior should equal the behavior in HttpContext when uncorking fails */
  526|      0|                Super::timeout(HTTP_TIMEOUT_S);
  527|      0|            }
  528|       |
  529|       |            /* If we have no backbuffer and we are connection close and we responded fully then close */
  530|      0|            HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  531|      0|            if (httpResponseData->state & HttpResponseData<SSL>::HTTP_CONNECTION_CLOSE) {
  ------------------
  |  Branch (531:17): [True: 0, False: 0]
  ------------------
  532|      0|                if ((httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING) == 0) {
  ------------------
  |  Branch (532:21): [True: 0, False: 0]
  ------------------
  533|      0|                    if (((AsyncSocket<SSL> *) this)->getBufferedAmount() == 0) {
  ------------------
  |  Branch (533:25): [True: 0, False: 0]
  ------------------
  534|      0|                        ((AsyncSocket<SSL> *) this)->shutdown();
  535|       |                        /* We need to force close after sending FIN since we want to hinder
  536|       |                        * clients from keeping to send their huge data */
  537|      0|                        ((AsyncSocket<SSL> *) this)->close();
  538|      0|                    }
  539|      0|                }
  540|      0|            }
  541|  1.59k|        } else {
  542|       |            /* We are already corked, or can't cork so let's just call the handler */
  543|  1.59k|            handler();
  544|  1.59k|        }
  545|       |
  546|  1.59k|        return this;
  547|  1.59k|    }

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

_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEEC2Ev:
  247|  6.03k|    HttpRouter() {
  248|  6.03k|        int p = 0;
  249|  54.3k|        for (std::string &method : upperCasedMethods) {
  ------------------
  |  Branch (249:34): [True: 54.3k, False: 6.03k]
  ------------------
  250|  54.3k|            priority[method] = p++;
  251|  54.3k|        }
  252|  6.03k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE4NodeC2ENSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
   67|   193k|        Node(std::string name) : name(name) {}
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE11getUserDataEv:
  258|   110k|    USERDATA &getUserData() {
  259|   110k|        return userData;
  260|   110k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE5routeENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEES9_:
  263|  49.6k|    bool route(std::string_view method, std::string_view url) {
  264|       |        /* Reset url parsing cache */
  265|  49.6k|        setUrl(url);
  266|  49.6k|        routeParameters.reset();
  267|       |
  268|       |        /* Begin by finding the method node */
  269|  65.0k|        for (auto &p : root.children) {
  ------------------
  |  Branch (269:22): [True: 65.0k, False: 1.24k]
  ------------------
  270|  65.0k|            if (p->name == method) {
  ------------------
  |  Branch (270:17): [True: 48.3k, False: 16.6k]
  ------------------
  271|       |                /* Then route the url */
  272|  48.3k|                return executeHandlers(p.get(), 0, userData);
  273|  48.3k|            }
  274|  65.0k|        }
  275|       |
  276|       |        /* We did not find any handler for this method and url */
  277|  1.24k|        return false;
  278|  49.6k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE6setUrlENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
  128|   158k|    inline void setUrl(std::string_view url) {
  129|       |
  130|       |        /* Todo: URL may also start with "http://domain/" or "*", not only "/" */
  131|       |
  132|       |        /* We expect to stand on a slash */
  133|   158k|        currentUrl = url;
  134|   158k|        urlSegmentTop = -1;
  135|   158k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters5resetEv:
  112|  49.6k|        void reset() {
  113|  49.6k|            paramsTop = -1;
  114|  49.6k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15executeHandlersEPNS4_4NodeEiRS3_:
  172|  58.6k|    bool executeHandlers(Node *parent, int urlSegment, USERDATA &userData) {
  173|       |
  174|  58.6k|        auto [segment, isStop] = getUrlSegment(urlSegment);
  175|       |
  176|       |        /* If we are on STOP, return where we may stand */
  177|  58.6k|        if (isStop) {
  ------------------
  |  Branch (177:13): [True: 6.63k, False: 52.0k]
  ------------------
  178|       |            /* We have reached accross the entire URL with no stoppage, execute */
  179|  6.63k|            for (uint32_t handler : parent->handlers) {
  ------------------
  |  Branch (179:35): [True: 2.10k, False: 5.42k]
  ------------------
  180|  2.10k|                if (handlers[handler & HANDLER_MASK](this)) {
  ------------------
  |  Branch (180:21): [True: 1.20k, False: 895]
  ------------------
  181|  1.20k|                    return true;
  182|  1.20k|                }
  183|  2.10k|            }
  184|       |            /* We reached the end, so go back */
  185|  5.42k|            return false;
  186|  6.63k|        }
  187|       |
  188|   118k|        for (auto &p : parent->children) {
  ------------------
  |  Branch (188:22): [True: 118k, False: 524]
  ------------------
  189|   118k|            if (p->name.length() && p->name[0] == '*') {
  ------------------
  |  Branch (189:17): [True: 118k, False: 0]
  |  Branch (189:37): [True: 58.5k, False: 59.9k]
  ------------------
  190|       |                /* Wildcard match (can be seen as a shortcut) */
  191|  58.5k|                for (uint32_t handler : p->handlers) {
  ------------------
  |  Branch (191:39): [True: 58.5k, False: 11.5k]
  ------------------
  192|  58.5k|                    if (handlers[handler & HANDLER_MASK](this)) {
  ------------------
  |  Branch (192:25): [True: 46.9k, False: 11.5k]
  ------------------
  193|  46.9k|                        return true;
  194|  46.9k|                    }
  195|  58.5k|                }
  196|  59.9k|            } else if (p->name.length() && p->name[0] == ':' && segment.length()) {
  ------------------
  |  Branch (196:24): [True: 59.9k, False: 0]
  |  Branch (196:44): [True: 14.8k, False: 45.1k]
  |  Branch (196:65): [True: 7.89k, False: 6.91k]
  ------------------
  197|       |                /* Parameter match */
  198|  7.89k|                routeParameters.push(segment);
  199|  7.89k|                if (executeHandlers(p.get(), urlSegment + 1, userData)) {
  ------------------
  |  Branch (199:21): [True: 3.36k, False: 4.52k]
  ------------------
  200|  3.36k|                    return true;
  201|  3.36k|                }
  202|  4.52k|                routeParameters.pop();
  203|  52.0k|            } else if (p->name == segment) {
  ------------------
  |  Branch (203:24): [True: 2.42k, False: 49.5k]
  ------------------
  204|       |                /* Static match */
  205|  2.42k|                if (executeHandlers(p.get(), urlSegment + 1, userData)) {
  ------------------
  |  Branch (205:21): [True: 1.20k, False: 1.22k]
  ------------------
  206|  1.20k|                    return true;
  207|  1.20k|                }
  208|  2.42k|            }
  209|   118k|        }
  210|    524|        return false;
  211|  52.0k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE13getUrlSegmentEi:
  138|   505k|    inline std::pair<std::string_view, bool> getUrlSegment(int urlSegment) {
  139|   505k|        if (urlSegment > urlSegmentTop) {
  ------------------
  |  Branch (139:13): [True: 335k, False: 169k]
  ------------------
  140|       |            /* Signal as STOP when we have no more URL or stack space */
  141|   335k|            if (!currentUrl.length() || urlSegment > 99) {
  ------------------
  |  Branch (141:17): [True: 115k, False: 220k]
  |  Branch (141:41): [True: 0, False: 220k]
  ------------------
  142|   115k|                return {{}, true};
  143|   115k|            }
  144|       |
  145|       |            /* We always stand on a slash here, so step over it */
  146|   220k|            currentUrl.remove_prefix(1);
  147|       |
  148|   220k|            auto segmentLength = currentUrl.find('/');
  149|   220k|            if (segmentLength == std::string::npos) {
  ------------------
  |  Branch (149:17): [True: 152k, False: 68.4k]
  ------------------
  150|   152k|                segmentLength = currentUrl.length();
  151|       |
  152|       |                /* Push to url segment vector */
  153|   152k|                urlSegmentVector[urlSegment] = currentUrl.substr(0, segmentLength);
  154|   152k|                urlSegmentTop++;
  155|       |
  156|       |                /* Update currentUrl */
  157|   152k|                currentUrl = currentUrl.substr(segmentLength);
  158|   152k|            } else {
  159|       |                /* Push to url segment vector */
  160|  68.4k|                urlSegmentVector[urlSegment] = currentUrl.substr(0, segmentLength);
  161|  68.4k|                urlSegmentTop++;
  162|       |
  163|       |                /* Update currentUrl */
  164|  68.4k|                currentUrl = currentUrl.substr(segmentLength);
  165|  68.4k|            }
  166|   220k|        }
  167|       |        /* In any case we return it */
  168|   389k|        return {urlSegmentVector[urlSegment], false};
  169|   505k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters4pushENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  116|  7.89k|        void push(std::string_view param) {
  117|       |            /* We check these bounds indirectly via the urlSegments limit */
  118|  7.89k|            params[++paramsTop] = param;
  119|  7.89k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE15RouteParameters3popEv:
  121|  4.52k|        void pop() {
  122|       |            /* Same here, we cannot pop outside */
  123|  4.52k|            paramsTop--;
  124|  4.52k|        }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE11findHandlerENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESB_j:
  214|  30.1k|    uint32_t findHandler(std::string method, std::string pattern, uint32_t priority) {
  215|  36.2k|        for (std::unique_ptr<Node> &node : root.children) {
  ------------------
  |  Branch (215:42): [True: 36.2k, False: 0]
  ------------------
  216|  36.2k|            if (method == node->name) {
  ------------------
  |  Branch (216:17): [True: 30.1k, False: 6.03k]
  ------------------
  217|  30.1k|                setUrl(pattern);
  218|  30.1k|                Node *n = node.get();
  219|  66.3k|                for (int i = 0; !getUrlSegment(i).second; i++) {
  ------------------
  |  Branch (219:33): [True: 36.2k, False: 30.1k]
  ------------------
  220|       |                    /* Go to next segment or quit */
  221|  36.2k|                    std::string segment = std::string(getUrlSegment(i).first);
  222|  36.2k|                    Node *next = nullptr;
  223|  54.3k|                    for (std::unique_ptr<Node> &child : n->children) {
  ------------------
  |  Branch (223:55): [True: 54.3k, False: 0]
  ------------------
  224|  54.3k|                        if (child->name == segment && child->isHighPriority == (priority == HIGH_PRIORITY)) {
  ------------------
  |  Branch (224:29): [True: 36.2k, False: 18.1k]
  |  Branch (224:55): [True: 36.2k, False: 0]
  ------------------
  225|  36.2k|                            next = child.get();
  226|  36.2k|                            break;
  227|  36.2k|                        }
  228|  54.3k|                    }
  229|  36.2k|                    if (!next) {
  ------------------
  |  Branch (229:25): [True: 0, False: 36.2k]
  ------------------
  230|      0|                        return UINT32_MAX;
  231|      0|                    }
  232|  36.2k|                    n = next;
  233|  36.2k|                }
  234|       |                /* Seek for a priority match in the found node */
  235|  30.1k|                for (unsigned int i = 0; i < n->handlers.size(); i++) {
  ------------------
  |  Branch (235:42): [True: 30.1k, False: 0]
  ------------------
  236|  30.1k|                    if ((n->handlers[i] & ~HANDLER_MASK) == priority) {
  ------------------
  |  Branch (236:25): [True: 30.1k, False: 0]
  ------------------
  237|  30.1k|                        return n->handlers[i];
  238|  30.1k|                    }
  239|  30.1k|                }
  240|      0|                return UINT32_MAX;
  241|  30.1k|            }
  242|  36.2k|        }
  243|      0|        return UINT32_MAX;
  244|  30.1k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE3addENSt3__16vectorINS5_12basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENSA_ISC_EEEESC_ON5ofats13any_invocableIFbPS4_EEEj:
  281|  30.1k|    void add(std::vector<std::string> methods, std::string pattern, MoveOnlyFunction<bool(HttpRouter *)> &&handler, uint32_t priority = MEDIUM_PRIORITY) {
  282|  78.4k|        for (std::string method : methods) {
  ------------------
  |  Branch (282:33): [True: 78.4k, False: 30.1k]
  ------------------
  283|       |            /* Lookup method */
  284|  78.4k|            Node *node = getNode(&root, method, false);
  285|       |            /* Iterate over all segments */
  286|  78.4k|            setUrl(pattern);
  287|   211k|            for (int i = 0; !getUrlSegment(i).second; i++) {
  ------------------
  |  Branch (287:29): [True: 132k, False: 78.4k]
  ------------------
  288|   132k|                node = getNode(node, std::string(getUrlSegment(i).first), priority == HIGH_PRIORITY);
  289|   132k|            }
  290|       |            /* Insert handler in order sorted by priority (most significant 1 byte) */
  291|  78.4k|            node->handlers.insert(std::upper_bound(node->handlers.begin(), node->handlers.end(), (uint32_t) (priority | handlers.size())), (uint32_t) (priority | handlers.size()));
  292|  78.4k|        }
  293|       |
  294|       |        /* Alloate this handler */
  295|  30.1k|        handlers.emplace_back(std::move(handler));
  296|       |
  297|       |        /* Assume can find this handler again */
  298|  30.1k|        if (((handlers.size() - 1) | priority) != findHandler(methods[0], pattern, priority)) {
  ------------------
  |  Branch (298:13): [True: 0, False: 30.1k]
  ------------------
  299|      0|            std::cerr << "Error: Internal routing error" << std::endl;
  300|      0|            std::abort();
  301|      0|        }
  302|  30.1k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE7getNodeEPNS4_4NodeENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEb:
   85|   211k|    Node *getNode(Node *parent, std::string child, bool isHighPriority) {
   86|   289k|        for (std::unique_ptr<Node> &node : parent->children) {
  ------------------
  |  Branch (86:42): [True: 289k, False: 187k]
  ------------------
   87|   289k|            if (node->name == child && node->isHighPriority == isHighPriority) {
  ------------------
  |  Branch (87:17): [True: 30.1k, False: 259k]
  |  Branch (87:40): [True: 24.1k, False: 6.03k]
  ------------------
   88|  24.1k|                return node.get();
   89|  24.1k|            }
   90|   289k|        }
   91|       |
   92|       |        /* Insert sorted, but keep order if parent is root (we sort methods by priority elsewhere) */
   93|   187k|        std::unique_ptr<Node> newNode(new Node(child));
   94|   187k|        newNode->isHighPriority = isHighPriority;
   95|   187k|        return parent->children.emplace(std::upper_bound(parent->children.begin(), parent->children.end(), newNode, [parent, this](auto &a, auto &b) {
   96|       |
   97|   187k|            if (a->isHighPriority != b->isHighPriority) {
   98|   187k|                return a->isHighPriority;
   99|   187k|            }
  100|       |
  101|   187k|            return b->name.length() && (parent != &root) && (lexicalOrder(b->name) < lexicalOrder(a->name));
  102|   187k|        }), std::move(newNode))->get();
  103|   211k|    }
_ZZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE7getNodeEPNS4_4NodeENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEbENKUlRT_RT0_E_clIKNS7_10unique_ptrIS5_NS7_14default_deleteIS5_EEEESN_EEDaSF_SH_:
   95|   132k|        return parent->children.emplace(std::upper_bound(parent->children.begin(), parent->children.end(), newNode, [parent, this](auto &a, auto &b) {
   96|       |
   97|   132k|            if (a->isHighPriority != b->isHighPriority) {
  ------------------
  |  Branch (97:17): [True: 18.1k, False: 114k]
  ------------------
   98|  18.1k|                return a->isHighPriority;
   99|  18.1k|            }
  100|       |
  101|   114k|            return b->name.length() && (parent != &root) && (lexicalOrder(b->name) < lexicalOrder(a->name));
  ------------------
  |  Branch (101:20): [True: 114k, False: 0]
  |  Branch (101:40): [True: 18.1k, False: 96.5k]
  |  Branch (101:61): [True: 12.0k, False: 6.03k]
  ------------------
  102|   132k|        }), std::move(newNode))->get();
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE12lexicalOrderERNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
   71|  36.2k|    int lexicalOrder(std::string &name) {
   72|  36.2k|        if (!name.length()) {
  ------------------
  |  Branch (72:13): [True: 0, False: 36.2k]
  ------------------
   73|      0|            return 2;
   74|      0|        }
   75|  36.2k|        if (name[0] == ':') {
  ------------------
  |  Branch (75:13): [True: 12.0k, False: 24.1k]
  ------------------
   76|  12.0k|            return 1;
   77|  12.0k|        }
   78|  24.1k|        if (name[0] == '*') {
  ------------------
  |  Branch (78:13): [True: 18.1k, False: 6.03k]
  ------------------
   79|  18.1k|            return 0;
   80|  18.1k|        }
   81|  6.03k|        return 2;
   82|  24.1k|    }
_ZN3uWS10HttpRouterINS_15HttpContextDataILb0EE10RouterDataEE13getParametersEv:
  254|  60.6k|    std::pair<int, std::string_view *> getParameters() {
  255|  60.6k|        return {routeParameters.paramsTop, routeParameters.params};
  256|  60.6k|    }

_ZN3uWS4Loop3getEPv:
  111|  73.3k|    static Loop *get(void *existingNativeLoop = nullptr) {
  112|  73.3k|        if (!getLazyLoop().loop) {
  ------------------
  |  Branch (112:13): [True: 6.03k, False: 67.2k]
  ------------------
  113|       |            /* If we are given a native loop pointer we pass that to uSockets and let it deal with it */
  114|  6.03k|            if (existingNativeLoop) {
  ------------------
  |  Branch (114:17): [True: 0, False: 6.03k]
  ------------------
  115|       |                /* Todo: here we want to pass the pointer, not a boolean */
  116|      0|                getLazyLoop().loop = create(existingNativeLoop);
  117|       |                /* We cannot register automatic free here, must be manually done */
  118|  6.03k|            } else {
  119|  6.03k|                getLazyLoop().loop = create(nullptr);
  120|  6.03k|                getLazyLoop().cleanMe = true;
  121|  6.03k|            }
  122|  6.03k|        }
  123|       |
  124|  73.3k|        return getLazyLoop().loop;
  125|  73.3k|    }
_ZN3uWS4Loop11getLazyLoopEv:
  103|   164k|    static LoopCleaner &getLazyLoop() {
  104|   164k|        static thread_local LoopCleaner lazyLoop;
  105|   164k|        return lazyLoop;
  106|   164k|    }
_ZN3uWS4Loop11LoopCleanerD2Ev:
   94|      1|        ~LoopCleaner() {
   95|      1|            if(loop && cleanMe) {
  ------------------
  |  Branch (95:16): [True: 0, False: 1]
  |  Branch (95:24): [True: 0, False: 0]
  ------------------
   96|      0|                loop->free();
   97|      0|            }
   98|      1|        }
_ZN3uWS4Loop6createEPv:
   76|  6.03k|    static Loop *create(void *hint) {
   77|  6.03k|        Loop *loop = ((Loop *) us_create_loop(hint, wakeupCb, preCb, postCb, sizeof(LoopData)))->init();
   78|       |
   79|       |        /* We also need some timers (should live off the one 4 second timer rather) */
   80|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((struct us_loop_t *) loop);
   81|  6.03k|        loopData->dateTimer = us_create_timer((struct us_loop_t *) loop, 1, sizeof(LoopData *));
   82|  6.03k|        memcpy(us_timer_ext(loopData->dateTimer), &loopData, sizeof(LoopData *));
   83|  6.03k|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   84|  6.03k|            LoopData *loopData;
   85|  6.03k|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   86|  6.03k|            loopData->updateDate();
   87|  6.03k|        }, 1000, 1000);
   88|       |
   89|  6.03k|        return loop;
   90|  6.03k|    }
_ZN3uWS4Loop8wakeupCbEP9us_loop_t:
   30|  1.13M|    static void wakeupCb(us_loop_t *loop) {
   31|  1.13M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   32|       |
   33|       |        /* Swap current deferQueue */
   34|  1.13M|        loopData->deferMutex.lock();
   35|  1.13M|        int oldDeferQueue = loopData->currentDeferQueue;
   36|  1.13M|        loopData->currentDeferQueue = (loopData->currentDeferQueue + 1) % 2;
   37|  1.13M|        loopData->deferMutex.unlock();
   38|       |
   39|       |        /* Drain the queue */
   40|  1.13M|        for (auto &x : loopData->deferQueues[oldDeferQueue]) {
  ------------------
  |  Branch (40:22): [True: 5.21k, False: 1.13M]
  ------------------
   41|  5.21k|            x();
   42|  5.21k|        }
   43|  1.13M|        loopData->deferQueues[oldDeferQueue].clear();
   44|  1.13M|    }
_ZN3uWS4Loop5preCbEP9us_loop_t:
   46|  1.45M|    static void preCb(us_loop_t *loop) {
   47|  1.45M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   48|       |
   49|  1.45M|        for (auto &p : loopData->preHandlers) {
  ------------------
  |  Branch (49:22): [True: 1.45M, False: 1.45M]
  ------------------
   50|  1.45M|            p.second((Loop *) loop);
   51|  1.45M|        }
   52|  1.45M|    }
_ZN3uWS4Loop6postCbEP9us_loop_t:
   54|  1.45M|    static void postCb(us_loop_t *loop) {
   55|  1.45M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   56|       |
   57|  1.45M|        for (auto &p : loopData->postHandlers) {
  ------------------
  |  Branch (57:22): [True: 1.45M, False: 1.45M]
  ------------------
   58|  1.45M|            p.second((Loop *) loop);
   59|  1.45M|        }
   60|       |
   61|       |        /* After every event loop iteration, we must not hold the cork buffer */
   62|  1.45M|        if (loopData->corkedSocket) {
  ------------------
  |  Branch (62:13): [True: 0, False: 1.45M]
  ------------------
   63|      0|            std::cerr << "Error: Cork buffer must not be held across event loop iterations!" << std::endl;
   64|      0|            std::terminate();
   65|      0|        }
   66|  1.45M|    }
_ZN3uWS4Loop4initEv:
   71|  6.03k|    Loop *init() {
   72|  6.03k|        new (us_loop_ext((us_loop_t *) this)) LoopData;
   73|  6.03k|        return this;
   74|  6.03k|    }
_ZZN3uWS4Loop6createEPvENKUlP10us_timer_tE_clES3_:
   83|  1.14M|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   84|  1.14M|            LoopData *loopData;
   85|  1.14M|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   86|  1.14M|            loopData->updateDate();
   87|  1.14M|        }, 1000, 1000);
_ZN3uWS4Loop9setSilentEb:
  192|  6.03k|    void setSilent(bool silent) {
  193|  6.03k|        ((LoopData *) us_loop_ext((us_loop_t *) this))->noMark = silent;
  194|  6.03k|    }
_ZN3uWS4Loop4freeEv:
  128|  6.03k|    void free() {
  129|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  130|       |
  131|       |        /* Stop and free dateTimer first */
  132|  6.03k|        us_timer_close(loopData->dateTimer);
  133|       |
  134|  6.03k|        loopData->~LoopData();
  135|       |        /* uSockets will track whether this loop is owned by us or a borrowed alien loop */
  136|  6.03k|        us_loop_free((us_loop_t *) this);
  137|       |
  138|       |        /* Reset lazyLoop */
  139|  6.03k|        getLazyLoop().loop = nullptr;
  140|  6.03k|    }
_ZN3uWS4Loop17removePostHandlerEPv:
  149|  6.03k|    void removePostHandler(void *key) {
  150|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  151|       |
  152|  6.03k|        loopData->postHandlers.erase(key);
  153|  6.03k|    }
_ZN3uWS4Loop16removePreHandlerEPv:
  162|  6.03k|    void removePreHandler(void *key) {
  163|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  164|       |
  165|  6.03k|        loopData->preHandlers.erase(key);
  166|  6.03k|    }
_ZN3uWS4Loop14addPostHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  142|  6.03k|    void addPostHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  143|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  144|       |
  145|  6.03k|        loopData->postHandlers.emplace(key, std::move(handler));
  146|  6.03k|    }
_ZN3uWS4Loop13addPreHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  155|  6.03k|    void addPreHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  156|  6.03k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  157|       |
  158|  6.03k|        loopData->preHandlers.emplace(key, std::move(handler));
  159|  6.03k|    }
_ZN3uWS4Loop5deferEON5ofats13any_invocableIFvvEEE:
  169|  6.94k|    void defer(MoveOnlyFunction<void()> &&cb) {
  170|  6.94k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  171|       |
  172|       |        //if (std::thread::get_id() == ) // todo: add fast path for same thread id
  173|  6.94k|        loopData->deferMutex.lock();
  174|  6.94k|        loopData->deferQueues[loopData->currentDeferQueue].emplace_back(std::move(cb));
  175|  6.94k|        loopData->deferMutex.unlock();
  176|       |
  177|  6.94k|        us_wakeup_loop((us_loop_t *) this);
  178|  6.94k|    }
_ZN3uWS3runEv:
  198|  6.03k|inline void run() {
  199|  6.03k|    Loop::get()->run();
  200|  6.03k|}
_ZN3uWS4Loop3runEv:
  181|  6.03k|    void run() {
  182|  6.03k|        us_loop_run((us_loop_t *) this);
  183|  6.03k|    }

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

_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EDn:
  187|  12.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EDn:
  187|  36.2k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EDn:
  187|  18.1k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  36.2k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EDn:
  187|  24.1k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  18.1k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEED2Ev:
  206|  6.03k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE7destroyEv:
  239|  6.03k|  void destroy() noexcept {
  240|  6.03k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 6.03k, False: 0]
  ------------------
  241|  6.03k|      handle_(action::destroy, &storage_, nullptr);
  242|  6.03k|      handle_ = nullptr;
  243|  6.03k|    }
  244|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|  84.4k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|  84.4k|  void destroy() noexcept {
  240|  84.4k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 18.1k, False: 66.3k]
  ------------------
  241|  18.1k|      handle_(action::destroy, &storage_, nullptr);
  242|  18.1k|      handle_ = nullptr;
  243|  18.1k|    }
  244|  84.4k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEED2Ev:
  206|  60.3k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE7destroyEv:
  239|  60.3k|  void destroy() noexcept {
  240|  60.3k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 60.3k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  60.3k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|   120k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|   120k|  void destroy() noexcept {
  240|   120k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 12.0k, False: 108k]
  ------------------
  241|  12.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  12.0k|      handle_ = nullptr;
  243|  12.0k|    }
  244|   120k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEED2Ev:
  206|   120k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE7destroyEv:
  239|   120k|  void destroy() noexcept {
  240|   120k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 12.0k, False: 108k]
  ------------------
  241|  12.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  12.0k|      handle_ = nullptr;
  243|  12.0k|    }
  244|   120k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEED2Ev:
  206|  60.3k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE7destroyEv:
  239|  60.3k|  void destroy() noexcept {
  240|  60.3k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 6.03k, False: 54.3k]
  ------------------
  241|  6.03k|      handle_(action::destroy, &storage_, nullptr);
  242|  6.03k|      handle_ = nullptr;
  243|  6.03k|    }
  244|  60.3k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEED2Ev:
  206|  36.2k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEE7destroyEv:
  239|  36.2k|  void destroy() noexcept {
  240|  36.2k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 36.2k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  36.2k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEED2Ev:
  206|  90.5k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE7destroyEv:
  239|  90.5k|  void destroy() noexcept {
  240|  90.5k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 30.1k, False: 60.3k]
  ------------------
  241|  30.1k|      handle_(action::destroy, &storage_, nullptr);
  242|  30.1k|      handle_ = nullptr;
  243|  30.1k|    }
  244|  90.5k|  }
_ZN5ofats13any_invocableIFvvEEclEv:
  345|  20.0k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  20.0k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  20.0k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4callEv:
  246|  20.0k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  20.0k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  20.0k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEED2Ev:
  206|  2.23M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE7destroyEv:
  239|  2.23M|  void destroy() noexcept {
  240|  2.23M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 23.3k, False: 2.20M]
  ------------------
  241|  23.3k|      handle_(action::destroy, &storage_, nullptr);
  242|  23.3k|      handle_ = nullptr;
  243|  23.3k|    }
  244|  2.23M|  }
_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEclES3_:
  345|  2.90M|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  2.90M|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  2.90M|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE4callES4_:
  246|  2.90M|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  2.90M|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  2.90M|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEED2Ev:
  206|  24.1k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE7destroyEv:
  239|  24.1k|  void destroy() noexcept {
  240|  24.1k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 12.0k, False: 12.0k]
  ------------------
  241|  12.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  12.0k|      handle_ = nullptr;
  243|  12.0k|    }
  244|  24.1k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EDn:
  187|  6.03k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEED2Ev:
  206|  18.1k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE7destroyEv:
  239|  18.1k|  void destroy() noexcept {
  240|  18.1k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 18.1k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  18.1k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2Ev:
  186|  6.03k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEED2Ev:
  206|   102k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE7destroyEv:
  239|   102k|  void destroy() noexcept {
  240|   102k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 30.1k, False: 72.4k]
  ------------------
  241|  30.1k|      handle_(action::destroy, &storage_, nullptr);
  242|  30.1k|      handle_ = nullptr;
  243|  30.1k|    }
  244|   102k|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2Ev:
  186|  2.12M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2Ev:
  186|  2.15M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2Ev:
  186|  2.13M|  any_invocable_impl() noexcept = default;
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJEEcvbEv:
  228|  2.09M|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEED2Ev:
  206|  2.13M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE7destroyEv:
  239|  2.13M|  void destroy() noexcept {
  240|  2.13M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 2.73k, False: 2.13M]
  ------------------
  241|  2.73k|      handle_(action::destroy, &storage_, nullptr);
  242|  2.73k|      handle_ = nullptr;
  243|  2.73k|    }
  244|  2.13M|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEED2Ev:
  206|  2.17M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE7destroyEv:
  239|  2.17M|  void destroy() noexcept {
  240|  2.17M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 2.17M]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  2.17M|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEclES1_S6_b:
  345|  45.9k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  45.9k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  45.9k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE4callES2_S7_b:
  246|  45.9k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  45.9k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  45.9k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEclES1_S4_:
  345|  49.7k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  49.7k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  49.7k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE4callES2_S5_:
  246|  49.7k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  49.7k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  49.7k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEC2IZZNS2_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS1_S4_E_vEEOT_:
  303|   368k|    any_invocable(F&& f) {                                                     \
  304|   368k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   368k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEEC2Ev:
  186|   368k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE6createIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_JSE_EEEvDpOT0_:
  232|   368k|  void create(Args&&... args) {
  233|   368k|    using hdl = handler<F>;
  234|   368k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   368k|    handle_ = &hdl::handle;
  236|   368k|    call_ = &hdl::call;
  237|   368k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|   368k|    static void create(storage& s, Args&&... args) {
  119|   368k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE12handler_baseINS6_13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESC_SD_iEUlS2_S5_E_EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|   368k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   368k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 368k]
  ------------------
  105|   368k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 368k, False: 0]
  ------------------
  106|   368k|          Derived::destroy(*current);
  107|   368k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 368k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   368k|      }
  112|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E7destroyERNS0_7storageE:
  122|   368k|    static void destroy(storage& s) noexcept {
  123|   368k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   368k|      value.~T();
  125|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E4callERNS0_7storageES2_S5_:
  132|  49.7k|    static R call(storage& s, ArgTypes... args) {
  133|  49.7k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  49.7k|                         std::forward<ArgTypes>(args)...);
  135|  49.7k|    }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEclES7_:
  345|  60.6k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  60.6k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  60.6k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE4callES8_:
  246|  60.6k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  60.6k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  60.6k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEcvbEv:
  228|  48.6k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEED2Ev:
  206|   368k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE7destroyEv:
  239|   368k|  void destroy() noexcept {
  240|   368k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 368k, False: 0]
  ------------------
  241|   368k|      handle_(action::destroy, &storage_, nullptr);
  242|   368k|      handle_ = nullptr;
  243|   368k|    }
  244|   368k|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2IZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS1_S6_bE_vEEOT_:
  303|   368k|    any_invocable(F&& f) {                                                     \
  304|   368k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   368k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEEC2Ev:
  186|   368k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE6createIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_JSH_EEEvDpOT0_:
  232|   368k|  void create(Args&&... args) {
  233|   368k|    using hdl = handler<F>;
  234|   368k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   368k|    handle_ = &hdl::handle;
  236|   368k|    call_ = &hdl::call;
  237|   368k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  118|   368k|    static void create(storage& s, Args&&... args) {
  119|   368k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE12handler_baseINS8_13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESF_SG_iEUlS2_S7_bE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  103|   368k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   368k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 368k]
  ------------------
  105|   368k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 368k, False: 0]
  ------------------
  106|   368k|          Derived::destroy(*current);
  107|   368k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 368k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   368k|      }
  112|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E7destroyERNS0_7storageE:
  122|   368k|    static void destroy(storage& s) noexcept {
  123|   368k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   368k|      value.~T();
  125|   368k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E4callERNS0_7storageES2_S7_b:
  132|  45.9k|    static R call(storage& s, ArgTypes... args) {
  133|  45.9k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  45.9k|                         std::forward<ArgTypes>(args)...);
  135|  45.9k|    }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEclES5_b:
  345|  35.1k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  35.1k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  35.1k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4callES6_b:
  246|  35.1k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  35.1k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  35.1k|  }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEaSIDnDnEENS1_9enable_ifIXaantsr3stdE9is_same_vIT0_S7_Esr3stdE23is_move_constructible_vISA_EERS7_E4typeEOT_:
  335|  1.59k|    operator=(F&& f) {                                                         \
  336|  1.59k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  1.59k|      return *this;                                                            \
  338|  1.59k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EDn:
  187|  1.59k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4swapERS7_:
  208|  7.06k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  7.06k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 2.73k, False: 4.33k]
  ------------------
  210|  2.73k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 2.73k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  2.73k|      } else {
  218|  2.73k|        rhs.swap(*this);
  219|  2.73k|      }
  220|  4.33k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 4.33k, False: 0]
  ------------------
  221|  4.33k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  4.33k|      handle_ = rhs.handle_;
  223|  4.33k|      call_ = rhs.call_;
  224|  4.33k|      rhs.handle_ = nullptr;
  225|  4.33k|    }
  226|  7.06k|  }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEED2Ev:
  206|   368k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE7destroyEv:
  239|   368k|  void destroy() noexcept {
  240|   368k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 368k, False: 0]
  ------------------
  241|   368k|      handle_(action::destroy, &storage_, nullptr);
  242|   368k|      handle_ = nullptr;
  243|   368k|    }
  244|   368k|  }
_ZNK5ofats10any_detail18any_invocable_implIbLb0EJmEEcvbEv:
  228|  3.57k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE4swapERS2_:
  208|  46.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  46.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 46.1k]
  ------------------
  210|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 0]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|      0|      } else {
  218|      0|        rhs.swap(*this);
  219|      0|      }
  220|  46.1k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 46.1k]
  ------------------
  221|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|      0|      handle_ = rhs.handle_;
  223|      0|      call_ = rhs.call_;
  224|      0|      rhs.handle_ = nullptr;
  225|      0|    }
  226|  46.1k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2EOS5_:
  188|  12.0k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  12.0k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 12.0k, False: 0]
  ------------------
  190|  12.0k|      handle_ = rhs.handle_;
  191|  12.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  12.0k|      call_ = rhs.call_;
  193|  12.0k|      rhs.handle_ = nullptr;
  194|  12.0k|    }
  195|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E_vEEOSK_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2Ev:
  186|  12.0k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_JSN_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  12.0k|    static void create(storage& s, Args&&... args) {
  119|  12.0k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  12.0k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  12.0k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 12.0k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 6.03k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  6.03k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 6.03k, False: 6.03k]
  ------------------
  109|  6.03k|          Derived::move(*current, *other);
  110|  6.03k|          break;
  111|  12.0k|      }
  112|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E7destroyERNS0_7storageE:
  122|  12.0k|    static void destroy(storage& s) noexcept {
  123|  12.0k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  12.0k|      value.~T();
  125|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4moveERNS0_7storageESQ_:
  127|  6.03k|    static void move(storage& dst, storage& src) noexcept {
  128|  6.03k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  6.03k|      destroy(src);
  130|  6.03k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4callERNS0_7storageES4_:
  132|  1.45M|    static R call(storage& s, ArgTypes... args) {
  133|  1.45M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.45M|                         std::forward<ArgTypes>(args)...);
  135|  1.45M|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E0_vEEOSK_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_JSN_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  12.0k|    static void create(storage& s, Args&&... args) {
  119|  12.0k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E0_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  12.0k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  12.0k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 12.0k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 6.03k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  6.03k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 6.03k, False: 6.03k]
  ------------------
  109|  6.03k|          Derived::move(*current, *other);
  110|  6.03k|          break;
  111|  12.0k|      }
  112|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E7destroyERNS0_7storageE:
  122|  12.0k|    static void destroy(storage& s) noexcept {
  123|  12.0k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  12.0k|      value.~T();
  125|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4moveERNS0_7storageESQ_:
  127|  6.03k|    static void move(storage& dst, storage& src) noexcept {
  128|  6.03k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  6.03k|      destroy(src);
  130|  6.03k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4callERNS0_7storageES4_:
  132|  1.45M|    static R call(storage& s, ArgTypes... args) {
  133|  1.45M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.45M|                         std::forward<ArgTypes>(args)...);
  135|  1.45M|    }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|  67.1k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_iSA_:
  345|  65.8k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  65.8k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  65.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_iSB_:
  246|  65.8k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  65.8k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  65.8k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEcvbEv:
  228|  17.0k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEclES5_SA_SB_:
  345|  13.7k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  13.7k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  13.7k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4callES6_SB_SC_:
  246|  13.7k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  13.7k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  13.7k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|  8.50k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_SA_:
  345|  6.82k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  6.82k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  6.82k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_SB_:
  246|  6.82k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  6.82k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  6.82k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEcvbEv:
  228|  38.8k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEclES5_:
  345|  37.4k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  37.4k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  37.4k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4callES6_:
  246|  37.4k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  37.4k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  37.4k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EOS2_:
  188|  33.6k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  33.6k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 33.6k, False: 0]
  ------------------
  190|  33.6k|      handle_ = rhs.handle_;
  191|  33.6k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  33.6k|      call_ = rhs.call_;
  193|  33.6k|      rhs.handle_ = nullptr;
  194|  33.6k|    }
  195|  33.6k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_vEEOSI_:
  303|  12.0k|    any_invocable(F&& f) {                                                     \
  304|  12.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  12.0k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_JSL_EEEvDpOT0_:
  232|  12.0k|  void create(Args&&... args) {
  233|  12.0k|    using hdl = handler<F>;
  234|  12.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  12.0k|    handle_ = &hdl::handle;
  236|  12.0k|    call_ = &hdl::call;
  237|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E6createIJSL_EEEvRNS0_7storageEDpOT_:
  118|  30.1k|    static void create(storage& s, Args&&... args) {
  119|  30.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  30.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS7_NSt3__112basic_stringIcNSB_11char_traitsIcEENSB_9allocatorIcEEEEONS7_17WebSocketBehaviorIT_EEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESR_:
  103|  30.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  30.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 30.1k]
  ------------------
  105|  12.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 12.0k, False: 18.1k]
  ------------------
  106|  12.0k|          Derived::destroy(*current);
  107|  12.0k|          break;
  108|  18.1k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 18.1k, False: 12.0k]
  ------------------
  109|  18.1k|          Derived::move(*current, *other);
  110|  18.1k|          break;
  111|  30.1k|      }
  112|  30.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E7destroyERNS0_7storageE:
  122|  30.1k|    static void destroy(storage& s) noexcept {
  123|  30.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  30.1k|      value.~T();
  125|  30.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4moveERNS0_7storageESO_:
  127|  18.1k|    static void move(storage& dst, storage& src) noexcept {
  128|  18.1k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  18.1k|      destroy(src);
  130|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4callERNS0_7storageE:
  132|  12.0k|    static R call(storage& s, ArgTypes... args) {
  133|  12.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  12.0k|                         std::forward<ArgTypes>(args)...);
  135|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEaSEOS7_:
  197|  24.1k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  24.1k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  24.1k|    return *this;
  200|  24.1k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EOS7_:
  188|  72.4k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  72.4k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 12.0k, False: 60.3k]
  ------------------
  190|  12.0k|      handle_ = rhs.handle_;
  191|  12.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  12.0k|      call_ = rhs.call_;
  193|  12.0k|      rhs.handle_ = nullptr;
  194|  12.0k|    }
  195|  72.4k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4swapERS7_:
  208|  36.2k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  36.2k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 12.0k, False: 24.1k]
  ------------------
  210|  12.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 12.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  12.0k|      } else {
  218|  12.0k|        rhs.swap(*this);
  219|  12.0k|      }
  220|  24.1k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 12.0k, False: 12.0k]
  ------------------
  221|  12.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  12.0k|      handle_ = rhs.handle_;
  223|  12.0k|      call_ = rhs.call_;
  224|  12.0k|      rhs.handle_ = nullptr;
  225|  12.0k|    }
  226|  36.2k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEaSEOSD_:
  197|  12.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  12.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  12.0k|    return *this;
  200|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EOSD_:
  188|  36.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  36.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 6.03k, False: 30.1k]
  ------------------
  190|  6.03k|      handle_ = rhs.handle_;
  191|  6.03k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  6.03k|      call_ = rhs.call_;
  193|  6.03k|      rhs.handle_ = nullptr;
  194|  6.03k|    }
  195|  36.2k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4swapERSD_:
  208|  18.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  18.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 6.03k, False: 12.0k]
  ------------------
  210|  6.03k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 6.03k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  6.03k|      } else {
  218|  6.03k|        rhs.swap(*this);
  219|  6.03k|      }
  220|  12.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 6.03k, False: 6.03k]
  ------------------
  221|  6.03k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  6.03k|      handle_ = rhs.handle_;
  223|  6.03k|      call_ = rhs.call_;
  224|  6.03k|      rhs.handle_ = nullptr;
  225|  6.03k|    }
  226|  18.1k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEaSEOSC_:
  197|  12.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  12.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  12.0k|    return *this;
  200|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EOSC_:
  188|  36.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  36.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 36.2k]
  ------------------
  190|      0|      handle_ = rhs.handle_;
  191|      0|      handle_(action::move, &storage_, &rhs.storage_);
  192|      0|      call_ = rhs.call_;
  193|      0|      rhs.handle_ = nullptr;
  194|      0|    }
  195|  36.2k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE4swapERSC_:
  208|  12.0k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  12.0k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 12.0k]
  ------------------
  210|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 0]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|      0|      } else {
  218|      0|        rhs.swap(*this);
  219|      0|      }
  220|  12.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 12.0k]
  ------------------
  221|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|      0|      handle_ = rhs.handle_;
  223|      0|      call_ = rhs.call_;
  224|      0|      rhs.handle_ = nullptr;
  225|      0|    }
  226|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  48.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  48.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 12.0k, False: 36.2k]
  ------------------
  190|  12.0k|      handle_ = rhs.handle_;
  191|  12.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  12.0k|      call_ = rhs.call_;
  193|  12.0k|      rhs.handle_ = nullptr;
  194|  12.0k|    }
  195|  48.2k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEaSIZNS1_12TemplatedAppILb0EE2wsIS3_EEOSF_NS6_12basic_stringIcS9_NS6_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS5_iSA_E_SQ_EENS6_9enable_ifIXaantsr3stdE9is_same_vIT0_SC_Esr3stdE23is_move_constructible_vISS_EERSC_E4typeEOSN_:
  335|  12.0k|    operator=(F&& f) {                                                         \
  336|  12.0k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  12.0k|      return *this;                                                            \
  338|  12.0k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZNS1_12TemplatedAppILb0EE2wsIS3_EEOSF_NS6_12basic_stringIcS9_NS6_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS5_iSA_E_vEEOSN_:
  303|  12.0k|    any_invocable(F&& f) {                                                     \
  304|  12.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  12.0k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  18.1k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSF_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS6_iSB_E_JSQ_EEEvDpOT0_:
  232|  12.0k|  void create(Args&&... args) {
  233|  12.0k|    using hdl = handler<F>;
  234|  12.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  12.0k|    handle_ = &hdl::handle;
  236|  12.0k|    call_ = &hdl::call;
  237|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSF_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS6_iSB_E_E6createIJSQ_EEEvRNS0_7storageEDpOT_:
  141|  12.0k|    static void create(storage& s, Args&&... args) {
  142|  12.0k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13large_handlerIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSG_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSG_17WebSocketBehaviorIT_EEEUlS6_iSB_E_EEE6handleENS0_6actionEPNS0_7storageESW_:
  103|  24.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  24.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 24.1k]
  ------------------
  105|  12.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 12.0k, False: 12.0k]
  ------------------
  106|  12.0k|          Derived::destroy(*current);
  107|  12.0k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 12.0k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  24.1k|      }
  112|  24.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSF_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS6_iSB_E_E7destroyERNS0_7storageE:
  145|  12.0k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSF_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS6_iSB_E_E4moveERNS0_7storageEST_:
  147|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  148|  12.0k|      dst.ptr_ = src.ptr_;
  149|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIS4_EEOSF_NS7_12basic_stringIcSA_NS7_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS6_iSB_E_E4callERNS0_7storageES6_iSB_:
  151|  33.5k|    static R call(storage& s, ArgTypes... args) {
  152|  33.5k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  33.5k|                         std::forward<ArgTypes>(args)...);
  154|  33.5k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  24.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  24.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 12.0k, False: 12.0k]
  ------------------
  210|  12.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 12.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  12.0k|      } else {
  218|  12.0k|        rhs.swap(*this);
  219|  12.0k|      }
  220|  12.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 12.0k, False: 0]
  ------------------
  221|  12.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  12.0k|      handle_ = rhs.handle_;
  223|  12.0k|      call_ = rhs.call_;
  224|  12.0k|      rhs.handle_ = nullptr;
  225|  12.0k|    }
  226|  24.1k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEaSEOSC_:
  197|  24.1k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  24.1k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  24.1k|    return *this;
  200|  24.1k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  72.4k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  72.4k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 12.0k, False: 60.3k]
  ------------------
  190|  12.0k|      handle_ = rhs.handle_;
  191|  12.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  12.0k|      call_ = rhs.call_;
  193|  12.0k|      rhs.handle_ = nullptr;
  194|  12.0k|    }
  195|  72.4k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  36.2k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  36.2k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 12.0k, False: 24.1k]
  ------------------
  210|  12.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 12.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  12.0k|      } else {
  218|  12.0k|        rhs.swap(*this);
  219|  12.0k|      }
  220|  24.1k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 12.0k, False: 12.0k]
  ------------------
  221|  12.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  12.0k|      handle_ = rhs.handle_;
  223|  12.0k|      call_ = rhs.call_;
  224|  12.0k|      rhs.handle_ = nullptr;
  225|  12.0k|    }
  226|  36.2k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEcvbEv:
  228|  30.1k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2EOS9_:
  188|  72.4k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  72.4k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 72.4k, False: 0]
  ------------------
  190|  72.4k|      handle_ = rhs.handle_;
  191|  72.4k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  72.4k|      call_ = rhs.call_;
  193|  72.4k|      rhs.handle_ = nullptr;
  194|  72.4k|    }
  195|  72.4k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2EOS8_:
  188|  60.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  60.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 60.3k, False: 0]
  ------------------
  190|  60.3k|      handle_ = rhs.handle_;
  191|  60.3k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  60.3k|      call_ = rhs.call_;
  193|  60.3k|      rhs.handle_ = nullptr;
  194|  60.3k|    }
  195|  60.3k|  }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEC2IZNS1_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS0_IFvPNS1_12HttpResponseILb0EEEPNS1_11HttpRequestEEEEbEUlPT_E_vEEOSS_:
  303|  30.1k|    any_invocable(F&& f) {                                                     \
  304|  30.1k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  30.1k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2Ev:
  186|  30.1k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE6createIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_JSV_EEEvDpOT0_:
  232|  30.1k|  void create(Args&&... args) {
  233|  30.1k|    using hdl = handler<F>;
  234|  30.1k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  30.1k|    handle_ = &hdl::handle;
  236|  30.1k|    call_ = &hdl::call;
  237|  30.1k|  }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E6createIJSV_EEEvRNS0_7storageEDpOT_:
  141|  30.1k|    static void create(storage& s, Args&&... args) {
  142|  30.1k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  30.1k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE12handler_baseINS9_13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSE_11char_traitsIcEENSE_9allocatorIcEEEESK_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_EEE6handleENS0_6actionEPNS0_7storageES11_:
  103|   102k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   102k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 102k]
  ------------------
  105|  30.1k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 30.1k, False: 72.4k]
  ------------------
  106|  30.1k|          Derived::destroy(*current);
  107|  30.1k|          break;
  108|  72.4k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 72.4k, False: 30.1k]
  ------------------
  109|  72.4k|          Derived::move(*current, *other);
  110|  72.4k|          break;
  111|   102k|      }
  112|   102k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E7destroyERNS0_7storageE:
  145|  30.1k|    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_:
  147|  72.4k|    static void move(storage& dst, storage& src) noexcept {
  148|  72.4k|      dst.ptr_ = src.ptr_;
  149|  72.4k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4callERNS0_7storageES8_:
  151|  60.6k|    static R call(storage& s, ArgTypes... args) {
  152|  60.6k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  60.6k|                         std::forward<ArgTypes>(args)...);
  154|  60.6k|    }
_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEclES4_S6_:
  345|  60.6k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  60.6k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  60.6k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE4callES5_S7_:
  246|  60.6k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  60.6k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  60.6k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EOSA_:
  188|  24.1k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  24.1k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 24.1k]
  ------------------
  190|      0|      handle_ = rhs.handle_;
  191|      0|      handle_(action::move, &storage_, &rhs.storage_);
  192|      0|      call_ = rhs.call_;
  193|      0|      rhs.handle_ = nullptr;
  194|      0|    }
  195|  24.1k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_vEEOSN_:
  303|  12.0k|    any_invocable(F&& f) {                                                     \
  304|  12.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  12.0k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2Ev:
  186|  30.1k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_JST_EEEvDpOT0_:
  232|  12.0k|  void create(Args&&... args) {
  233|  12.0k|    using hdl = handler<F>;
  234|  12.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  12.0k|    handle_ = &hdl::handle;
  236|  12.0k|    call_ = &hdl::call;
  237|  12.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E6createIJST_EEEvRNS0_7storageEDpOT_:
  141|  12.0k|    static void create(storage& s, Args&&... args) {
  142|  12.0k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSC_NSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEEONSC_17WebSocketBehaviorIT_EEEUlPSO_PT0_E_EEE6handleENS0_6actionEPNS0_7storageESZ_:
  103|  36.2k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  36.2k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 36.2k]
  ------------------
  105|  12.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 12.0k, False: 24.1k]
  ------------------
  106|  12.0k|          Derived::destroy(*current);
  107|  12.0k|          break;
  108|  24.1k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 24.1k, False: 12.0k]
  ------------------
  109|  24.1k|          Derived::move(*current, *other);
  110|  24.1k|          break;
  111|  36.2k|      }
  112|  36.2k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E7destroyERNS0_7storageE:
  145|  12.0k|    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_:
  147|  24.1k|    static void move(storage& dst, storage& src) noexcept {
  148|  24.1k|      dst.ptr_ = src.ptr_;
  149|  24.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4callERNS0_7storageES5_S7_:
  151|  46.0k|    static R call(storage& s, ArgTypes... args) {
  152|  46.0k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  46.0k|                         std::forward<ArgTypes>(args)...);
  154|  46.0k|    }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEcvbEv:
  228|  33.5k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats13any_invocableIFvvEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|  46.1k|    operator=(F&& f) {                                                         \
  336|  46.1k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  46.1k|      return *this;                                                            \
  338|  46.1k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EDn:
  187|  46.1k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4swapERS2_:
  208|  51.5k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  51.5k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 2.73k, False: 48.8k]
  ------------------
  210|  2.73k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 2.73k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  2.73k|      } else {
  218|  2.73k|        rhs.swap(*this);
  219|  2.73k|      }
  220|  48.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 4.33k, False: 44.5k]
  ------------------
  221|  4.33k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  4.33k|      handle_ = rhs.handle_;
  223|  4.33k|      call_ = rhs.call_;
  224|  4.33k|      rhs.handle_ = nullptr;
  225|  4.33k|    }
  226|  51.5k|  }
_ZN5ofats13any_invocableIFbmEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|  46.1k|    operator=(F&& f) {                                                         \
  336|  46.1k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  46.1k|      return *this;                                                            \
  338|  46.1k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2EDn:
  187|  46.1k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_0vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_0JSA_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_0EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4moveERNS0_7storageESD_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4callERNS0_7storageES5_S7_:
  132|  8.50k|    static R call(storage& s, ArgTypes... args) {
  133|  8.50k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  8.50k|                         std::forward<ArgTypes>(args)...);
  135|  8.50k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_1vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_1JSA_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_1EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4moveERNS0_7storageESD_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4callERNS0_7storageES5_S7_:
  132|  2.73k|    static R call(storage& s, ArgTypes... args) {
  133|  2.73k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  2.73k|                         std::forward<ArgTypes>(args)...);
  135|  2.73k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEaSEOS2_:
  197|  2.73k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  2.73k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  2.73k|    return *this;
  200|  2.73k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_vEEOSA_:
  303|  2.73k|    any_invocable(F&& f) {                                                     \
  304|  2.73k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  2.73k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_JSE_EEEvDpOT0_:
  232|  2.73k|  void create(Args&&... args) {
  233|  2.73k|    using hdl = handler<F>;
  234|  2.73k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  2.73k|    handle_ = &hdl::handle;
  236|  2.73k|    call_ = &hdl::call;
  237|  2.73k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  9.79k|    static void create(storage& s, Args&&... args) {
  119|  9.79k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_EUlvE_EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  9.79k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  9.79k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 9.79k]
  ------------------
  105|  2.73k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 2.73k, False: 7.06k]
  ------------------
  106|  2.73k|          Derived::destroy(*current);
  107|  2.73k|          break;
  108|  7.06k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 7.06k, False: 2.73k]
  ------------------
  109|  7.06k|          Derived::move(*current, *other);
  110|  7.06k|          break;
  111|  9.79k|      }
  112|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E7destroyERNS0_7storageE:
  122|  9.79k|    static void destroy(storage& s) noexcept {
  123|  9.79k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  9.79k|      value.~T();
  125|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4moveERNS0_7storageESH_:
  127|  7.06k|    static void move(storage& dst, storage& src) noexcept {
  128|  7.06k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  7.06k|      destroy(src);
  130|  7.06k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4callERNS0_7storageE:
  132|  1.13k|    static R call(storage& s, ArgTypes... args) {
  133|  1.13k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.13k|                         std::forward<ArgTypes>(args)...);
  135|  1.13k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_vEEOSA_:
  303|  1.13k|    any_invocable(F&& f) {                                                     \
  304|  1.13k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  1.13k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_JSF_EEEvDpOT0_:
  232|  1.13k|  void create(Args&&... args) {
  233|  1.13k|    using hdl = handler<F>;
  234|  1.13k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  1.13k|    handle_ = &hdl::handle;
  236|  1.13k|    call_ = &hdl::call;
  237|  1.13k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  2.27k|    static void create(storage& s, Args&&... args) {
  119|  2.27k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  2.27k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  2.27k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  2.27k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 2.27k]
  ------------------
  105|  1.13k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 1.13k, False: 1.14k]
  ------------------
  106|  1.13k|          Derived::destroy(*current);
  107|  1.13k|          break;
  108|  1.14k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 1.14k, False: 1.13k]
  ------------------
  109|  1.14k|          Derived::move(*current, *other);
  110|  1.14k|          break;
  111|  2.27k|      }
  112|  2.27k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E7destroyERNS0_7storageE:
  122|  2.27k|    static void destroy(storage& s) noexcept {
  123|  2.27k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  2.27k|      value.~T();
  125|  2.27k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4moveERNS0_7storageESI_:
  127|  1.14k|    static void move(storage& dst, storage& src) noexcept {
  128|  1.14k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  1.14k|      destroy(src);
  130|  1.14k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4callERNS0_7storageE:
  132|  1.00k|    static R call(storage& s, ArgTypes... args) {
  133|  1.00k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.00k|                         std::forward<ArgTypes>(args)...);
  135|  1.00k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEaSEOS7_:
  197|  2.73k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  2.73k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  2.73k|    return *this;
  200|  2.73k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EOS7_:
  188|  2.73k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  2.73k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 2.73k, False: 0]
  ------------------
  190|  2.73k|      handle_ = rhs.handle_;
  191|  2.73k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  2.73k|      call_ = rhs.call_;
  193|  2.73k|      rhs.handle_ = nullptr;
  194|  2.73k|    }
  195|  2.73k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS5_bE_vEEOSF_:
  303|  2.73k|    any_invocable(F&& f) {                                                     \
  304|  2.73k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  2.73k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_JSJ_EEEvDpOT0_:
  232|  2.73k|  void create(Args&&... args) {
  233|  2.73k|    using hdl = handler<F>;
  234|  2.73k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  2.73k|    handle_ = &hdl::handle;
  236|  2.73k|    call_ = &hdl::call;
  237|  2.73k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E6createIJSJ_EEEvRNS0_7storageEDpOT_:
  118|  9.79k|    static void create(storage& s, Args&&... args) {
  119|  9.79k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE12handler_baseINS7_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSC_11HttpRequestEEEDaPT_PT0_EUlS6_bE_EEE6handleENS0_6actionEPNS0_7storageESP_:
  103|  9.79k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  9.79k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 9.79k]
  ------------------
  105|  2.73k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 2.73k, False: 7.06k]
  ------------------
  106|  2.73k|          Derived::destroy(*current);
  107|  2.73k|          break;
  108|  7.06k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 7.06k, False: 2.73k]
  ------------------
  109|  7.06k|          Derived::move(*current, *other);
  110|  7.06k|          break;
  111|  9.79k|      }
  112|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E7destroyERNS0_7storageE:
  122|  9.79k|    static void destroy(storage& s) noexcept {
  123|  9.79k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  9.79k|      value.~T();
  125|  9.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4moveERNS0_7storageESM_:
  127|  7.06k|    static void move(storage& dst, storage& src) noexcept {
  128|  7.06k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  7.06k|      destroy(src);
  130|  7.06k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4callERNS0_7storageES6_b:
  132|  35.1k|    static R call(storage& s, ArgTypes... args) {
  133|  35.1k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  35.1k|                         std::forward<ArgTypes>(args)...);
  135|  35.1k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_vEEOSA_:
  303|  1.59k|    any_invocable(F&& f) {                                                     \
  304|  1.59k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  1.59k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_JSK_EEEvDpOT0_:
  232|  1.59k|  void create(Args&&... args) {
  233|  1.59k|    using hdl = handler<F>;
  234|  1.59k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  1.59k|    handle_ = &hdl::handle;
  236|  1.59k|    call_ = &hdl::call;
  237|  1.59k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E6createIJSK_EEEvRNS0_7storageEDpOT_:
  141|  1.59k|    static void create(storage& s, Args&&... args) {
  142|  1.59k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  1.59k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSF_11char_traitsIcEEEEbE_clESJ_bEUlvE_EEE6handleENS0_6actionEPNS0_7storageESQ_:
  103|  1.59k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  1.59k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 1.59k]
  ------------------
  105|  1.59k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 1.59k, False: 0]
  ------------------
  106|  1.59k|          Derived::destroy(*current);
  107|  1.59k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 1.59k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|  1.59k|      }
  112|  1.59k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E7destroyERNS0_7storageE:
  145|  1.59k|    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:
  151|  1.59k|    static R call(storage& s, ArgTypes... args) {
  152|  1.59k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  1.59k|                         std::forward<ArgTypes>(args)...);
  154|  1.59k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_2vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_2JSA_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_2EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4moveERNS0_7storageESD_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4callERNS0_7storageES5_S7_:
  132|  3.36k|    static R call(storage& s, ArgTypes... args) {
  133|  3.36k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  3.36k|                         std::forward<ArgTypes>(args)...);
  135|  3.36k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_3vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2Ev:
  186|  12.0k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_3JS9_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_3EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4moveERNS0_7storageESC_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4callERNS0_7storageES6_:
  132|  32.3k|    static R call(storage& s, ArgTypes... args) {
  133|  32.3k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  32.3k|                         std::forward<ArgTypes>(args)...);
  135|  32.3k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEC2IZ4testvE3$_4vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2Ev:
  186|  6.03k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE6createIZ4testvE3$_4JSF_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE12handler_baseINSD_13small_handlerIZ4testvE3$_4EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4moveERNS0_7storageESI_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4callERNS0_7storageES6_SB_SC_:
  132|  13.7k|    static R call(storage& s, ArgTypes... args) {
  133|  13.7k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  13.7k|                         std::forward<ArgTypes>(args)...);
  135|  13.7k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_5vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_5JS9_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_5EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4moveERNS0_7storageESC_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4callERNS0_7storageES6_:
  132|  5.10k|    static R call(storage& s, ArgTypes... args) {
  133|  5.10k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  5.10k|                         std::forward<ArgTypes>(args)...);
  135|  5.10k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_6vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  12.0k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_6JSE_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_6EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4moveERNS0_7storageESH_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4callERNS0_7storageES6_SB_:
  132|  5.81k|    static R call(storage& s, ArgTypes... args) {
  133|  5.81k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  5.81k|                         std::forward<ArgTypes>(args)...);
  135|  5.81k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_vEEOSA_:
  303|  5.81k|    any_invocable(F&& f) {                                                     \
  304|  5.81k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.81k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_JSH_EEEvDpOT0_:
  232|  5.81k|  void create(Args&&... args) {
  233|  5.81k|    using hdl = handler<F>;
  234|  5.81k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.81k|    handle_ = &hdl::handle;
  236|  5.81k|    call_ = &hdl::call;
  237|  5.81k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  118|  17.5k|    static void create(storage& s, Args&&... args) {
  119|  17.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.5k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSD_11char_traitsIcEEEEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  103|  17.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.5k]
  ------------------
  105|  5.81k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.81k, False: 11.6k]
  ------------------
  106|  5.81k|          Derived::destroy(*current);
  107|  5.81k|          break;
  108|  11.6k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.6k, False: 5.81k]
  ------------------
  109|  11.6k|          Derived::move(*current, *other);
  110|  11.6k|          break;
  111|  17.5k|      }
  112|  17.5k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E7destroyERNS0_7storageE:
  122|  17.5k|    static void destroy(storage& s) noexcept {
  123|  17.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.5k|      value.~T();
  125|  17.5k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4moveERNS0_7storageESK_:
  127|  11.6k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.6k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.6k|      destroy(src);
  130|  11.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4callERNS0_7storageE:
  132|  4.20k|    static R call(storage& s, ArgTypes... args) {
  133|  4.20k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  4.20k|                         std::forward<ArgTypes>(args)...);
  135|  4.20k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_7vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_7JSE_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_7EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E4moveERNS0_7storageESH_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E4callERNS0_7storageES6_SB_:
  132|  1.00k|    static R call(storage& s, ArgTypes... args) {
  133|  1.00k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.00k|                         std::forward<ArgTypes>(args)...);
  135|  1.00k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_8vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_8JSE_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  18.1k|    static void create(storage& s, Args&&... args) {
  119|  18.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_8EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  18.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  18.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 18.1k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 12.0k]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|  12.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 12.0k, False: 6.03k]
  ------------------
  109|  12.0k|          Derived::move(*current, *other);
  110|  12.0k|          break;
  111|  18.1k|      }
  112|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E7destroyERNS0_7storageE:
  122|  18.1k|    static void destroy(storage& s) noexcept {
  123|  18.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  18.1k|      value.~T();
  125|  18.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4moveERNS0_7storageESH_:
  127|  12.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  12.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  12.0k|      destroy(src);
  130|  12.0k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4callERNS0_7storageES6_iSB_:
  132|  32.3k|    static R call(storage& s, ArgTypes... args) {
  133|  32.3k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  32.3k|                         std::forward<ArgTypes>(args)...);
  135|  32.3k|    }
_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEclES2_:
  345|  6.03k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  6.03k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  6.03k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE4callES3_:
  246|  6.03k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  6.03k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEC2IZ4testvE3$_9vEEOT_:
  303|  6.03k|    any_invocable(F&& f) {                                                     \
  304|  6.03k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  6.03k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEEC2Ev:
  186|  6.03k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE6createIZ4testvE3$_9JS6_EEEvDpOT0_:
  232|  6.03k|  void create(Args&&... args) {
  233|  6.03k|    using hdl = handler<F>;
  234|  6.03k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  6.03k|    handle_ = &hdl::handle;
  236|  6.03k|    call_ = &hdl::call;
  237|  6.03k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E6createIJS6_EEEvRNS0_7storageEDpOT_:
  118|  6.03k|    static void create(storage& s, Args&&... args) {
  119|  6.03k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  6.03k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE12handler_baseINS4_13small_handlerIZ4testvE3$_9EEE6handleENS0_6actionEPNS0_7storageESC_:
  103|  6.03k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  6.03k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 6.03k]
  ------------------
  105|  6.03k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 6.03k, False: 0]
  ------------------
  106|  6.03k|          Derived::destroy(*current);
  107|  6.03k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 6.03k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|  6.03k|      }
  112|  6.03k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E7destroyERNS0_7storageE:
  122|  6.03k|    static void destroy(storage& s) noexcept {
  123|  6.03k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  6.03k|      value.~T();
  125|  6.03k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E4callERNS0_7storageES3_:
  132|  6.03k|    static R call(storage& s, ArgTypes... args) {
  133|  6.03k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  6.03k|                         std::forward<ArgTypes>(args)...);
  135|  6.03k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEaSEOS4_:
  197|  6.03k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  6.03k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  6.03k|    return *this;
  200|  6.03k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EOS4_:
  188|  6.03k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  6.03k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 6.03k]
  ------------------
  190|      0|      handle_ = rhs.handle_;
  191|      0|      handle_(action::move, &storage_, &rhs.storage_);
  192|      0|      call_ = rhs.call_;
  193|      0|      rhs.handle_ = nullptr;
  194|      0|    }
  195|  6.03k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE4swapERS4_:
  208|  6.03k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  6.03k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 6.03k]
  ------------------
  210|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 0]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|      0|      } else {
  218|      0|        rhs.swap(*this);
  219|      0|      }
  220|  6.03k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 6.03k]
  ------------------
  221|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|      0|      handle_ = rhs.handle_;
  223|      0|      call_ = rhs.call_;
  224|      0|      rhs.handle_ = nullptr;
  225|      0|    }
  226|  6.03k|  }

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

EpollHelloWorld.cpp:_ZN3uWSL20getDecodedQueryValueENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEES4_:
   28|  3.36k|    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|  3.36k|        if (!key.length()) {
  ------------------
  |  Branch (31:13): [True: 0, False: 3.36k]
  ------------------
   32|      0|            return {};
   33|      0|        }
   34|       |
   35|       |        /* Start with the whole querystring including initial '?' */
   36|  3.36k|        std::string_view queryString = rawQuery;
   37|       |
   38|       |        /* List of key, value could be cached for repeated fetches similar to how headers are, todo! */
   39|  6.28k|        while (queryString.length()) {
  ------------------
  |  Branch (39:16): [True: 4.22k, False: 2.06k]
  ------------------
   40|       |            /* Find boundaries of this statement */
   41|  4.22k|            std::string_view statement = queryString.substr(1, queryString.find('&', 1) - 1);
   42|       |
   43|       |            /* Only bother if first char of key match (early exit) */
   44|  4.22k|            if (statement.length() && statement[0] == key[0]) {
  ------------------
  |  Branch (44:17): [True: 2.69k, False: 1.52k]
  |  Branch (44:39): [True: 2.35k, False: 346]
  ------------------
   45|       |                /* Equal sign must be present and not in the end of statement */
   46|  2.35k|                auto equality = statement.find('=');
   47|  2.35k|                if (equality != std::string_view::npos) {
  ------------------
  |  Branch (47:21): [True: 2.07k, False: 277]
  ------------------
   48|       |
   49|  2.07k|                    std::string_view statementKey = statement.substr(0, equality);
   50|  2.07k|                    std::string_view statementValue = statement.substr(equality + 1);
   51|       |
   52|       |                    /* String comparison */
   53|  2.07k|                    if (key == statementKey) {
  ------------------
  |  Branch (53:25): [True: 1.03k, False: 1.04k]
  ------------------
   54|       |
   55|       |                        /* Decode value inplace, put null at end if before length of original */
   56|  1.03k|                        char *in = (char *) statementValue.data();
   57|       |
   58|       |                        /* Write offset */
   59|  1.03k|                        unsigned int out = 0;
   60|       |
   61|       |                        /* Walk over all chars until end or null char, decoding in place */
   62|  8.81k|                        for (unsigned int i = 0; i < statementValue.length() && in[i]; i++) {
  ------------------
  |  Branch (62:50): [True: 8.09k, False: 717]
  |  Branch (62:81): [True: 8.09k, False: 0]
  ------------------
   63|       |                                /* Only bother with '%' */
   64|  8.09k|                                if (in[i] == '%') {
  ------------------
  |  Branch (64:37): [True: 1.95k, False: 6.13k]
  ------------------
   65|       |                                    /* Do we have enough data for two bytes hex? */
   66|  1.95k|                                    if (i + 2 >= statementValue.length()) {
  ------------------
  |  Branch (66:41): [True: 313, False: 1.64k]
  ------------------
   67|    313|                                        return {};
   68|    313|                                    }
   69|       |
   70|       |                                    /* Two bytes hex */
   71|  1.64k|                                    int hex1 = in[i + 1] - '0';
   72|  1.64k|                                    if (hex1 > 9) {
  ------------------
  |  Branch (72:41): [True: 1.30k, False: 346]
  ------------------
   73|  1.30k|                                        hex1 &= 223;
   74|  1.30k|                                        hex1 -= 7;
   75|  1.30k|                                    }
   76|       |
   77|  1.64k|                                    int hex2 = in[i + 2] - '0';
   78|  1.64k|                                    if (hex2 > 9) {
  ------------------
  |  Branch (78:41): [True: 856, False: 790]
  ------------------
   79|    856|                                        hex2 &= 223;
   80|    856|                                        hex2 -= 7;
   81|    856|                                    }
   82|       |
   83|  1.64k|                                    *((unsigned char *) &in[out]) = (unsigned char) (hex1 * 16 + hex2);
   84|  1.64k|                                    i += 2;
   85|  6.13k|                                } else {
   86|       |                                    /* Is this even a rule? */
   87|  6.13k|                                    if (in[i] == '+') {
  ------------------
  |  Branch (87:41): [True: 408, False: 5.73k]
  ------------------
   88|    408|                                        in[out] = ' ';
   89|  5.73k|                                    } else {
   90|  5.73k|                                        in[out] = in[i];
   91|  5.73k|                                    }
   92|  6.13k|                                }
   93|       |
   94|       |                                /* We always only write one char */
   95|  7.78k|                                out++;
   96|  7.78k|                        }
   97|       |
   98|       |                        /* If decoded string is shorter than original, put null char to stop next read */
   99|    717|                        if (out < statementValue.length()) {
  ------------------
  |  Branch (99:29): [True: 295, False: 422]
  ------------------
  100|    295|                            in[out] = 0;
  101|    295|                        }
  102|       |
  103|    717|                        return statementValue.substr(0, out);
  104|  1.03k|                    }
  105|  2.07k|                } else {
  106|       |                    /* This querystring is invalid, cannot parse it */
  107|    277|                    return {nullptr, 0};
  108|    277|                }
  109|  2.35k|            }
  110|       |
  111|  2.91k|            queryString.remove_prefix(statement.length() + 1);
  112|  2.91k|        }
  113|       |
  114|       |        /* Nothing found is given as nullptr, while empty string is given as some pointer to the given buffer */
  115|  2.06k|        return {nullptr, 0};
  116|  3.36k|    }

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

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

EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE3endEiNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  190|  6.08k|    void end(int code = 0, std::string_view message = {}) {
  191|       |        /* Check if we already called this one */
  192|  6.08k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  193|  6.08k|        if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (193:13): [True: 0, False: 6.08k]
  ------------------
  194|      0|            return;
  195|      0|        }
  196|       |
  197|       |        /* We postpone any FIN sending to either drainage or uncorking */
  198|  6.08k|        webSocketData->isShuttingDown = true;
  199|       |
  200|       |        /* Format and send the close frame */
  201|  6.08k|        static const int MAX_CLOSE_PAYLOAD = 123;
  202|  6.08k|        size_t length = std::min<size_t>(MAX_CLOSE_PAYLOAD, message.length());
  203|  6.08k|        char closePayload[MAX_CLOSE_PAYLOAD + 2];
  204|  6.08k|        size_t closePayloadLength = protocol::formatClosePayload(closePayload, (uint16_t) code, message.data(), length);
  205|  6.08k|        bool ok = send(std::string_view(closePayload, closePayloadLength), OpCode::CLOSE);
  206|       |
  207|       |        /* FIN if we are ok and not corked */
  208|  6.08k|        if (!this->isCorked()) {
  ------------------
  |  Branch (208:13): [True: 0, False: 6.08k]
  ------------------
  209|      0|            if (ok) {
  ------------------
  |  Branch (209:17): [True: 0, False: 0]
  ------------------
  210|       |                /* If we are not corked, and we just sent off everything, we need to FIN right here.
  211|       |                 * In all other cases, we need to fin either if uncork was successful, or when drainage is complete. */
  212|      0|                this->shutdown();
  213|      0|            }
  214|      0|        }
  215|       |
  216|  6.08k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  217|  6.08k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  218|  6.08k|        );
  219|       |
  220|       |        /* Set shorter timeout (use ping-timeout) to avoid long hanging sockets after end() on broken connections */
  221|  6.08k|        Super::timeout(webSocketContextData->idleTimeoutComponents.second);
  222|       |
  223|       |        /* At this point we iterate all currently held subscriptions and emit an event for all of them */
  224|  6.08k|        if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (224:13): [True: 0, False: 6.08k]
  |  Branch (224:42): [True: 0, False: 0]
  ------------------
  225|      0|            for (Topic *t : webSocketData->subscriber->topics) {
  ------------------
  |  Branch (225:27): [True: 0, False: 0]
  ------------------
  226|      0|                webSocketContextData->subscriptionHandler(this, t->name, (int) t->size() - 1, (int) t->size());
  227|      0|            }
  228|      0|        }
  229|       |
  230|       |        /* Make sure to unsubscribe from any pub/sub node at exit */
  231|  6.08k|        webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  232|  6.08k|        webSocketData->subscriber = nullptr;
  233|       |
  234|       |        /* Emit close event */
  235|  6.08k|        if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (235:13): [True: 6.08k, False: 0]
  ------------------
  236|  6.08k|            webSocketContextData->closeHandler(this, code, message);
  237|  6.08k|        }
  238|  6.08k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4sendENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEENS_6OpCodeEbb:
   92|  26.0k|    SendStatus send(std::string_view message, OpCode opCode = OpCode::BINARY, bool compress = false, bool fin = true) {
   93|  26.0k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
   94|  26.0k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
   95|  26.0k|        );
   96|       |
   97|       |        /* Skip sending and report success if we are over the limit of maxBackpressure */
   98|  26.0k|        if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
  ------------------
  |  Branch (98:13): [True: 26.0k, False: 0]
  |  Branch (98:54): [True: 1.73k, False: 24.3k]
  ------------------
   99|       |            /* Also defer a close if we should */
  100|  1.73k|            if (webSocketContextData->closeOnBackpressureLimit) {
  ------------------
  |  Branch (100:17): [True: 0, False: 1.73k]
  ------------------
  101|      0|                us_socket_shutdown_read(SSL, (us_socket_t *) this);
  102|      0|            }
  103|  1.73k|            return DROPPED;
  104|  1.73k|        }
  105|       |
  106|       |        /* If we are subscribers and have messages to drain we need to drain them here to stay synced */
  107|  24.3k|        WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  108|       |
  109|       |        /* Special path for long sends of non-compressed, non-SSL messages */
  110|  24.3k|        if (message.length() >= 16 * 1024 && !compress && !SSL && !webSocketData->subscriber && getBufferedAmount() == 0 && Super::getLoopData()->corkOffset == 0) {
  ------------------
  |  Branch (110:13): [True: 66, False: 24.2k]
  |  Branch (110:46): [True: 0, False: 66]
  |  Branch (110:59): [Folded - Ignored]
  |  Branch (110:67): [True: 0, False: 0]
  |  Branch (110:97): [True: 0, False: 0]
  |  Branch (110:125): [True: 0, False: 0]
  ------------------
  111|      0|            char header[10];
  112|      0|            int header_length = (int) protocol::formatMessage<isServer>(header, nullptr, 0, opCode, message.length(), compress, fin);
  113|      0|            int written = us_socket_write2(0, (struct us_socket_t *)this, header, header_length, message.data(), (int) message.length());
  114|       |        
  115|      0|            if (written != header_length + (int) message.length()) {
  ------------------
  |  Branch (115:17): [True: 0, False: 0]
  ------------------
  116|       |                /* Buffer up backpressure */
  117|      0|                if (written > header_length) {
  ------------------
  |  Branch (117:21): [True: 0, False: 0]
  ------------------
  118|      0|                    webSocketData->buffer.append(message.data() + written - header_length, message.length() - (size_t) (written - header_length));
  119|      0|                } else {
  120|      0|                    webSocketData->buffer.append(header + written, (size_t) header_length - (size_t) written);
  121|      0|                    webSocketData->buffer.append(message.data(), message.length());
  122|      0|                }
  123|       |                /* We cannot still be corked if we have backpressure.
  124|       |                 * We also cannot uncork normally since it will re-write the already buffered
  125|       |                 * up backpressure again. */
  126|      0|                Super::uncorkWithoutSending();
  127|      0|                return BACKPRESSURE;
  128|      0|            }
  129|  24.3k|        } else {
  130|       |
  131|  24.3k|            if (webSocketData->subscriber) {
  ------------------
  |  Branch (131:17): [True: 0, False: 24.3k]
  ------------------
  132|       |                /* This will call back into us, send. */
  133|      0|                webSocketContextData->topicTree->drain(webSocketData->subscriber);
  134|      0|            }
  135|       |
  136|       |            /* Transform the message to compressed domain if requested */
  137|  24.3k|            if (compress) {
  ------------------
  |  Branch (137:17): [True: 11.9k, False: 12.3k]
  ------------------
  138|  11.9k|                WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  139|       |
  140|       |                /* Check and correct the compress hint. It is never valid to compress 0 bytes */
  141|  11.9k|                if (message.length() && opCode < 3 && webSocketData->compressionStatus == WebSocketData::ENABLED) {
  ------------------
  |  Branch (141:21): [True: 10.4k, False: 1.48k]
  |  Branch (141:41): [True: 10.4k, False: 0]
  |  Branch (141:55): [True: 2.97k, False: 7.50k]
  ------------------
  142|  2.97k|                    LoopData *loopData = Super::getLoopData();
  143|       |                    /* Compress using either shared or dedicated deflationStream */
  144|  2.97k|                    if (webSocketData->deflationStream) {
  ------------------
  |  Branch (144:25): [True: 0, False: 2.97k]
  ------------------
  145|      0|                        message = webSocketData->deflationStream->deflate(loopData->zlibContext, message, false);
  146|  2.97k|                    } else {
  147|  2.97k|                        message = loopData->deflationStream->deflate(loopData->zlibContext, message, true);
  148|  2.97k|                    }
  149|  8.99k|                } else {
  150|  8.99k|                    compress = false;
  151|  8.99k|                }
  152|  11.9k|            }
  153|       |
  154|       |            /* Get size, allocate size, write if needed */
  155|  24.3k|            size_t messageFrameSize = protocol::messageFrameSize(message.length());
  156|  24.3k|            auto [sendBuffer, sendBufferAttribute] = Super::getSendBuffer(messageFrameSize);
  157|  24.3k|            protocol::formatMessage<isServer>(sendBuffer, message.data(), message.length(), opCode, message.length(), compress, fin);
  158|       |
  159|       |            /* Depending on size of message we have different paths */
  160|  24.3k|            if (sendBufferAttribute == SendBufferAttribute::NEEDS_DRAIN) {
  ------------------
  |  Branch (160:17): [True: 19.7k, False: 4.56k]
  ------------------
  161|       |                /* This is a drain */
  162|  19.7k|                auto[written, failed] = Super::write(nullptr, 0);
  163|  19.7k|                if (failed) {
  ------------------
  |  Branch (163:21): [True: 18.8k, False: 907]
  ------------------
  164|       |                    /* Return false for failure, skipping to reset the timeout below */
  165|  18.8k|                    return BACKPRESSURE;
  166|  18.8k|                }
  167|  19.7k|            } else if (sendBufferAttribute == SendBufferAttribute::NEEDS_UNCORK) {
  ------------------
  |  Branch (167:24): [True: 0, False: 4.56k]
  ------------------
  168|       |                /* Uncork if we came here uncorked */
  169|      0|                auto [written, failed] = Super::uncork();
  170|      0|                if (failed) {
  ------------------
  |  Branch (170:21): [True: 0, False: 0]
  ------------------
  171|      0|                    return BACKPRESSURE;
  172|      0|                }
  173|      0|            }
  174|       |
  175|  24.3k|        }
  176|       |
  177|       |        /* Every successful send resets the timeout */
  178|  5.46k|        if (webSocketContextData->resetIdleTimeoutOnSend) {
  ------------------
  |  Branch (178:13): [True: 0, False: 5.46k]
  ------------------
  179|      0|            Super::timeout(webSocketContextData->idleTimeoutComponents.first);
  180|      0|            WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  181|      0|            webSocketData->hasTimedOut = false;
  182|      0|        }
  183|       |
  184|       |        /* Return success */
  185|  5.46k|        return SUCCESS;
  186|  24.3k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE11getUserDataEv:
   44|  67.1k|    USERDATA *getUserData() {
   45|  67.1k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
   46|       |        /* We just have it overallocated by sizeof type */
   47|  67.1k|        return (USERDATA *) (webSocketData + 1);
   48|  67.1k|    }
EpollHelloWorld.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4initEbNS_15CompressOptionsEONS_12BackPressureE:
   37|  33.5k|    void *init(bool perMessageDeflate, CompressOptions compressOptions, BackPressure &&backpressure) {
   38|  33.5k|        new (us_socket_ext(SSL, (us_socket_t *) this)) WebSocketData(perMessageDeflate, compressOptions, std::move(backpressure));
   39|  33.5k|        return this;
   40|  33.5k|    }

EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6createEPNS_4LoopEP19us_socket_context_tPNS_9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEE:
  420|  12.0k|    static WebSocketContext *create(Loop */*loop*/, us_socket_context_t *parentSocketContext, TopicTree<TopicTreeMessage, TopicTreeBigMessage> *topicTree) {
  421|  12.0k|        WebSocketContext *webSocketContext = (WebSocketContext *) us_create_child_socket_context(SSL, parentSocketContext, sizeof(WebSocketContextData<SSL, USERDATA>));
  422|  12.0k|        if (!webSocketContext) {
  ------------------
  |  Branch (422:13): [True: 0, False: 12.0k]
  ------------------
  423|      0|            return nullptr;
  424|      0|        }
  425|       |
  426|       |        /* Init socket context data */
  427|  12.0k|        new ((WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *)webSocketContext)) WebSocketContextData<SSL, USERDATA>(topicTree);
  428|  12.0k|        return webSocketContext->init();
  429|  12.0k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEv:
  248|  12.0k|    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|  12.0k|        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|  12.0k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  12.0k|            if (!webSocketData->isShuttingDown) {
  258|       |                /* Emit close event */
  259|  12.0k|                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|  12.0k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  263|  12.0k|                    for (Topic *t : webSocketData->subscriber->topics) {
  264|  12.0k|                        webSocketContextData->subscriptionHandler((WebSocket<SSL, isServer, USERDATA> *) s, t->name, (int) t->size() - 1, (int) t->size());
  265|  12.0k|                    }
  266|  12.0k|                }
  267|       |
  268|       |                /* Make sure to unsubscribe from any pub/sub node at exit */
  269|  12.0k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  12.0k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  12.0k|                if (webSocketContextData->closeHandler) {
  273|  12.0k|                    webSocketContextData->closeHandler((WebSocket<SSL, isServer, USERDATA> *) s, 1006, {(char *) reason, (size_t) code});
  274|  12.0k|                }
  275|  12.0k|            }
  276|       |
  277|       |            /* Destruct in-placed data struct */
  278|  12.0k|            webSocketData->~WebSocketData();
  279|       |
  280|  12.0k|            return s;
  281|  12.0k|        });
  282|       |
  283|       |        /* Handle WebSocket data streams */
  284|  12.0k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  285|       |
  286|       |            /* We need the websocket data */
  287|  12.0k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  288|       |
  289|       |            /* When in websocket shutdown mode, we do not care for ANY message, whether responding close frame or not.
  290|       |             * We only care for the TCP FIN really, not emitting any message after closing is key */
  291|  12.0k|            if (webSocketData->isShuttingDown) {
  292|  12.0k|                return s;
  293|  12.0k|            }
  294|       |
  295|  12.0k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  296|  12.0k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  297|       |
  298|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  299|  12.0k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  300|  12.0k|            webSocketData->hasTimedOut = false;
  301|       |
  302|       |            /* We always cork on data */
  303|  12.0k|            asyncSocket->cork();
  304|       |
  305|       |            /* This parser has virtually no overhead */
  306|  12.0k|            WebSocketProtocol<isServer, WebSocketContext<SSL, isServer, USERDATA>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
  307|       |
  308|       |            /* Uncorking a closed socekt is fine, in fact it is needed */
  309|  12.0k|            asyncSocket->uncork();
  310|       |
  311|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  312|  12.0k|            if (asyncSocket->getBufferedAmount() == 0) {
  313|       |                /* We can now be in shutdown state */
  314|  12.0k|                if (webSocketData->isShuttingDown) {
  315|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  316|  12.0k|                    asyncSocket->shutdown();
  317|  12.0k|                }
  318|  12.0k|            }
  319|       |
  320|  12.0k|            return s;
  321|  12.0k|        });
  322|       |
  323|       |        /* Handle HTTP write out (note: SSL_read may trigger this spuriously, the app need to handle spurious calls) */
  324|  12.0k|        us_socket_context_on_writable(SSL, getSocketContext(), [](auto *s) {
  325|       |
  326|       |            /* NOTE: Are we called here corked? If so, the below write code is broken, since
  327|       |             * we will have 0 as getBufferedAmount due to writing to cork buffer, then sending TCP FIN before
  328|       |             * we actually uncorked and sent off things */
  329|       |
  330|       |            /* It makes sense to check for us_is_shut_down here and return if so, to avoid shutting down twice */
  331|  12.0k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  332|  12.0k|                return s;
  333|  12.0k|            }
  334|       |
  335|  12.0k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  336|  12.0k|            WebSocketData *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  337|       |
  338|       |            /* We store old backpressure since it is unclear whether write drained anything,
  339|       |             * however, in case of coming here with 0 backpressure we still need to emit drain event */
  340|  12.0k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  341|       |
  342|       |            /* Drain as much as possible */
  343|  12.0k|            asyncSocket->write(nullptr, 0);
  344|       |
  345|       |            /* Behavior: if we actively drain backpressure, always reset timeout (even if we are in shutdown) */
  346|       |            /* Also reset timeout if we came here with 0 backpressure */
  347|  12.0k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  348|  12.0k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  349|  12.0k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  350|  12.0k|                webSocketData->hasTimedOut = false;
  351|  12.0k|            }
  352|       |
  353|       |            /* Are we in (WebSocket) shutdown mode? */
  354|  12.0k|            if (webSocketData->isShuttingDown) {
  355|       |                /* Check if we just now drained completely */
  356|  12.0k|                if (asyncSocket->getBufferedAmount() == 0) {
  357|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  358|  12.0k|                    asyncSocket->shutdown();
  359|  12.0k|                }
  360|  12.0k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  361|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  362|  12.0k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  363|  12.0k|                if (webSocketContextData->drainHandler) {
  364|  12.0k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  365|  12.0k|                }
  366|       |                /* No need to check for closed here as we leave the handler immediately*/
  367|  12.0k|            }
  368|       |
  369|  12.0k|            return s;
  370|  12.0k|        });
  371|       |
  372|       |        /* Handle FIN, HTTP does not support half-closed sockets, so simply close */
  373|  12.0k|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  374|       |
  375|       |            /* If we get a fin, we just close I guess */
  376|  12.0k|            us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  377|       |
  378|  12.0k|            return s;
  379|  12.0k|        });
  380|       |
  381|  12.0k|        us_socket_context_on_long_timeout(SSL, getSocketContext(), [](auto *s) {
  382|  12.0k|            ((WebSocket<SSL, isServer, USERDATA> *) s)->end(1000, "please reconnect");
  383|       |
  384|  12.0k|            return s;
  385|  12.0k|        });
  386|       |
  387|       |        /* Handle socket timeouts, simply close them so to not confuse client with FIN */
  388|  12.0k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  389|       |
  390|  12.0k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  391|  12.0k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  392|       |
  393|  12.0k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  394|  12.0k|                webSocketData->hasTimedOut = true;
  395|  12.0k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  396|       |                /* Send ping without being corked */
  397|  12.0k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  398|  12.0k|                return s;
  399|  12.0k|            }
  400|       |
  401|       |            /* Timeout is very simple; we just close it */
  402|       |            /* Warning: we happen to know forceClose will not use first parameter so pass nullptr here */
  403|  12.0k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  404|       |
  405|  12.0k|            return s;
  406|  12.0k|        });
  407|       |
  408|  12.0k|        return this;
  409|  12.0k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_iPvE_clI11us_socket_tEEDaS4_iS5_:
  254|  33.5k|        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|  33.5k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  33.5k|            if (!webSocketData->isShuttingDown) {
  ------------------
  |  Branch (257:17): [True: 27.4k, False: 6.08k]
  ------------------
  258|       |                /* Emit close event */
  259|  27.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|  27.4k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (262:21): [True: 0, False: 27.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|  27.4k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  27.4k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  27.4k|                if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (272:21): [True: 27.4k, False: 0]
  ------------------
  273|  27.4k|                    webSocketContextData->closeHandler((WebSocket<SSL, isServer, USERDATA> *) s, 1006, {(char *) reason, (size_t) code});
  274|  27.4k|                }
  275|  27.4k|            }
  276|       |
  277|       |            /* Destruct in-placed data struct */
  278|  33.5k|            webSocketData->~WebSocketData();
  279|       |
  280|  33.5k|            return s;
  281|  33.5k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_PciE_clI11us_socket_tEEDaS4_S5_i:
  284|  61.1k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  285|       |
  286|       |            /* We need the websocket data */
  287|  61.1k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  288|       |
  289|       |            /* When in websocket shutdown mode, we do not care for ANY message, whether responding close frame or not.
  290|       |             * We only care for the TCP FIN really, not emitting any message after closing is key */
  291|  61.1k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (291:17): [True: 379, False: 60.7k]
  ------------------
  292|    379|                return s;
  293|    379|            }
  294|       |
  295|  60.7k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  296|  60.7k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  297|       |
  298|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  299|  60.7k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  300|  60.7k|            webSocketData->hasTimedOut = false;
  301|       |
  302|       |            /* We always cork on data */
  303|  60.7k|            asyncSocket->cork();
  304|       |
  305|       |            /* This parser has virtually no overhead */
  306|  60.7k|            WebSocketProtocol<isServer, WebSocketContext<SSL, isServer, USERDATA>>::consume(data, (unsigned int) length, (WebSocketState<isServer> *) webSocketData, s);
  307|       |
  308|       |            /* Uncorking a closed socekt is fine, in fact it is needed */
  309|  60.7k|            asyncSocket->uncork();
  310|       |
  311|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  312|  60.7k|            if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (312:17): [True: 23.5k, False: 37.2k]
  ------------------
  313|       |                /* We can now be in shutdown state */
  314|  23.5k|                if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (314:21): [True: 969, False: 22.5k]
  ------------------
  315|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  316|    969|                    asyncSocket->shutdown();
  317|    969|                }
  318|  23.5k|            }
  319|       |
  320|  60.7k|            return s;
  321|  61.1k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE13setCompressedEPNS_14WebSocketStateILb1EEEPv:
   44|  3.24k|    static bool setCompressed(WebSocketState<isServer> */*wState*/, void *s) {
   45|  3.24k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   46|       |
   47|  3.24k|        if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::ENABLED) {
  ------------------
  |  Branch (47:13): [True: 1.85k, False: 1.39k]
  ------------------
   48|  1.85k|            webSocketData->compressionStatus = WebSocketData::CompressionStatus::COMPRESSED_FRAME;
   49|  1.85k|            return true;
   50|  1.85k|        } else {
   51|  1.39k|            return false;
   52|  1.39k|        }
   53|  3.24k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE10forceCloseEPNS_14WebSocketStateILb1EEEPvNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   55|  13.3k|    static void forceClose(WebSocketState<isServer> */*wState*/, void *s, std::string_view reason = {}) {
   56|  13.3k|        us_socket_close(SSL, (us_socket_t *) s, (int) reason.length(), (void *) reason.data());
   57|  13.3k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE19refusePayloadLengthEmPNS_14WebSocketStateILb1EEEPv:
  241|   106k|    static bool refusePayloadLength(uint64_t length, WebSocketState<isServer> */*wState*/, void *s) {
  242|   106k|        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|   106k|        return webSocketContextData->maxPayloadLength < length;
  246|   106k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE14handleFragmentEPcmjibPNS_14WebSocketStateILb1EEEPv:
   60|  89.8k|    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|  89.8k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
   63|  89.8k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   64|       |
   65|       |        /* Is this a non-control frame? */
   66|  89.8k|        if (opCode < 3) {
  ------------------
  |  Branch (66:13): [True: 70.8k, False: 18.9k]
  ------------------
   67|       |            /* Did we get everything in one go? */
   68|  70.8k|            if (!remainingBytes && fin && !webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (68:17): [True: 34.3k, False: 36.5k]
  |  Branch (68:36): [True: 20.0k, False: 14.2k]
  |  Branch (68:43): [True: 16.9k, False: 3.12k]
  ------------------
   69|       |
   70|       |                /* Handle compressed frame */
   71|  16.9k|                if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (71:21): [True: 948, False: 15.9k]
  ------------------
   72|    948|                        webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
   73|       |
   74|    948|                        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|    948|                        std::optional<std::string_view> inflatedFrame;
   77|    948|                        if (webSocketData->inflationStream) {
  ------------------
  |  Branch (77:29): [True: 0, False: 948]
  ------------------
   78|      0|                            inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, false);
   79|    948|                        } else {
   80|    948|                            inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, true);
   81|    948|                        }
   82|       |
   83|    948|                        if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (83:29): [True: 0, False: 948]
  ------------------
   84|      0|                            forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
   85|      0|                            return true;
   86|    948|                        } else {
   87|    948|                            data = (char *) inflatedFrame->data();
   88|    948|                            length = inflatedFrame->length();
   89|    948|                        }
   90|    948|                }
   91|       |
   92|       |                /* Check text messages for Utf-8 validity */
   93|  16.9k|                if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (93:21): [True: 14.4k, False: 2.51k]
  |  Branch (93:36): [True: 2.58k, False: 11.8k]
  ------------------
   94|  2.58k|                    forceClose(webSocketState, s, ERR_INVALID_TEXT);
   95|  2.58k|                    return true;
   96|  2.58k|                }
   97|       |
   98|       |                /* Emit message event & break if we are closed or shut down when returning */
   99|  14.3k|                if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (99:21): [True: 11.2k, False: 3.07k]
  ------------------
  100|  11.2k|                    webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  101|  11.2k|                    if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (101:25): [True: 0, False: 11.2k]
  |  Branch (101:72): [True: 0, False: 11.2k]
  ------------------
  102|      0|                        return true;
  103|      0|                    }
  104|  11.2k|                }
  105|  53.9k|            } else {
  106|       |                /* Allocate fragment buffer up front first time */
  107|  53.9k|                if (!webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (107:21): [True: 10.8k, False: 43.0k]
  ------------------
  108|  10.8k|                    webSocketData->fragmentBuffer.reserve(length + remainingBytes);
  109|  10.8k|                }
  110|       |                /* Fragments forming a big message are not caught until appending them */
  111|  53.9k|                if (refusePayloadLength(length + webSocketData->fragmentBuffer.length(), webSocketState, s)) {
  ------------------
  |  Branch (111:21): [True: 76, False: 53.8k]
  ------------------
  112|     76|                    forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE);
  113|     76|                    return true;
  114|     76|                }
  115|  53.8k|                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|  53.8k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (119:21): [True: 17.4k, False: 36.4k]
  |  Branch (119:40): [True: 3.12k, False: 14.2k]
  ------------------
  120|       |
  121|       |                    /* Handle compression */
  122|  3.12k|                    if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (122:25): [True: 788, False: 2.33k]
  ------------------
  123|    788|                            webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
  124|       |
  125|       |                            /* 9 bytes of padding for libdeflate, 4 for zlib */
  126|    788|                            webSocketData->fragmentBuffer.append("123456789");
  127|       |
  128|    788|                            LoopData *loopData = (LoopData *) us_loop_ext(
  129|    788|                                us_socket_context_loop(SSL,
  130|    788|                                    us_socket_context(SSL, (us_socket_t *) s)
  131|    788|                                )
  132|    788|                            );
  133|       |
  134|       |                            /* Decompress using shared or dedicated decompressor */
  135|    788|                            std::optional<std::string_view> inflatedFrame;
  136|    788|                            if (webSocketData->inflationStream) {
  ------------------
  |  Branch (136:33): [True: 0, False: 788]
  ------------------
  137|      0|                                inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, false);
  138|    788|                            } else {
  139|    788|                                inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, true);
  140|    788|                            }
  141|       |
  142|    788|                            if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (142:33): [True: 0, False: 788]
  ------------------
  143|      0|                                forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
  144|      0|                                return true;
  145|    788|                            } else {
  146|    788|                                data = (char *) inflatedFrame->data();
  147|    788|                                length = inflatedFrame->length();
  148|    788|                            }
  149|       |
  150|       |
  151|  2.33k|                    } else {
  152|       |                        // reset length and data ptrs
  153|  2.33k|                        length = webSocketData->fragmentBuffer.length();
  154|  2.33k|                        data = webSocketData->fragmentBuffer.data();
  155|  2.33k|                    }
  156|       |
  157|       |                    /* Check text messages for Utf-8 validity */
  158|  3.12k|                    if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (158:25): [True: 1.08k, False: 2.04k]
  |  Branch (158:40): [True: 448, False: 632]
  ------------------
  159|    448|                        forceClose(webSocketState, s, ERR_INVALID_TEXT);
  160|    448|                        return true;
  161|    448|                    }
  162|       |
  163|       |                    /* Emit message and check for shutdown or close */
  164|  2.67k|                    if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (164:25): [True: 2.44k, False: 238]
  ------------------
  165|  2.44k|                        webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  166|  2.44k|                        if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (166:29): [True: 0, False: 2.44k]
  |  Branch (166:76): [True: 0, False: 2.44k]
  ------------------
  167|      0|                            return true;
  168|      0|                        }
  169|  2.44k|                    }
  170|       |
  171|       |                    /* If we shutdown or closed, this will be taken care of elsewhere */
  172|  2.67k|                    webSocketData->fragmentBuffer.clear();
  173|  2.67k|                }
  174|  53.8k|            }
  175|  70.8k|        } else {
  176|       |            /* Control frames need the websocket to send pings, pongs and close */
  177|  18.9k|            WebSocket<SSL, isServer, USERDATA> *webSocket = (WebSocket<SSL, isServer, USERDATA> *) s;
  178|       |
  179|  18.9k|            if (!remainingBytes && fin && !webSocketData->controlTipLength) {
  ------------------
  |  Branch (179:17): [True: 14.5k, False: 4.38k]
  |  Branch (179:36): [True: 14.5k, False: 0]
  |  Branch (179:43): [True: 10.7k, False: 3.82k]
  ------------------
  180|  10.7k|                if (opCode == CLOSE) {
  ------------------
  |  Branch (180:21): [True: 3.58k, False: 7.16k]
  ------------------
  181|  3.58k|                    auto closeFrame = protocol::parseClosePayload(data, length);
  182|  3.58k|                    webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  183|  3.58k|                    return true;
  184|  7.16k|                } else {
  185|  7.16k|                    if (opCode == PING) {
  ------------------
  |  Branch (185:25): [True: 5.65k, False: 1.51k]
  ------------------
  186|  5.65k|                        webSocket->send(std::string_view(data, length), (OpCode) OpCode::PONG);
  187|  5.65k|                        if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (187:29): [True: 5.38k, False: 270]
  ------------------
  188|  5.38k|                            webSocketContextData->pingHandler(webSocket, {data, length});
  189|  5.38k|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (189:33): [True: 0, False: 5.38k]
  |  Branch (189:80): [True: 0, False: 5.38k]
  ------------------
  190|      0|                                return true;
  191|      0|                            }
  192|  5.38k|                        }
  193|  5.65k|                    } else if (opCode == PONG) {
  ------------------
  |  Branch (193:32): [True: 1.51k, False: 0]
  ------------------
  194|  1.51k|                        if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (194:29): [True: 526, False: 987]
  ------------------
  195|    526|                            webSocketContextData->pongHandler(webSocket, {data, length});
  196|    526|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (196:33): [True: 0, False: 526]
  |  Branch (196:80): [True: 0, False: 526]
  ------------------
  197|      0|                                return true;
  198|      0|                            }
  199|    526|                        }
  200|  1.51k|                    }
  201|  7.16k|                }
  202|  10.7k|            } else {
  203|       |                /* Here we never mind any size optimizations as we are in the worst possible path */
  204|  8.21k|                webSocketData->fragmentBuffer.append(data, length);
  205|  8.21k|                webSocketData->controlTipLength += (unsigned int) length;
  206|       |
  207|  8.21k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (207:21): [True: 3.82k, False: 4.38k]
  |  Branch (207:40): [True: 3.82k, False: 0]
  ------------------
  208|  3.82k|                    char *controlBuffer = (char *) webSocketData->fragmentBuffer.data() + webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength;
  209|  3.82k|                    if (opCode == CLOSE) {
  ------------------
  |  Branch (209:25): [True: 2.49k, False: 1.33k]
  ------------------
  210|  2.49k|                        protocol::CloseFrame closeFrame = protocol::parseClosePayload(controlBuffer, webSocketData->controlTipLength);
  211|  2.49k|                        webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  212|  2.49k|                        return true;
  213|  2.49k|                    } else {
  214|  1.33k|                        if (opCode == PING) {
  ------------------
  |  Branch (214:29): [True: 634, False: 701]
  ------------------
  215|    634|                            webSocket->send(std::string_view(controlBuffer, webSocketData->controlTipLength), (OpCode) OpCode::PONG);
  216|    634|                            if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (216:33): [True: 430, False: 204]
  ------------------
  217|    430|                                webSocketContextData->pingHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  218|    430|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (218:37): [True: 0, False: 430]
  |  Branch (218:84): [True: 0, False: 430]
  ------------------
  219|      0|                                    return true;
  220|      0|                                }
  221|    430|                            }
  222|    701|                        } else if (opCode == PONG) {
  ------------------
  |  Branch (222:36): [True: 701, False: 0]
  ------------------
  223|    701|                            if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (223:33): [True: 483, False: 218]
  ------------------
  224|    483|                                webSocketContextData->pongHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  225|    483|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (225:37): [True: 0, False: 483]
  |  Branch (225:84): [True: 0, False: 483]
  ------------------
  226|      0|                                    return true;
  227|      0|                                }
  228|    483|                            }
  229|    701|                        }
  230|  1.33k|                    }
  231|       |
  232|       |                    /* Same here, we do not care for any particular smart allocation scheme */
  233|  1.33k|                    webSocketData->fragmentBuffer.resize((unsigned int) webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength);
  234|  1.33k|                    webSocketData->controlTipLength = 0;
  235|  1.33k|                }
  236|  8.21k|            }
  237|  18.9k|        }
  238|  80.6k|        return false;
  239|  89.8k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E_clI11us_socket_tEEDaS4_:
  324|  8.19k|        us_socket_context_on_writable(SSL, getSocketContext(), [](auto *s) {
  325|       |
  326|       |            /* NOTE: Are we called here corked? If so, the below write code is broken, since
  327|       |             * we will have 0 as getBufferedAmount due to writing to cork buffer, then sending TCP FIN before
  328|       |             * we actually uncorked and sent off things */
  329|       |
  330|       |            /* It makes sense to check for us_is_shut_down here and return if so, to avoid shutting down twice */
  331|  8.19k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  ------------------
  |  Branch (331:17): [True: 0, False: 8.19k]
  ------------------
  332|      0|                return s;
  333|      0|            }
  334|       |
  335|  8.19k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  336|  8.19k|            WebSocketData *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  337|       |
  338|       |            /* We store old backpressure since it is unclear whether write drained anything,
  339|       |             * however, in case of coming here with 0 backpressure we still need to emit drain event */
  340|  8.19k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  341|       |
  342|       |            /* Drain as much as possible */
  343|  8.19k|            asyncSocket->write(nullptr, 0);
  344|       |
  345|       |            /* Behavior: if we actively drain backpressure, always reset timeout (even if we are in shutdown) */
  346|       |            /* Also reset timeout if we came here with 0 backpressure */
  347|  8.19k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (347:17): [True: 300, False: 7.89k]
  |  Branch (347:34): [True: 5.81k, False: 2.07k]
  ------------------
  348|  6.11k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  349|  6.11k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  350|  6.11k|                webSocketData->hasTimedOut = false;
  351|  6.11k|            }
  352|       |
  353|       |            /* Are we in (WebSocket) shutdown mode? */
  354|  8.19k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (354:17): [True: 1.45k, False: 6.74k]
  ------------------
  355|       |                /* Check if we just now drained completely */
  356|  1.45k|                if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (356:21): [True: 516, False: 934]
  ------------------
  357|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  358|    516|                    asyncSocket->shutdown();
  359|    516|                }
  360|  6.74k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (360:24): [True: 300, False: 6.44k]
  |  Branch (360:41): [True: 5.03k, False: 1.40k]
  ------------------
  361|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  362|  5.33k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  363|  5.33k|                if (webSocketContextData->drainHandler) {
  ------------------
  |  Branch (363:21): [True: 5.10k, False: 233]
  ------------------
  364|  5.10k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  365|  5.10k|                }
  366|       |                /* No need to check for closed here as we leave the handler immediately*/
  367|  5.33k|            }
  368|       |
  369|  8.19k|            return s;
  370|  8.19k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E0_clI11us_socket_tEEDaS4_:
  373|    416|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  374|       |
  375|       |            /* If we get a fin, we just close I guess */
  376|    416|            us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  377|       |
  378|    416|            return s;
  379|    416|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E2_clI11us_socket_tEEDaS4_:
  388|  6.11k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  389|       |
  390|  6.11k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  391|  6.11k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  392|       |
  393|  6.11k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  ------------------
  |  Branch (393:17): [True: 6.11k, False: 0]
  |  Branch (393:65): [True: 2.65k, False: 3.45k]
  |  Branch (393:99): [True: 2.29k, False: 359]
  ------------------
  394|  2.29k|                webSocketData->hasTimedOut = true;
  395|  2.29k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  396|       |                /* Send ping without being corked */
  397|  2.29k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  398|  2.29k|                return s;
  399|  2.29k|            }
  400|       |
  401|       |            /* Timeout is very simple; we just close it */
  402|       |            /* Warning: we happen to know forceClose will not use first parameter so pass nullptr here */
  403|  3.81k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  404|       |
  405|  3.81k|            return s;
  406|  6.11k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4freeEv:
  411|  12.0k|    void free() {
  412|  12.0k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
  413|  12.0k|        webSocketContextData->~WebSocketContextData();
  414|       |
  415|  12.0k|        us_socket_context_free(SSL, (us_socket_context_t *) this);
  416|  12.0k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE16getSocketContextEv:
   35|  78.4k|    us_socket_context_t *getSocketContext() {
   36|  78.4k|        return (us_socket_context_t *) this;
   37|  78.4k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6getExtEv:
   39|   181k|    WebSocketContextData<SSL, USERDATA> *getExt() {
   40|   181k|        return (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
   41|   181k|    }

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

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

EpollHelloWorld.cpp:_ZN3uWSL20negotiateCompressionEbiiNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  144|  4.38k|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|  4.38k|    if (!wantCompression) {
  ------------------
  |  Branch (147:9): [True: 0, False: 4.38k]
  ------------------
  148|      0|        return {false, 0, 0, ""};
  149|      0|    }
  150|       |
  151|  4.38k|    ExtensionsParser ep(offer.data(), offer.length());
  152|       |
  153|  4.38k|    static thread_local std::string response;
  154|  4.38k|    response = "";
  155|       |
  156|  4.38k|    int compressionWindow = wantedCompressionWindow;
  157|  4.38k|    int inflationWindow = wantedInflationWindow;
  158|  4.38k|    bool compression = false;
  159|       |
  160|  4.38k|    if (ep.xWebKitDeflateFrame) {
  ------------------
  |  Branch (160:9): [True: 749, False: 3.63k]
  ------------------
  161|       |        /* We now have compression */
  162|    749|        compression = true;
  163|    749|        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|    749|        if (ep.noContextTakeover) {
  ------------------
  |  Branch (167:13): [True: 195, False: 554]
  ------------------
  168|       |            /* We must fail here right now (fix pub/sub) */
  169|    195|#ifndef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  170|    195|            if (wantedCompressionWindow != 0) {
  ------------------
  |  Branch (170:17): [True: 0, False: 195]
  ------------------
  171|      0|                return {false, 0, 0, ""};
  172|      0|            }
  173|    195|#endif
  174|       |
  175|    195|            compressionWindow = 0;
  176|    195|        }
  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|    749|        if (ep.maxWindowBits && ep.maxWindowBits < compressionWindow) {
  ------------------
  |  Branch (180:13): [True: 354, False: 395]
  |  Branch (180:33): [True: 0, False: 354]
  ------------------
  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|    749|        if (wantedInflationWindow < 15) {
  ------------------
  |  Branch (191:13): [True: 749, False: 0]
  ------------------
  192|    749|            if (!wantedInflationWindow) {
  ------------------
  |  Branch (192:17): [True: 749, False: 0]
  ------------------
  193|    749|                response += "; no_context_takeover";
  194|    749|            } else {
  195|      0|                response += "; max_window_bits=" + std::to_string(wantedInflationWindow);
  196|      0|            }
  197|    749|        }
  198|  3.63k|    } else if (ep.perMessageDeflate) {
  ------------------
  |  Branch (198:16): [True: 2.03k, False: 1.59k]
  ------------------
  199|       |        /* We now have compression */
  200|  2.03k|        compression = true;
  201|  2.03k|        response = "permessage-deflate";
  202|       |
  203|  2.03k|        if (ep.clientNoContextTakeover) {
  ------------------
  |  Branch (203:13): [True: 528, False: 1.50k]
  ------------------
  204|    528|            inflationWindow = 0;
  205|  1.50k|        } else if (ep.clientMaxWindowBits && ep.clientMaxWindowBits != 1) {
  ------------------
  |  Branch (205:20): [True: 486, False: 1.02k]
  |  Branch (205:46): [True: 257, False: 229]
  ------------------
  206|    257|            inflationWindow = std::min<int>(ep.clientMaxWindowBits, inflationWindow);
  207|    257|        }
  208|       |
  209|       |        /* Whatever we have now, write */
  210|  2.03k|        if (inflationWindow < 15) {
  ------------------
  |  Branch (210:13): [True: 2.03k, False: 0]
  ------------------
  211|  2.03k|            if (!inflationWindow || !ep.clientMaxWindowBits) {
  ------------------
  |  Branch (211:17): [True: 2.03k, False: 0]
  |  Branch (211:37): [True: 0, False: 0]
  ------------------
  212|  2.03k|                response += "; client_no_context_takeover";
  213|  2.03k|                inflationWindow = 0;
  214|  2.03k|            } else {
  215|      0|                response += "; client_max_window_bits=" + std::to_string(inflationWindow);
  216|      0|            }
  217|  2.03k|        }
  218|       |
  219|       |        /* This block basically lets the client lower it */
  220|  2.03k|        if (ep.serverNoContextTakeover) {
  ------------------
  |  Branch (220:13): [True: 320, False: 1.71k]
  ------------------
  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|  1.71k|        } else if (ep.serverMaxWindowBits) {
  ------------------
  |  Branch (226:20): [True: 245, False: 1.47k]
  ------------------
  227|    245|            compressionWindow = std::min<int>(ep.serverMaxWindowBits, compressionWindow);
  228|    245|#ifndef UWS_ALLOW_8_WINDOW_BITS
  229|       |            /* Zlib cannot do windowBits=8, memLevel=1 so we raise it up to 9 minimum */
  230|    245|            if (compressionWindow == 8) {
  ------------------
  |  Branch (230:17): [True: 0, False: 245]
  ------------------
  231|      0|                compressionWindow = 9;
  232|      0|            }
  233|    245|#endif
  234|    245|        }
  235|       |
  236|       |        /* Whatever we have now, write */
  237|  2.03k|        if (compressionWindow < 15) {
  ------------------
  |  Branch (237:13): [True: 2.03k, False: 0]
  ------------------
  238|  2.03k|            if (!compressionWindow) {
  ------------------
  |  Branch (238:17): [True: 2.03k, False: 0]
  ------------------
  239|  2.03k|                response += "; server_no_context_takeover";
  240|  2.03k|            } else {
  241|      0|                response += "; server_max_window_bits=" + std::to_string(compressionWindow);
  242|      0|            }
  243|  2.03k|        }
  244|  2.03k|    }
  245|       |
  246|       |    /* A final sanity check (this check does not actually catch too high values!) */
  247|  4.38k|    if ((compressionWindow && compressionWindow < 8) || compressionWindow > 15 || (inflationWindow && inflationWindow < 8) || inflationWindow > 15) {
  ------------------
  |  Branch (247:10): [True: 0, False: 4.38k]
  |  Branch (247:31): [True: 0, False: 0]
  |  Branch (247:57): [True: 0, False: 4.38k]
  |  Branch (247:84): [True: 0, False: 4.38k]
  |  Branch (247:103): [True: 0, False: 0]
  |  Branch (247:127): [True: 0, False: 4.38k]
  ------------------
  248|      0|        return {false, 0, 0, ""};
  249|      0|    }
  250|       |
  251|  4.38k|    return {compression, compressionWindow, inflationWindow, response};
  252|  4.38k|}
_ZN3uWS16ExtensionsParserC2EPKcm:
   93|  4.38k|    ExtensionsParser(const char *data, size_t length) {
   94|  4.38k|        const char *stop = data + length;
   95|  4.38k|        int token = 1;
   96|       |
   97|       |        /* Ignore anything before permessage-deflate or x-webkit-deflate-frame */
   98|  13.4k|        for (; token && token != TOK_PERMESSAGE_DEFLATE && token != TOK_X_WEBKIT_DEFLATE_FRAME; token = getToken(data, stop));
  ------------------
  |  Branch (98:16): [True: 11.8k, False: 1.59k]
  |  Branch (98:25): [True: 9.79k, False: 2.03k]
  |  Branch (98:60): [True: 9.04k, False: 749]
  ------------------
   99|       |
  100|       |        /* What protocol are we going to use? */
  101|  4.38k|        perMessageDeflate = (token == TOK_PERMESSAGE_DEFLATE);
  102|  4.38k|        xWebKitDeflateFrame = (token == TOK_X_WEBKIT_DEFLATE_FRAME);
  103|       |
  104|  14.6k|        while ((token = getToken(data, stop))) {
  ------------------
  |  Branch (104:16): [True: 10.7k, False: 3.85k]
  ------------------
  105|  10.7k|            switch (token) {
  106|    194|            case TOK_X_WEBKIT_DEFLATE_FRAME:
  ------------------
  |  Branch (106:13): [True: 194, False: 10.5k]
  ------------------
  107|       |                /* Duplicates not allowed/supported */
  108|    194|                return;
  109|    389|            case TOK_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (109:13): [True: 389, False: 10.3k]
  ------------------
  110|    389|                noContextTakeover = true;
  111|    389|                break;
  112|    560|            case TOK_MAX_WINDOW_BITS:
  ------------------
  |  Branch (112:13): [True: 560, False: 10.2k]
  ------------------
  113|    560|                maxWindowBits = 1;
  114|    560|                lastInteger = &maxWindowBits;
  115|    560|                break;
  116|    330|            case TOK_PERMESSAGE_DEFLATE:
  ------------------
  |  Branch (116:13): [True: 330, False: 10.4k]
  ------------------
  117|       |                /* Duplicates not allowed/supported */
  118|    330|                return;
  119|    554|            case TOK_SERVER_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (119:13): [True: 554, False: 10.2k]
  ------------------
  120|    554|                serverNoContextTakeover = true;
  121|    554|                break;
  122|    696|            case TOK_CLIENT_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (122:13): [True: 696, False: 10.0k]
  ------------------
  123|    696|                clientNoContextTakeover = true;
  124|    696|                break;
  125|    422|            case TOK_SERVER_MAX_WINDOW_BITS:
  ------------------
  |  Branch (125:13): [True: 422, False: 10.3k]
  ------------------
  126|    422|                serverMaxWindowBits = 1;
  127|    422|                lastInteger = &serverMaxWindowBits;
  128|    422|                break;
  129|    672|            case TOK_CLIENT_MAX_WINDOW_BITS:
  ------------------
  |  Branch (129:13): [True: 672, False: 10.0k]
  ------------------
  130|    672|                clientMaxWindowBits = 1;
  131|    672|                lastInteger = &clientMaxWindowBits;
  132|    672|                break;
  133|  6.94k|            default:
  ------------------
  |  Branch (133:13): [True: 6.94k, False: 3.81k]
  ------------------
  134|  6.94k|                if (token < 0 && lastInteger) {
  ------------------
  |  Branch (134:21): [True: 1.94k, False: 5.00k]
  |  Branch (134:34): [True: 1.52k, False: 422]
  ------------------
  135|  1.52k|                    *lastInteger = -token;
  136|  1.52k|                }
  137|  6.94k|                break;
  138|  10.7k|            }
  139|  10.7k|        }
  140|  4.38k|    }
_ZN3uWS16ExtensionsParser8getTokenERPKcS2_:
   69|  23.6k|    int getToken(const char *&in, const char *stop) {
   70|  50.0k|        while (in != stop && !isalnum(*in)) {
  ------------------
  |  Branch (70:16): [True: 45.9k, False: 4.12k]
  |  Branch (70:30): [True: 26.4k, False: 19.5k]
  ------------------
   71|  26.4k|            in++;
   72|  26.4k|        }
   73|       |
   74|       |        /* Don't care more than this for now */
   75|  23.6k|        static_assert(SHRT_MIN > INT_MIN, "Integer overflow fix is invalid for this platform, report this as a bug!");
   76|       |
   77|  23.6k|        int hashedToken = 0;
   78|   201k|        while (in != stop && (isalnum(*in) || *in == '-' || *in == '_')) {
  ------------------
  |  Branch (78:16): [True: 193k, False: 7.34k]
  |  Branch (78:31): [True: 167k, False: 26.3k]
  |  Branch (78:47): [True: 8.41k, False: 17.9k]
  |  Branch (78:61): [True: 1.63k, False: 16.3k]
  ------------------
   79|   177k|            if (isdigit(*in)) {
  ------------------
  |  Branch (79:17): [True: 15.0k, False: 162k]
  ------------------
   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|  15.0k|                if (hashedToken > SHRT_MIN && hashedToken < SHRT_MAX) {
  ------------------
  |  Branch (82:21): [True: 14.5k, False: 554]
  |  Branch (82:47): [True: 12.4k, False: 2.02k]
  ------------------
   83|  12.4k|                    hashedToken = hashedToken * 10 - (*in - '0');
   84|  12.4k|                }
   85|   162k|            } else {
   86|   162k|                hashedToken += *in;
   87|   162k|            }
   88|   177k|            in++;
   89|   177k|        }
   90|  23.6k|        return hashedToken;
   91|  23.6k|    }

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

EpollHelloWorld.cpp:_ZN3uWS8protocolL13formatMessageILb1EEEmPcPKcmNS_6OpCodeEmbb:
  209|  24.3k|static inline size_t formatMessage(char *dst, const char *src, size_t length, OpCode opCode, size_t reportedLength, bool compressed, bool fin) {
  210|  24.3k|    size_t messageLength;
  211|  24.3k|    size_t headerLength;
  212|  24.3k|    if (reportedLength < 126) {
  ------------------
  |  Branch (212:9): [True: 23.7k, False: 625]
  ------------------
  213|  23.7k|        headerLength = 2;
  214|  23.7k|        dst[1] = (char) reportedLength;
  215|  23.7k|    } else if (reportedLength <= UINT16_MAX) {
  ------------------
  |  Branch (215:16): [True: 625, False: 0]
  ------------------
  216|    625|        headerLength = 4;
  217|    625|        dst[1] = 126;
  218|    625|        uint16_t tmp = cond_byte_swap<uint16_t>((uint16_t) reportedLength);
  219|    625|        memcpy(&dst[2], &tmp, sizeof(uint16_t));
  220|    625|    } else {
  221|      0|        headerLength = 10;
  222|      0|        dst[1] = 127;
  223|      0|        uint64_t tmp = cond_byte_swap<uint64_t>((uint64_t) reportedLength);
  224|      0|        memcpy(&dst[2], &tmp, sizeof(uint64_t));
  225|      0|    }
  226|       |
  227|  24.3k|    dst[0] = (char) ((fin ? 128 : 0) | ((compressed && opCode) ? SND_COMPRESSED : 0) | (char) opCode);
  ------------------
  |  Branch (227:23): [True: 24.3k, False: 0]
  |  Branch (227:42): [True: 2.97k, False: 21.3k]
  |  Branch (227:56): [True: 2.97k, False: 0]
  ------------------
  228|       |
  229|       |    //printf("%d\n", (int)dst[0]);
  230|       |
  231|  24.3k|    char mask[4];
  232|  24.3k|    if (!isServer) {
  ------------------
  |  Branch (232:9): [Folded - Ignored]
  ------------------
  233|      0|        dst[1] |= 0x80;
  234|      0|        uint32_t random = (uint32_t) rand();
  235|      0|        memcpy(mask, &random, 4);
  236|      0|        memcpy(dst + headerLength, &random, 4);
  237|      0|        headerLength += 4;
  238|      0|    }
  239|       |
  240|  24.3k|    messageLength = headerLength + length;
  241|  24.3k|    memcpy(dst + headerLength, src, length);
  242|       |
  243|  24.3k|    if (!isServer) {
  ------------------
  |  Branch (243:9): [Folded - Ignored]
  ------------------
  244|       |
  245|       |        // overwrites up to 3 bytes outside of the given buffer!
  246|       |        //WebSocketProtocol<isServer>::unmaskInplace(dst + headerLength, dst + headerLength + length, mask);
  247|       |
  248|       |        // this is not optimal
  249|      0|        char *start = dst + headerLength;
  250|      0|        char *stop = start + length;
  251|      0|        int i = 0;
  252|      0|        while (start != stop) {
  ------------------
  |  Branch (252:16): [True: 0, False: 0]
  ------------------
  253|      0|            (*start++) ^= mask[i++ % 4];
  254|      0|        }
  255|      0|    }
  256|  24.3k|    return messageLength;
  257|  24.3k|}
_ZN3uWS8protocol14cond_byte_swapItEET_S2_:
   95|  13.6k|T cond_byte_swap(T value) {
   96|  13.6k|    uint32_t endian_test = 1;
   97|  13.6k|    if (*((char *)&endian_test)) {
  ------------------
  |  Branch (97:9): [True: 13.6k, False: 0]
  ------------------
   98|  13.6k|        union {
   99|  13.6k|            T i;
  100|  13.6k|            uint8_t b[sizeof(T)];
  101|  13.6k|        } src = { value }, dst;
  102|       |
  103|  40.9k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 27.3k, False: 13.6k]
  ------------------
  104|  27.3k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  27.3k|        }
  106|       |
  107|  13.6k|        return dst.i;
  108|  13.6k|    }
  109|      0|    return value;
  110|  13.6k|}
_ZN3uWS8protocol14cond_byte_swapImEET_S2_:
   95|  3.64k|T cond_byte_swap(T value) {
   96|  3.64k|    uint32_t endian_test = 1;
   97|  3.64k|    if (*((char *)&endian_test)) {
  ------------------
  |  Branch (97:9): [True: 3.64k, False: 0]
  ------------------
   98|  3.64k|        union {
   99|  3.64k|            T i;
  100|  3.64k|            uint8_t b[sizeof(T)];
  101|  3.64k|        } src = { value }, dst;
  102|       |
  103|  32.7k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 29.1k, False: 3.64k]
  ------------------
  104|  29.1k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  29.1k|        }
  106|       |
  107|  3.64k|        return dst.i;
  108|  3.64k|    }
  109|      0|    return value;
  110|  3.64k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL16messageFrameSizeEm:
  193|  24.3k|static inline size_t messageFrameSize(size_t messageSize) {
  194|  24.3k|    if (messageSize < 126) {
  ------------------
  |  Branch (194:9): [True: 23.7k, False: 625]
  ------------------
  195|  23.7k|        return 2 + messageSize;
  196|  23.7k|    } else if (messageSize <= UINT16_MAX) {
  ------------------
  |  Branch (196:16): [True: 625, False: 0]
  ------------------
  197|    625|        return 4 + messageSize;
  198|    625|    }
  199|      0|    return 10 + messageSize;
  200|  24.3k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE7consumeEPcjPNS_14WebSocketStateILb1EEEPv:
  458|  60.7k|    static inline void consume(char *src, unsigned int length, WebSocketState<isServer> *wState, void *user) {
  459|  60.7k|        if (wState->state.spillLength) {
  ------------------
  |  Branch (459:13): [True: 3.14k, False: 57.6k]
  ------------------
  460|  3.14k|            src -= wState->state.spillLength;
  461|  3.14k|            length += wState->state.spillLength;
  462|  3.14k|            memcpy(src, wState->state.spill, wState->state.spillLength);
  463|  3.14k|        }
  464|  60.7k|        if (wState->state.wantsHead) {
  ------------------
  |  Branch (464:13): [True: 22.6k, False: 38.1k]
  ------------------
  465|  27.4k|            parseNext:
  466|  62.4k|            while (length >= SHORT_MESSAGE_HEADER) {
  ------------------
  |  Branch (466:20): [True: 58.6k, False: 3.71k]
  ------------------
  467|       |
  468|       |                // invalid reserved bits / invalid opcodes / invalid control frames / set compressed frame
  469|  58.6k|                if ((rsv1(src) && !Impl::setCompressed(wState, user)) || rsv23(src) || (getOpCode(src) > 2 && getOpCode(src) < 8) ||
  ------------------
  |  Branch (469:22): [True: 3.24k, False: 55.4k]
  |  Branch (469:35): [True: 1.39k, False: 1.85k]
  |  Branch (469:74): [True: 1.03k, False: 56.2k]
  |  Branch (469:89): [True: 16.0k, False: 40.2k]
  |  Branch (469:111): [True: 268, False: 15.7k]
  ------------------
  470|  58.6k|                    getOpCode(src) > 10 || (getOpCode(src) > 2 && (!isFin(src) || payloadLength(src) > 125))) {
  ------------------
  |  Branch (470:21): [True: 260, False: 55.7k]
  |  Branch (470:45): [True: 15.5k, False: 40.2k]
  |  Branch (470:68): [True: 306, False: 15.2k]
  |  Branch (470:83): [True: 316, False: 14.9k]
  ------------------
  471|  3.57k|                    Impl::forceClose(wState, user);
  472|  3.57k|                    return;
  473|  3.57k|                }
  474|       |
  475|  55.1k|                if (payloadLength(src) < 126) {
  ------------------
  |  Branch (475:21): [True: 44.5k, False: 10.5k]
  ------------------
  476|  44.5k|                    if (consumeMessage<SHORT_MESSAGE_HEADER, uint8_t>(payloadLength(src), src, length, wState, user)) {
  ------------------
  |  Branch (476:25): [True: 13.5k, False: 30.9k]
  ------------------
  477|  13.5k|                        return;
  478|  13.5k|                    }
  479|  44.5k|                } else if (payloadLength(src) == 126) {
  ------------------
  |  Branch (479:28): [True: 6.52k, False: 4.05k]
  ------------------
  480|  6.52k|                    if (length < MEDIUM_MESSAGE_HEADER) {
  ------------------
  |  Branch (480:25): [True: 251, False: 6.27k]
  ------------------
  481|    251|                        break;
  482|  6.27k|                    } 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 (482:31): [True: 3.42k, False: 2.85k]
  ------------------
  483|  3.42k|                        return;
  484|  3.42k|                    }
  485|  6.52k|                } else if (length < LONG_MESSAGE_HEADER) {
  ------------------
  |  Branch (485:28): [True: 406, False: 3.64k]
  ------------------
  486|    406|                    break;
  487|  3.64k|                } 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 (487:28): [True: 2.51k, False: 1.12k]
  ------------------
  488|  2.51k|                    return;
  489|  2.51k|                }
  490|  55.1k|            }
  491|  4.37k|            if (length) {
  ------------------
  |  Branch (491:17): [True: 3.61k, False: 756]
  ------------------
  492|  3.61k|                memcpy(wState->state.spill, src, length);
  493|  3.61k|                wState->state.spillLength = length & 0xf;
  494|  3.61k|            }
  495|  38.1k|        } else if (consumeContinuation(src, length, wState, user)) {
  ------------------
  |  Branch (495:20): [True: 4.85k, False: 33.3k]
  ------------------
  496|  4.85k|            goto parseNext;
  497|  4.85k|        }
  498|  60.7k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE4rsv1EPc:
  274|  58.6k|    static inline bool rsv1(char *frame) {return *((unsigned char *) frame) & 64;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5rsv23EPc:
  273|  57.3k|    static inline bool rsv23(char *frame) {return *((unsigned char *) frame) & 48;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE9getOpCodeEPc:
  271|   287k|    static inline unsigned char getOpCode(char *frame) {return *((unsigned char *) frame) & 15;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5isFinEPc:
  270|   119k|    static inline bool isFin(char *frame) {return *((unsigned char *) frame) & 128;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13payloadLengthEPc:
  272|   125k|    static inline unsigned char payloadLength(char *frame) {return ((unsigned char *) frame)[1] & 127;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj6EhEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  44.5k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  44.5k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 36.5k, False: 7.95k]
  ------------------
  342|  36.5k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 202, False: 36.3k]
  |  Branch (342:48): [True: 3.50k, False: 32.8k]
  |  Branch (342:74): [True: 232, False: 3.27k]
  ------------------
  343|    434|                Impl::forceClose(wState, user);
  344|    434|                return true;
  345|    434|            }
  346|  36.1k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  36.1k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 353, False: 7.60k]
  ------------------
  348|    353|            Impl::forceClose(wState, user);
  349|    353|            return true;
  350|    353|        }
  351|  43.7k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  43.7k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 0, False: 43.7k]
  ------------------
  354|      0|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|      0|            return true;
  356|      0|        }
  357|       |
  358|  43.7k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 35.9k, False: 7.85k]
  ------------------
  359|  35.9k|            bool fin = isFin(src);
  360|  35.9k|            if (isServer) {
  ------------------
  |  Branch (360:17): [Folded - Ignored]
  ------------------
  361|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  362|  35.9k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  35.9k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 4.93k, False: 30.9k]
  ------------------
  364|  4.93k|                    return true;
  365|  4.93k|                }
  366|  35.9k|            } else {
  367|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (367:21): [True: 0, False: 0]
  ------------------
  368|      0|                    return true;
  369|      0|                }
  370|      0|            }
  371|       |
  372|  30.9k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 20.5k, False: 10.4k]
  ------------------
  373|  20.5k|                wState->state.opStack--;
  374|  20.5k|            }
  375|       |
  376|  30.9k|            src += payLength + MESSAGE_HEADER;
  377|  30.9k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  30.9k|            wState->state.spillLength = 0;
  379|  30.9k|            return false;
  380|  35.9k|        } else {
  381|  7.85k|            wState->state.spillLength = 0;
  382|  7.85k|            wState->state.wantsHead = false;
  383|  7.85k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  7.85k|            bool fin = isFin(src);
  385|  7.85k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  7.85k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  7.85k|                uint64_t mask;
  388|  7.85k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  7.85k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  7.85k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  7.85k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  7.85k|            }
  393|  7.85k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  7.85k|            return true;
  395|  7.85k|        }
  396|  43.7k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi6EEEvPcj:
  308|  35.9k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  35.9k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  35.9k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  35.9k|            uint64_t maskInt;
  312|  35.9k|            memcpy(&maskInt, mask, 8);
  313|  35.9k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  35.9k|        } else {
  315|  35.9k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  35.9k|            uint32_t maskInt;
  317|  35.9k|            memcpy(&maskInt, mask, 4);
  318|  35.9k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  35.9k|        }
  320|  35.9k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise4ILi6EEEvPcjj:
  297|  35.9k|    static inline void unmaskImprecise4(char *src, uint32_t mask, unsigned int length) {
  298|   116k|        for (unsigned int n = (length >> 2) + 1; n; n--) {
  ------------------
  |  Branch (298:50): [True: 81.0k, False: 35.9k]
  ------------------
  299|  81.0k|            uint32_t loaded;
  300|  81.0k|            memcpy(&loaded, src, 4);
  301|  81.0k|            loaded ^= mask;
  302|  81.0k|            memcpy(src - DESTINATION, &loaded, 4);
  303|  81.0k|            src += 4;
  304|  81.0k|        }
  305|  35.9k|    }
EpollHelloWorld.cpp:_ZN3uWS8protocolL11isValidUtf8EPhm:
  117|  18.5k|{
  118|  57.9k|    for (unsigned char *e = s + length; s != e; ) {
  ------------------
  |  Branch (118:41): [True: 56.9k, False: 975]
  ------------------
  119|  56.9k|        if (s + 4 <= e) {
  ------------------
  |  Branch (119:13): [True: 42.1k, False: 14.8k]
  ------------------
  120|  42.1k|            uint32_t tmp;
  121|  42.1k|            memcpy(&tmp, s, 4);
  122|  42.1k|            if ((tmp & 0x80808080) == 0) {
  ------------------
  |  Branch (122:17): [True: 36.8k, False: 5.31k]
  ------------------
  123|  36.8k|                s += 4;
  124|  36.8k|                continue;
  125|  36.8k|            }
  126|  42.1k|        }
  127|       |
  128|  25.8k|        while (!(*s & 0x80)) {
  ------------------
  |  Branch (128:16): [True: 18.4k, False: 7.38k]
  ------------------
  129|  18.4k|            if (++s == e) {
  ------------------
  |  Branch (129:17): [True: 12.7k, False: 5.71k]
  ------------------
  130|  12.7k|                return true;
  131|  12.7k|            }
  132|  18.4k|        }
  133|       |
  134|  7.38k|        if ((s[0] & 0x60) == 0x40) {
  ------------------
  |  Branch (134:13): [True: 2.22k, False: 5.15k]
  ------------------
  135|  2.22k|            if (s + 1 >= e || (s[1] & 0xc0) != 0x80 || (s[0] & 0xfe) == 0xc0) {
  ------------------
  |  Branch (135:17): [True: 251, False: 1.97k]
  |  Branch (135:31): [True: 513, False: 1.46k]
  |  Branch (135:56): [True: 194, False: 1.26k]
  ------------------
  136|    958|                return false;
  137|    958|            }
  138|  1.26k|            s += 2;
  139|  5.15k|        } else if ((s[0] & 0xf0) == 0xe0) {
  ------------------
  |  Branch (139:20): [True: 2.36k, False: 2.79k]
  ------------------
  140|  2.36k|            if (s + 2 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (140:17): [True: 485, False: 1.87k]
  |  Branch (140:31): [True: 587, False: 1.29k]
  |  Branch (140:56): [True: 203, False: 1.08k]
  ------------------
  141|  2.36k|                    (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || (s[0] == 0xed && (s[1] & 0xe0) == 0xa0)) {
  ------------------
  |  Branch (141:22): [True: 412, False: 675]
  |  Branch (141:38): [True: 209, False: 203]
  |  Branch (141:65): [True: 400, False: 478]
  |  Branch (141:81): [True: 195, False: 205]
  ------------------
  142|  1.67k|                return false;
  143|  1.67k|            }
  144|    683|            s += 3;
  145|  2.79k|        } else if ((s[0] & 0xf8) == 0xf0) {
  ------------------
  |  Branch (145:20): [True: 2.15k, False: 641]
  ------------------
  146|  2.15k|            if (s + 3 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (146:17): [True: 243, False: 1.91k]
  |  Branch (146:31): [True: 213, False: 1.69k]
  |  Branch (146:56): [True: 251, False: 1.44k]
  |  Branch (146:81): [True: 231, False: 1.21k]
  ------------------
  147|  2.15k|                    (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4) {
  ------------------
  |  Branch (147:22): [True: 394, False: 823]
  |  Branch (147:38): [True: 194, False: 200]
  |  Branch (147:65): [True: 399, False: 624]
  |  Branch (147:81): [True: 201, False: 198]
  |  Branch (147:97): [True: 195, False: 627]
  ------------------
  148|  1.52k|                return false;
  149|  1.52k|            }
  150|    627|            s += 4;
  151|    641|        } else {
  152|    641|            return false;
  153|    641|        }
  154|  7.38k|    }
  155|    975|    return true;
  156|  18.5k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL17parseClosePayloadEPcm:
  164|  6.08k|static inline CloseFrame parseClosePayload(char *src, size_t length) {
  165|       |    /* If we get no code or message, default to reporting 1005 no status code present */
  166|  6.08k|    CloseFrame cf = {1005, nullptr, 0};
  167|  6.08k|    if (length >= 2) {
  ------------------
  |  Branch (167:9): [True: 5.49k, False: 587]
  ------------------
  168|  5.49k|        memcpy(&cf.code, src, 2);
  169|  5.49k|        cf = {cond_byte_swap<uint16_t>(cf.code), src + 2, length - 2};
  170|  5.49k|        if (cf.code < 1000 || cf.code > 4999 || (cf.code > 1011 && cf.code < 4000) ||
  ------------------
  |  Branch (170:13): [True: 564, False: 4.93k]
  |  Branch (170:31): [True: 1.06k, False: 3.86k]
  |  Branch (170:50): [True: 2.35k, False: 1.50k]
  |  Branch (170:68): [True: 437, False: 1.92k]
  ------------------
  171|  5.49k|            (cf.code >= 1004 && cf.code <= 1006) || !isValidUtf8((unsigned char *) cf.message, cf.length)) {
  ------------------
  |  Branch (171:14): [True: 2.77k, False: 654]
  |  Branch (171:33): [True: 390, False: 2.38k]
  |  Branch (171:53): [True: 1.77k, False: 1.26k]
  ------------------
  172|       |            /* Even though we got a WebSocket close frame, it in itself is abnormal */
  173|  4.23k|            return {1006, nullptr, 0};
  174|  4.23k|        }
  175|  5.49k|    }
  176|  1.85k|    return cf;
  177|  6.08k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL18formatClosePayloadEPctPKcm:
  179|  6.08k|static inline size_t formatClosePayload(char *dst, uint16_t code, const char *message, size_t length) {
  180|       |    /* We could have more strict checks here, but never append code 0 or 1005 or 1006 */
  181|  6.08k|    if (code && code != 1005 && code != 1006) {
  ------------------
  |  Branch (181:9): [True: 6.08k, False: 0]
  |  Branch (181:17): [True: 5.49k, False: 587]
  |  Branch (181:33): [True: 1.26k, False: 4.23k]
  ------------------
  182|  1.26k|        code = cond_byte_swap<uint16_t>(code);
  183|  1.26k|        memcpy(dst, &code, 2);
  184|       |        /* It is invalid to pass nullptr to memcpy, even though length is 0 */
  185|  1.26k|        if (message) {
  ------------------
  |  Branch (185:13): [True: 1.26k, False: 0]
  ------------------
  186|  1.26k|            memcpy(dst + 2, message, length);
  187|  1.26k|        }
  188|  1.26k|        return length + 2;
  189|  1.26k|    }
  190|  4.81k|    return 0;
  191|  6.08k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi0EEEvPcmj:
  285|  10.4k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  60.2k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 49.7k, False: 10.4k]
  ------------------
  287|  49.7k|            uint64_t loaded;
  288|  49.7k|            memcpy(&loaded, src, 8);
  289|  49.7k|            loaded ^= mask;
  290|  49.7k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  49.7k|            src += 8;
  292|  49.7k|        }
  293|  10.4k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE10rotateMaskEjPc:
  322|  40.4k|    static inline void rotateMask(unsigned int offset, char *mask) {
  323|  40.4k|        char originalMask[4] = {mask[0], mask[1], mask[2], mask[3]};
  324|  40.4k|        mask[(0 + offset) % 4] = originalMask[0];
  325|  40.4k|        mask[(1 + offset) % 4] = originalMask[1];
  326|  40.4k|        mask[(2 + offset) % 4] = originalMask[2];
  327|  40.4k|        mask[(3 + offset) % 4] = originalMask[3];
  328|  40.4k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj8EtEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  6.27k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  6.27k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 5.30k, False: 976]
  ------------------
  342|  5.30k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 194, False: 5.10k]
  |  Branch (342:48): [True: 1.61k, False: 3.49k]
  |  Branch (342:74): [True: 194, False: 1.41k]
  ------------------
  343|    388|                Impl::forceClose(wState, user);
  344|    388|                return true;
  345|    388|            }
  346|  4.91k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  4.91k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 194, False: 782]
  ------------------
  348|    194|            Impl::forceClose(wState, user);
  349|    194|            return true;
  350|    194|        }
  351|  5.69k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  5.69k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 442, False: 5.25k]
  ------------------
  354|    442|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    442|            return true;
  356|    442|        }
  357|       |
  358|  5.25k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 3.73k, False: 1.52k]
  ------------------
  359|  3.73k|            bool fin = isFin(src);
  360|  3.73k|            if (isServer) {
  ------------------
  |  Branch (360:17): [Folded - Ignored]
  ------------------
  361|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  362|  3.73k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  3.73k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 881, False: 2.85k]
  ------------------
  364|    881|                    return true;
  365|    881|                }
  366|  3.73k|            } else {
  367|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (367:21): [True: 0, False: 0]
  ------------------
  368|      0|                    return true;
  369|      0|                }
  370|      0|            }
  371|       |
  372|  2.85k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 2.12k, False: 723]
  ------------------
  373|  2.12k|                wState->state.opStack--;
  374|  2.12k|            }
  375|       |
  376|  2.85k|            src += payLength + MESSAGE_HEADER;
  377|  2.85k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  2.85k|            wState->state.spillLength = 0;
  379|  2.85k|            return false;
  380|  3.73k|        } else {
  381|  1.52k|            wState->state.spillLength = 0;
  382|  1.52k|            wState->state.wantsHead = false;
  383|  1.52k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  1.52k|            bool fin = isFin(src);
  385|  1.52k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  1.52k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  1.52k|                uint64_t mask;
  388|  1.52k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  1.52k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  1.52k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  1.52k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  1.52k|            }
  393|  1.52k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  1.52k|            return true;
  395|  1.52k|        }
  396|  5.25k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi8EEEvPcj:
  308|  3.73k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  3.73k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  3.73k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  3.73k|            uint64_t maskInt;
  312|  3.73k|            memcpy(&maskInt, mask, 8);
  313|  3.73k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  3.73k|        } else {
  315|  3.73k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  3.73k|            uint32_t maskInt;
  317|  3.73k|            memcpy(&maskInt, mask, 4);
  318|  3.73k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  3.73k|        }
  320|  3.73k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi8EEEvPcmj:
  285|  3.73k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  18.3k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 14.6k, False: 3.73k]
  ------------------
  287|  14.6k|            uint64_t loaded;
  288|  14.6k|            memcpy(&loaded, src, 8);
  289|  14.6k|            loaded ^= mask;
  290|  14.6k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  14.6k|            src += 8;
  292|  14.6k|        }
  293|  3.73k|    }
_ZN3uWS8protocol8bit_castItEET_Pc:
   87|  6.27k|T bit_cast(char *c) {
   88|  6.27k|    T val;
   89|  6.27k|    memcpy(&val, c, sizeof(T));
   90|  6.27k|    return val;
   91|  6.27k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj14EmEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  3.64k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  3.64k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 2.46k, False: 1.17k]
  ------------------
  342|  2.46k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 194, False: 2.27k]
  |  Branch (342:48): [True: 512, False: 1.75k]
  |  Branch (342:74): [True: 199, False: 313]
  ------------------
  343|    393|                Impl::forceClose(wState, user);
  344|    393|                return true;
  345|    393|            }
  346|  2.07k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  2.07k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 194, False: 985]
  ------------------
  348|    194|            Impl::forceClose(wState, user);
  349|    194|            return true;
  350|    194|        }
  351|  3.05k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  3.05k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 411, False: 2.64k]
  ------------------
  354|    411|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    411|            return true;
  356|    411|        }
  357|       |
  358|  2.64k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 1.52k, False: 1.11k]
  ------------------
  359|  1.52k|            bool fin = isFin(src);
  360|  1.52k|            if (isServer) {
  ------------------
  |  Branch (360:17): [Folded - Ignored]
  ------------------
  361|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  362|  1.52k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  1.52k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 400, False: 1.12k]
  ------------------
  364|    400|                    return true;
  365|    400|                }
  366|  1.52k|            } else {
  367|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (367:21): [True: 0, False: 0]
  ------------------
  368|      0|                    return true;
  369|      0|                }
  370|      0|            }
  371|       |
  372|  1.12k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 314, False: 813]
  ------------------
  373|    314|                wState->state.opStack--;
  374|    314|            }
  375|       |
  376|  1.12k|            src += payLength + MESSAGE_HEADER;
  377|  1.12k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  1.12k|            wState->state.spillLength = 0;
  379|  1.12k|            return false;
  380|  1.52k|        } else {
  381|  1.11k|            wState->state.spillLength = 0;
  382|  1.11k|            wState->state.wantsHead = false;
  383|  1.11k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  1.11k|            bool fin = isFin(src);
  385|  1.11k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  1.11k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  1.11k|                uint64_t mask;
  388|  1.11k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  1.11k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  1.11k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  1.11k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  1.11k|            }
  393|  1.11k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  1.11k|            return true;
  395|  1.11k|        }
  396|  2.64k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi14EEEvPcj:
  308|  1.52k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  1.52k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  1.52k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  1.52k|            uint64_t maskInt;
  312|  1.52k|            memcpy(&maskInt, mask, 8);
  313|  1.52k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  1.52k|        } else {
  315|  1.52k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  1.52k|            uint32_t maskInt;
  317|  1.52k|            memcpy(&maskInt, mask, 4);
  318|  1.52k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  1.52k|        }
  320|  1.52k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi14EEEvPcmj:
  285|  1.52k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  10.1k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 8.60k, False: 1.52k]
  ------------------
  287|  8.60k|            uint64_t loaded;
  288|  8.60k|            memcpy(&loaded, src, 8);
  289|  8.60k|            loaded ^= mask;
  290|  8.60k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  8.60k|            src += 8;
  292|  8.60k|        }
  293|  1.52k|    }
_ZN3uWS8protocol8bit_castImEET_Pc:
   87|  3.64k|T bit_cast(char *c) {
   88|  3.64k|    T val;
   89|  3.64k|    memcpy(&val, c, sizeof(T));
   90|  3.64k|    return val;
   91|  3.64k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE19consumeContinuationERPcRjPNS_14WebSocketStateILb1EEEPv:
  405|  38.1k|    static inline bool consumeContinuation(char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  406|  38.1k|        if (wState->remainingBytes <= length) {
  ------------------
  |  Branch (406:13): [True: 7.76k, False: 30.4k]
  ------------------
  407|  7.76k|            if (isServer) {
  ------------------
  |  Branch (407:17): [Folded - Ignored]
  ------------------
  408|  7.76k|                unsigned int n = wState->remainingBytes >> 2;
  409|  7.76k|                unmaskInplace(src, src + n * 4, wState->mask);
  410|  24.3k|                for (unsigned int i = 0, s = wState->remainingBytes % 4; i < s; i++) {
  ------------------
  |  Branch (410:74): [True: 16.5k, False: 7.76k]
  ------------------
  411|  16.5k|                    src[n * 4 + i] ^= wState->mask[i];
  412|  16.5k|                }
  413|  7.76k|            }
  414|       |
  415|  7.76k|            if (Impl::handleFragment(src, wState->remainingBytes, 0, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (415:17): [True: 2.90k, False: 4.85k]
  ------------------
  416|  2.90k|                return false;
  417|  2.90k|            }
  418|       |
  419|  4.85k|            if (wState->state.lastFin) {
  ------------------
  |  Branch (419:17): [True: 2.56k, False: 2.29k]
  ------------------
  420|  2.56k|                wState->state.opStack--;
  421|  2.56k|            }
  422|       |
  423|  4.85k|            src += wState->remainingBytes;
  424|  4.85k|            length -= wState->remainingBytes;
  425|  4.85k|            wState->state.wantsHead = true;
  426|  4.85k|            return true;
  427|  30.4k|        } else {
  428|  30.4k|            if (isServer) {
  ------------------
  |  Branch (428:17): [Folded - Ignored]
  ------------------
  429|       |                /* No need to unmask if mask is 0 */
  430|  30.4k|                uint32_t nullmask = 0;
  431|  30.4k|                if (memcmp(wState->mask, &nullmask, sizeof(uint32_t))) {
  ------------------
  |  Branch (431:21): [True: 29.8k, False: 538]
  ------------------
  432|  29.8k|                    if /*constexpr*/ (LIBUS_RECV_BUFFER_LENGTH == length) {
  ------------------
  |  |   22|  29.8k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  |  Branch (432:39): [True: 0, False: 29.8k]
  ------------------
  433|      0|                        unmaskAll(src, wState->mask);
  434|  29.8k|                    } else {
  435|       |                        // Slow path
  436|  29.8k|                        unmaskInplace(src, src + ((length >> 2) + 1) * 4, wState->mask);
  437|  29.8k|                    }
  438|  29.8k|                }
  439|  30.4k|            }
  440|       |
  441|  30.4k|            wState->remainingBytes -= length;
  442|  30.4k|            if (Impl::handleFragment(src, length, wState->remainingBytes, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (442:17): [True: 66, False: 30.3k]
  ------------------
  443|     66|                return false;
  444|     66|            }
  445|       |
  446|  30.3k|            if (isServer && length % 4) {
  ------------------
  |  Branch (446:17): [Folded - Ignored]
  |  Branch (446:29): [True: 29.9k, False: 367]
  ------------------
  447|  29.9k|                rotateMask(4 - (length % 4), wState->mask);
  448|  29.9k|            }
  449|  30.3k|            return false;
  450|  30.4k|        }
  451|  38.1k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13unmaskInplaceEPcS5_S5_:
  330|  37.6k|    static inline void unmaskInplace(char *data, char *stop, char *mask) {
  331|  1.08M|        while (data < stop) {
  ------------------
  |  Branch (331:16): [True: 1.04M, False: 37.6k]
  ------------------
  332|  1.04M|            *(data++) ^= mask[0];
  333|  1.04M|            *(data++) ^= mask[1];
  334|  1.04M|            *(data++) ^= mask[2];
  335|  1.04M|            *(data++) ^= mask[3];
  336|  1.04M|        }
  337|  37.6k|    }
_ZN3uWS14WebSocketStateILb1EE5StateC2Ev:
   70|  33.5k|        State() {
   71|  33.5k|            wantsHead = true;
   72|  33.5k|            spillLength = 0;
   73|  33.5k|            opStack = -1;
   74|  33.5k|            lastFin = true;
   75|  33.5k|        }

apple_no_sigpipe:
  259|  2.14M|LIBUS_SOCKET_DESCRIPTOR apple_no_sigpipe(LIBUS_SOCKET_DESCRIPTOR fd) {
  260|       |#ifdef __APPLE__
  261|       |    if (fd != LIBUS_SOCKET_ERROR) {
  262|       |        int no_sigpipe = 1;
  263|       |        setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (void *) &no_sigpipe, sizeof(int));
  264|       |    }
  265|       |#endif
  266|  2.14M|    return fd;
  267|  2.14M|}
bsd_set_nonblocking:
  269|  2.14M|LIBUS_SOCKET_DESCRIPTOR bsd_set_nonblocking(LIBUS_SOCKET_DESCRIPTOR fd) {
  270|       |#ifdef _WIN32
  271|       |    /* Libuv will set windows sockets as non-blocking */
  272|       |#else
  273|  2.14M|    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
  274|  2.14M|#endif
  275|  2.14M|    return fd;
  276|  2.14M|}
bsd_socket_nodelay:
  278|  2.13M|void bsd_socket_nodelay(LIBUS_SOCKET_DESCRIPTOR fd, int enabled) {
  279|  2.13M|    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &enabled, sizeof(enabled));
  280|  2.13M|}
bsd_socket_flush:
  282|    281|void bsd_socket_flush(LIBUS_SOCKET_DESCRIPTOR fd) {
  283|       |    // Linux TCP_CORK has the same underlying corking mechanism as with MSG_MORE
  284|    281|#ifdef TCP_CORK
  285|    281|    int enabled = 0;
  286|    281|    setsockopt(fd, IPPROTO_TCP, TCP_CORK, (void *) &enabled, sizeof(int));
  287|    281|#endif
  288|    281|}
bsd_create_socket:
  290|  11.9k|LIBUS_SOCKET_DESCRIPTOR bsd_create_socket(int domain, int type, int protocol) {
  291|       |    // returns INVALID_SOCKET on error
  292|  11.9k|    int flags = 0;
  293|  11.9k|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  294|  11.9k|    flags = SOCK_CLOEXEC | SOCK_NONBLOCK;
  295|  11.9k|#endif
  296|       |
  297|  11.9k|    LIBUS_SOCKET_DESCRIPTOR created_fd = socket(domain, type | flags, protocol);
  ------------------
  |  |   38|  11.9k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  298|       |
  299|  11.9k|    return bsd_set_nonblocking(apple_no_sigpipe(created_fd));
  300|  11.9k|}
bsd_close_socket:
  302|  2.13M|void bsd_close_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  303|       |#ifdef _WIN32
  304|       |    closesocket(fd);
  305|       |#else
  306|  2.13M|    close(fd);
  307|  2.13M|#endif
  308|  2.13M|}
bsd_shutdown_socket:
  310|   280k|void bsd_shutdown_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  311|       |#ifdef _WIN32
  312|       |    shutdown(fd, SD_SEND);
  313|       |#else
  314|   280k|    shutdown(fd, SHUT_WR);
  315|   280k|#endif
  316|   280k|}
bsd_shutdown_socket_read:
  318|    613|void bsd_shutdown_socket_read(LIBUS_SOCKET_DESCRIPTOR fd) {
  319|       |#ifdef _WIN32
  320|       |    shutdown(fd, SD_RECEIVE);
  321|       |#else
  322|    613|    shutdown(fd, SHUT_RD);
  323|    613|#endif
  324|    613|}
internal_finalize_bsd_addr:
  326|  2.16M|void internal_finalize_bsd_addr(struct bsd_addr_t *addr) {
  327|       |    // parse, so to speak, the address
  328|  2.16M|    if (addr->mem.ss_family == AF_INET6) {
  ------------------
  |  Branch (328:9): [True: 1.46M, False: 700k]
  ------------------
  329|  1.46M|        addr->ip = (char *) &((struct sockaddr_in6 *) addr)->sin6_addr;
  330|  1.46M|        addr->ip_length = sizeof(struct in6_addr);
  331|  1.46M|        addr->port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
  332|  1.46M|    } else if (addr->mem.ss_family == AF_INET) {
  ------------------
  |  Branch (332:16): [True: 700k, False: 0]
  ------------------
  333|   700k|        addr->ip = (char *) &((struct sockaddr_in *) addr)->sin_addr;
  334|   700k|        addr->ip_length = sizeof(struct in_addr);
  335|   700k|        addr->port = ntohs(((struct sockaddr_in *) addr)->sin_port);
  336|   700k|    } else {
  337|      0|        addr->ip_length = 0;
  338|      0|        addr->port = -1;
  339|      0|    }
  340|  2.16M|}
bsd_local_addr:
  342|  2.76k|int bsd_local_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  343|  2.76k|    addr->len = sizeof(addr->mem);
  344|  2.76k|    if (getsockname(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (344:9): [True: 2.76k, False: 0]
  ------------------
  345|  2.76k|        return -1;
  346|  2.76k|    }
  347|      0|    internal_finalize_bsd_addr(addr);
  348|      0|    return 0;
  349|  2.76k|}
bsd_remote_addr:
  351|  32.3k|int bsd_remote_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  352|  32.3k|    addr->len = sizeof(addr->mem);
  353|  32.3k|    if (getpeername(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 32.3k]
  ------------------
  354|      0|        return -1;
  355|      0|    }
  356|  32.3k|    internal_finalize_bsd_addr(addr);
  357|  32.3k|    return 0;
  358|  32.3k|}
bsd_addr_get_ip:
  360|  2.16M|char *bsd_addr_get_ip(struct bsd_addr_t *addr) {
  361|  2.16M|    return addr->ip;
  362|  2.16M|}
bsd_addr_get_ip_length:
  364|  2.19M|int bsd_addr_get_ip_length(struct bsd_addr_t *addr) {
  365|  2.19M|    return addr->ip_length;
  366|  2.19M|}
bsd_accept_socket:
  373|  3.24M|LIBUS_SOCKET_DESCRIPTOR bsd_accept_socket(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  374|  3.24M|    LIBUS_SOCKET_DESCRIPTOR accepted_fd;
  ------------------
  |  |   38|  3.24M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  375|  3.24M|    addr->len = sizeof(addr->mem);
  376|       |
  377|  3.24M|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  378|       |    // Linux, FreeBSD
  379|  3.24M|    accepted_fd = accept4(fd, (struct sockaddr *) addr, &addr->len, SOCK_CLOEXEC | SOCK_NONBLOCK);
  380|       |#else
  381|       |    // Windows, OS X
  382|       |    accepted_fd = accept(fd, (struct sockaddr *) addr, &addr->len);
  383|       |
  384|       |#endif
  385|       |
  386|       |    /* We cannot rely on addr since it is not initialized if failed */
  387|  3.24M|    if (accepted_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  3.24M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (387:9): [True: 1.11M, False: 2.12M]
  ------------------
  388|  1.11M|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  1.11M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  389|  1.11M|    }
  390|       |
  391|  2.12M|    internal_finalize_bsd_addr(addr);
  392|       |
  393|  2.12M|    return bsd_set_nonblocking(apple_no_sigpipe(accepted_fd));
  394|  3.24M|}
bsd_recv:
  396|   461k|int bsd_recv(LIBUS_SOCKET_DESCRIPTOR fd, void *buf, int length, int flags) {
  397|   461k|    return recv(fd, buf, length, flags);
  398|   461k|}
bsd_send:
  426|   431k|int bsd_send(LIBUS_SOCKET_DESCRIPTOR fd, const char *buf, int length, int msg_more) {
  427|       |
  428|       |    // MSG_MORE (Linux), MSG_PARTIAL (Windows), TCP_NOPUSH (BSD)
  429|       |
  430|       |#ifndef MSG_NOSIGNAL
  431|       |#define MSG_NOSIGNAL 0
  432|       |#endif
  433|       |
  434|   431k|#ifdef MSG_MORE
  435|       |
  436|       |    // for Linux we do not want signals
  437|   431k|    return send(fd, buf, length, ((msg_more != 0) * MSG_MORE) | MSG_NOSIGNAL);
  438|       |
  439|       |#else
  440|       |
  441|       |    // use TCP_NOPUSH
  442|       |
  443|       |    return send(fd, buf, length, MSG_NOSIGNAL);
  444|       |
  445|       |#endif
  446|   431k|}
bsd_would_block:
  448|  1.83k|int bsd_would_block() {
  449|       |#ifdef _WIN32
  450|       |    return WSAGetLastError() == WSAEWOULDBLOCK;
  451|       |#else
  452|  1.83k|    return errno == EWOULDBLOCK;// || errno == EAGAIN;
  453|  1.83k|#endif
  454|  1.83k|}
bsd_create_listen_socket:
  458|  6.03k|LIBUS_SOCKET_DESCRIPTOR bsd_create_listen_socket(const char *host, int port, int options) {
  459|  6.03k|    struct addrinfo hints, *result;
  460|  6.03k|    memset(&hints, 0, sizeof(struct addrinfo));
  461|       |
  462|  6.03k|    hints.ai_flags = AI_PASSIVE;
  463|  6.03k|    hints.ai_family = AF_UNSPEC;
  464|  6.03k|    hints.ai_socktype = SOCK_STREAM;
  465|       |
  466|  6.03k|    char port_string[16];
  467|  6.03k|    snprintf(port_string, 16, "%d", port);
  468|       |
  469|  6.03k|    if (getaddrinfo(host, port_string, &hints, &result)) {
  ------------------
  |  Branch (469:9): [True: 0, False: 6.03k]
  ------------------
  470|      0|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      0|#define LIBUS_SOCKET_ERROR -1
  ------------------
  471|      0|    }
  472|       |
  473|  6.03k|    LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   38|  6.03k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
                  LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  474|  6.03k|    struct addrinfo *listenAddr;
  475|  12.0k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (475:39): [True: 6.03k, False: 6.03k]
  |  Branch (475:44): [True: 6.03k, False: 0]
  ------------------
  476|  6.03k|        if (a->ai_family == AF_INET6) {
  ------------------
  |  Branch (476:13): [True: 5.04k, False: 986]
  ------------------
  477|  5.04k|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  478|  5.04k|            listenAddr = a;
  479|  5.04k|        }
  480|  6.03k|    }
  481|       |
  482|  7.02k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (482:39): [True: 6.03k, False: 986]
  |  Branch (482:44): [True: 986, False: 5.04k]
  ------------------
  483|    986|        if (a->ai_family == AF_INET) {
  ------------------
  |  Branch (483:13): [True: 849, False: 137]
  ------------------
  484|    849|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  485|    849|            listenAddr = a;
  486|    849|        }
  487|    986|    }
  488|       |
  489|  6.03k|    if (listenFd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (489:9): [True: 137, False: 5.89k]
  ------------------
  490|    137|        freeaddrinfo(result);
  491|    137|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|    137|#define LIBUS_SOCKET_ERROR -1
  ------------------
  492|    137|    }
  493|       |
  494|  5.89k|    if (port != 0) {
  ------------------
  |  Branch (494:9): [True: 5.89k, False: 0]
  ------------------
  495|       |        /* Otherwise, always enable SO_REUSEPORT and SO_REUSEADDR _unless_ options specify otherwise */
  496|       |#ifdef _WIN32
  497|       |        if (options & LIBUS_LISTEN_EXCLUSIVE_PORT) {
  498|       |            int optval2 = 1;
  499|       |            setsockopt(listenFd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (void *) &optval2, sizeof(optval2));
  500|       |        } else {
  501|       |            int optval3 = 1;
  502|       |            setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &optval3, sizeof(optval3));
  503|       |        }
  504|       |#else
  505|  5.89k|    #if /*defined(__linux) &&*/ defined(SO_REUSEPORT)
  506|  5.89k|        if (!(options & LIBUS_LISTEN_EXCLUSIVE_PORT)) {
  ------------------
  |  Branch (506:13): [True: 5.89k, False: 0]
  ------------------
  507|  5.89k|            int optval = 1;
  508|  5.89k|            setsockopt(listenFd, SOL_SOCKET, SO_REUSEPORT, (void *) &optval, sizeof(optval));
  509|  5.89k|        }
  510|  5.89k|    #endif
  511|  5.89k|        int enabled = 1;
  512|  5.89k|        setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &enabled, sizeof(enabled));
  513|  5.89k|#endif
  514|       |
  515|  5.89k|    }
  516|       |    
  517|  5.89k|#ifdef IPV6_V6ONLY
  518|  5.89k|    int disabled = 0;
  519|  5.89k|    setsockopt(listenFd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &disabled, sizeof(disabled));
  520|  5.89k|#endif
  521|       |
  522|  5.89k|    if (bind(listenFd, listenAddr->ai_addr, (socklen_t) listenAddr->ai_addrlen) || listen(listenFd, 512)) {
  ------------------
  |  Branch (522:9): [True: 0, False: 5.89k]
  |  Branch (522:84): [True: 13, False: 5.88k]
  ------------------
  523|     13|        bsd_close_socket(listenFd);
  524|     13|        freeaddrinfo(result);
  525|     13|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     13|#define LIBUS_SOCKET_ERROR -1
  ------------------
  526|     13|    }
  527|       |
  528|  5.88k|    freeaddrinfo(result);
  529|  5.88k|    return listenFd;
  530|  5.89k|}
bsd_create_connect_socket:
  694|  6.03k|LIBUS_SOCKET_DESCRIPTOR bsd_create_connect_socket(const char *host, int port, const char *source_host, int options) {
  695|  6.03k|    struct addrinfo hints, *result;
  696|  6.03k|    memset(&hints, 0, sizeof(struct addrinfo));
  697|  6.03k|    hints.ai_family = AF_UNSPEC;
  698|  6.03k|    hints.ai_socktype = SOCK_STREAM;
  699|       |
  700|  6.03k|    char port_string[16];
  701|  6.03k|    snprintf(port_string, 16, "%d", port);
  702|       |
  703|  6.03k|    if (getaddrinfo(host, port_string, &hints, &result) != 0) {
  ------------------
  |  Branch (703:9): [True: 21, False: 6.01k]
  ------------------
  704|     21|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     21|#define LIBUS_SOCKET_ERROR -1
  ------------------
  705|     21|    }
  706|       |
  707|  6.01k|    LIBUS_SOCKET_DESCRIPTOR fd = bsd_create_socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  ------------------
  |  |   38|  6.01k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  708|  6.01k|    if (fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.01k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (708:9): [True: 3.25k, False: 2.76k]
  ------------------
  709|  3.25k|        freeaddrinfo(result);
  710|  3.25k|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  3.25k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  711|  3.25k|    }
  712|       |
  713|  2.76k|    if (source_host) {
  ------------------
  |  Branch (713:9): [True: 2.76k, False: 0]
  ------------------
  714|  2.76k|        struct addrinfo *interface_result;
  715|  2.76k|        if (!getaddrinfo(source_host, NULL, NULL, &interface_result)) {
  ------------------
  |  Branch (715:13): [True: 2.75k, False: 4]
  ------------------
  716|  2.75k|            int ret = bind(fd, interface_result->ai_addr, (socklen_t) interface_result->ai_addrlen);
  717|  2.75k|            freeaddrinfo(interface_result);
  718|  2.75k|            if (ret == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  2.75k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (718:17): [True: 0, False: 2.75k]
  ------------------
  719|      0|                bsd_close_socket(fd);
  720|      0|                freeaddrinfo(result);
  721|      0|                return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      0|#define LIBUS_SOCKET_ERROR -1
  ------------------
  722|      0|            }
  723|  2.75k|        }
  724|  2.76k|    }
  725|       |
  726|  2.76k|    connect(fd, result->ai_addr, (socklen_t) result->ai_addrlen);
  727|  2.76k|    freeaddrinfo(result);
  728|       |
  729|  2.76k|    return fd;
  730|  2.76k|}

default_is_low_prio_handler:
   25|   461k|int default_is_low_prio_handler(struct us_socket_t *s) {
   26|   461k|    return 0;
   27|   461k|}
us_socket_context_timestamp:
   31|  6.03k|unsigned short us_socket_context_timestamp(int ssl, struct us_socket_context_t *context) {
   32|  6.03k|    return context->timestamp;
   33|  6.03k|}
us_listen_socket_close:
   35|  5.88k|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|  5.88k|    if (!us_socket_is_closed(0, &ls->s)) {
  ------------------
  |  Branch (37:9): [True: 5.88k, False: 0]
  ------------------
   38|  5.88k|        us_internal_socket_context_unlink_listen_socket(ls->s.context, ls);
   39|  5.88k|        us_poll_stop((struct us_poll_t *) &ls->s, ls->s.context->loop);
   40|  5.88k|        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|  5.88k|        ls->s.next = ls->s.context->loop->data.closed_head;
   44|  5.88k|        ls->s.context->loop->data.closed_head = &ls->s;
   45|       |
   46|       |        /* Any socket with prev = context is marked as closed */
   47|  5.88k|        ls->s.prev = (struct us_socket_t *) ls->s.context;
   48|  5.88k|    }
   49|       |
   50|       |    /* We cannot immediately free a listen socket as we can be inside an accept loop */
   51|  5.88k|}
us_internal_socket_context_unlink_listen_socket:
   71|  5.88k|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|  5.88k|    if (ls == (struct us_listen_socket_t *) context->iterator) {
  ------------------
  |  Branch (73:9): [True: 0, False: 5.88k]
  ------------------
   74|      0|        context->iterator = ls->s.next;
   75|      0|    }
   76|       |
   77|  5.88k|    if (ls->s.prev == ls->s.next) {
  ------------------
  |  Branch (77:9): [True: 5.88k, False: 0]
  ------------------
   78|  5.88k|        context->head_listen_sockets = 0;
   79|  5.88k|    } 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|  5.88k|}
us_internal_socket_context_unlink_socket:
   91|  2.16M|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|  2.16M|    if (s == context->iterator) {
  ------------------
  |  Branch (93:9): [True: 6.26k, False: 2.16M]
  ------------------
   94|  6.26k|        context->iterator = s->next;
   95|  6.26k|    }
   96|       |
   97|  2.16M|    if (s->prev == s->next) {
  ------------------
  |  Branch (97:9): [True: 188k, False: 1.97M]
  ------------------
   98|   188k|        context->head_sockets = 0;
   99|  1.97M|    } else {
  100|  1.97M|        if (s->prev) {
  ------------------
  |  Branch (100:13): [True: 911k, False: 1.06M]
  ------------------
  101|   911k|            s->prev->next = s->next;
  102|  1.06M|        } else {
  103|  1.06M|            context->head_sockets = s->next;
  104|  1.06M|        }
  105|  1.97M|        if (s->next) {
  ------------------
  |  Branch (105:13): [True: 1.96M, False: 11.0k]
  ------------------
  106|  1.96M|            s->next->prev = s->prev;
  107|  1.96M|        }
  108|  1.97M|    }
  109|  2.16M|}
us_internal_socket_context_link_listen_socket:
  112|  5.88k|void us_internal_socket_context_link_listen_socket(struct us_socket_context_t *context, struct us_listen_socket_t *ls) {
  113|  5.88k|    ls->s.context = context;
  114|  5.88k|    ls->s.next = (struct us_socket_t *) context->head_listen_sockets;
  115|  5.88k|    ls->s.prev = 0;
  116|  5.88k|    if (context->head_listen_sockets) {
  ------------------
  |  Branch (116:9): [True: 0, False: 5.88k]
  ------------------
  117|      0|        context->head_listen_sockets->s.prev = &ls->s;
  118|      0|    }
  119|  5.88k|    context->head_listen_sockets = ls;
  120|  5.88k|}
us_internal_socket_context_link_socket:
  123|  2.16M|void us_internal_socket_context_link_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
  124|  2.16M|    s->context = context;
  125|  2.16M|    s->next = context->head_sockets;
  126|  2.16M|    s->prev = 0;
  127|  2.16M|    if (context->head_sockets) {
  ------------------
  |  Branch (127:9): [True: 1.97M, False: 188k]
  ------------------
  128|  1.97M|        context->head_sockets->prev = s;
  129|  1.97M|    }
  130|  2.16M|    context->head_sockets = s;
  131|  2.16M|}
us_socket_context_loop:
  133|  2.77M|struct us_loop_t *us_socket_context_loop(int ssl, struct us_socket_context_t *context) {
  134|  2.77M|    return context->loop;
  135|  2.77M|}
us_socket_context_find_server_name_userdata:
  140|  6.03k|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.03k|    return NULL;
  147|  6.03k|}
us_socket_context_remove_server_name:
  169|  6.03k|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.03k|}
us_socket_context_on_server_name:
  182|  6.03k|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.03k|}
us_socket_context_get_native_handle:
  192|  6.03k|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.03k|    return 0;
  201|  6.03k|}
us_create_socket_context:
  204|  24.1k|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|  24.1k|    struct us_socket_context_t *context = malloc(sizeof(struct us_socket_context_t) + context_ext_size);
  216|  24.1k|    context->loop = loop;
  217|  24.1k|    context->head_sockets = 0;
  218|  24.1k|    context->head_listen_sockets = 0;
  219|  24.1k|    context->iterator = 0;
  220|  24.1k|    context->next = 0;
  221|  24.1k|    context->is_low_prio = default_is_low_prio_handler;
  222|       |
  223|       |    /* Begin at 0 */
  224|  24.1k|    context->timestamp = 0;
  225|  24.1k|    context->long_timestamp = 0;
  226|  24.1k|    context->global_tick = 0;
  227|       |
  228|  24.1k|    us_internal_loop_link(loop, context);
  229|       |
  230|       |    /* If we are called from within SSL code, SSL code will make further changes to us */
  231|  24.1k|    return context;
  232|  24.1k|}
us_socket_context_free:
  234|  24.1k|void us_socket_context_free(int ssl, struct us_socket_context_t *context) {
  235|       |#ifndef LIBUS_NO_SSL
  236|       |    if (ssl) {
  237|       |        /* This function will call us again with SSL=false */
  238|       |        us_internal_ssl_socket_context_free((struct us_internal_ssl_socket_context_t *) context);
  239|       |        return;
  240|       |    }
  241|       |#endif
  242|       |
  243|       |    /* This path is taken once either way - always AFTER whatever SSL may do BEFORE.
  244|       |     * This is the opposite order compared to when creating the context - SSL code is cleaning up before non-SSL */
  245|       |
  246|  24.1k|    us_internal_loop_unlink(context->loop, context);
  247|  24.1k|    free(context);
  248|  24.1k|}
us_socket_context_listen:
  250|  6.03k|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) {
  251|       |#ifndef LIBUS_NO_SSL
  252|       |    if (ssl) {
  253|       |        return us_internal_ssl_socket_context_listen((struct us_internal_ssl_socket_context_t *) context, host, port, options, socket_ext_size);
  254|       |    }
  255|       |#endif
  256|       |
  257|  6.03k|    LIBUS_SOCKET_DESCRIPTOR listen_socket_fd = bsd_create_listen_socket(host, port, options);
  ------------------
  |  |   38|  6.03k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  258|       |
  259|  6.03k|    if (listen_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (259:9): [True: 150, False: 5.88k]
  ------------------
  260|    150|        return 0;
  261|    150|    }
  262|       |
  263|  5.88k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_listen_socket_t));
  264|  5.88k|    us_poll_init(p, listen_socket_fd, POLL_TYPE_SEMI_SOCKET);
  265|  5.88k|    us_poll_start(p, context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  5.88k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  266|       |
  267|  5.88k|    struct us_listen_socket_t *ls = (struct us_listen_socket_t *) p;
  268|       |
  269|  5.88k|    ls->s.context = context;
  270|  5.88k|    ls->s.timeout = 255;
  271|  5.88k|    ls->s.long_timeout = 255;
  272|  5.88k|    ls->s.low_prio_state = 0;
  273|  5.88k|    ls->s.next = 0;
  274|  5.88k|    us_internal_socket_context_link_listen_socket(context, ls);
  275|       |
  276|  5.88k|    ls->socket_ext_size = socket_ext_size;
  277|       |
  278|  5.88k|    return ls;
  279|  6.03k|}
us_socket_context_connect:
  312|  6.03k|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) {
  313|       |#ifndef LIBUS_NO_SSL
  314|       |    if (ssl) {
  315|       |        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);
  316|       |    }
  317|       |#endif
  318|       |
  319|  6.03k|    LIBUS_SOCKET_DESCRIPTOR connect_socket_fd = bsd_create_connect_socket(host, port, source_host, options);
  ------------------
  |  |   38|  6.03k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  320|  6.03k|    if (connect_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  6.03k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (320:9): [True: 3.27k, False: 2.76k]
  ------------------
  321|  3.27k|        return 0;
  322|  3.27k|    }
  323|       |
  324|       |    /* Connect sockets are semi-sockets just like listen sockets */
  325|  2.76k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_socket_t) + socket_ext_size);
  326|  2.76k|    us_poll_init(p, connect_socket_fd, POLL_TYPE_SEMI_SOCKET);
  327|  2.76k|    us_poll_start(p, context->loop, LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  2.76k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  328|       |
  329|  2.76k|    struct us_socket_t *connect_socket = (struct us_socket_t *) p;
  330|       |
  331|       |    /* Link it into context so that timeout fires properly */
  332|  2.76k|    connect_socket->context = context;
  333|  2.76k|    connect_socket->timeout = 255;
  334|  2.76k|    connect_socket->long_timeout = 255;
  335|  2.76k|    connect_socket->low_prio_state = 0;
  336|  2.76k|    us_internal_socket_context_link_socket(context, connect_socket);
  337|       |
  338|  2.76k|    return connect_socket;
  339|  6.03k|}
us_create_child_socket_context:
  370|  12.0k|struct us_socket_context_t *us_create_child_socket_context(int ssl, struct us_socket_context_t *context, int context_ext_size) {
  371|       |#ifndef LIBUS_NO_SSL
  372|       |    if (ssl) {
  373|       |        return (struct us_socket_context_t *) us_internal_create_child_ssl_socket_context((struct us_internal_ssl_socket_context_t *) context, context_ext_size);
  374|       |    }
  375|       |#endif
  376|       |
  377|       |    /* For TCP we simply create a new context as nothing is shared */
  378|  12.0k|    struct us_socket_context_options_t options = {0};
  379|  12.0k|    return us_create_socket_context(ssl, context->loop, context_ext_size, options);
  380|  12.0k|}
us_socket_context_adopt_socket:
  383|  33.5k|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) {
  384|       |#ifndef LIBUS_NO_SSL
  385|       |    if (ssl) {
  386|       |        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);
  387|       |    }
  388|       |#endif
  389|       |
  390|       |    /* Cannot adopt a closed socket */
  391|  33.5k|    if (us_socket_is_closed(ssl, s)) {
  ------------------
  |  Branch (391:9): [True: 0, False: 33.5k]
  ------------------
  392|      0|        return s;
  393|      0|    }
  394|       |
  395|  33.5k|    if (s->low_prio_state != 1) {
  ------------------
  |  Branch (395:9): [True: 33.5k, False: 0]
  ------------------
  396|       |        /* This properly updates the iterator if in on_timeout */
  397|  33.5k|        us_internal_socket_context_unlink_socket(s->context, s);
  398|  33.5k|    }
  399|       |
  400|  33.5k|    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);
  401|  33.5k|    new_s->timeout = 255;
  402|  33.5k|    new_s->long_timeout = 255;
  403|       |
  404|  33.5k|    if (new_s->low_prio_state == 1) {
  ------------------
  |  Branch (404:9): [True: 0, False: 33.5k]
  ------------------
  405|       |        /* update pointers in low-priority queue */
  406|      0|        if (!new_s->prev) new_s->context->loop->data.low_prio_head = new_s;
  ------------------
  |  Branch (406:13): [True: 0, False: 0]
  ------------------
  407|      0|        else new_s->prev->next = new_s;
  408|       |
  409|      0|        if (new_s->next) new_s->next->prev = new_s;
  ------------------
  |  Branch (409:13): [True: 0, False: 0]
  ------------------
  410|  33.5k|    } else {
  411|  33.5k|        us_internal_socket_context_link_socket(context, new_s);
  412|  33.5k|    }
  413|       |
  414|  33.5k|    return new_s;
  415|  33.5k|}
us_socket_context_on_open:
  417|  12.0k|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)) {
  418|       |#ifndef LIBUS_NO_SSL
  419|       |    if (ssl) {
  420|       |        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);
  421|       |        return;
  422|       |    }
  423|       |#endif
  424|       |
  425|  12.0k|    context->on_open = on_open;
  426|  12.0k|}
us_socket_context_on_close:
  428|  24.1k|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)) {
  429|       |#ifndef LIBUS_NO_SSL
  430|       |    if (ssl) {
  431|       |        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);
  432|       |        return;
  433|       |    }
  434|       |#endif
  435|       |
  436|  24.1k|    context->on_close = on_close;
  437|  24.1k|}
us_socket_context_on_data:
  439|  24.1k|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)) {
  440|       |#ifndef LIBUS_NO_SSL
  441|       |    if (ssl) {
  442|       |        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);
  443|       |        return;
  444|       |    }
  445|       |#endif
  446|       |
  447|  24.1k|    context->on_data = on_data;
  448|  24.1k|}
us_socket_context_on_writable:
  450|  24.1k|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)) {
  451|       |#ifndef LIBUS_NO_SSL
  452|       |    if (ssl) {
  453|       |        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);
  454|       |        return;
  455|       |    }
  456|       |#endif
  457|       |
  458|  24.1k|    context->on_writable = on_writable;
  459|  24.1k|}
us_socket_context_on_long_timeout:
  461|  12.0k|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 *)) {
  462|       |#ifndef LIBUS_NO_SSL
  463|       |    if (ssl) {
  464|       |        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);
  465|       |        return;
  466|       |    }
  467|       |#endif
  468|       |
  469|  12.0k|    context->on_socket_long_timeout = on_long_timeout;
  470|  12.0k|}
us_socket_context_on_timeout:
  472|  18.1k|void us_socket_context_on_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_timeout)(struct us_socket_t *)) {
  473|       |#ifndef LIBUS_NO_SSL
  474|       |    if (ssl) {
  475|       |        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);
  476|       |        return;
  477|       |    }
  478|       |#endif
  479|       |
  480|  18.1k|    context->on_socket_timeout = on_timeout;
  481|  18.1k|}
us_socket_context_on_end:
  483|  24.1k|void us_socket_context_on_end(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_end)(struct us_socket_t *)) {
  484|       |#ifndef LIBUS_NO_SSL
  485|       |    if (ssl) {
  486|       |        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);
  487|       |        return;
  488|       |    }
  489|       |#endif
  490|       |
  491|  24.1k|    context->on_end = on_end;
  492|  24.1k|}
us_socket_context_on_connect_error:
  494|  6.03k|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)) {
  495|       |#ifndef LIBUS_NO_SSL
  496|       |    if (ssl) {
  497|       |        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);
  498|       |        return;
  499|       |    }
  500|       |#endif
  501|       |    
  502|  6.03k|    context->on_connect_error = on_connect_error;
  503|  6.03k|}
us_socket_context_ext:
  505|  5.24M|void *us_socket_context_ext(int ssl, struct us_socket_context_t *context) {
  506|       |#ifndef LIBUS_NO_SSL
  507|       |    if (ssl) {
  508|       |        return us_internal_ssl_socket_context_ext((struct us_internal_ssl_socket_context_t *) context);
  509|       |    }
  510|       |#endif
  511|       |
  512|  5.24M|    return context + 1;
  513|  5.24M|}

us_loop_free:
   36|  6.03k|void us_loop_free(struct us_loop_t *loop) {
   37|  6.03k|    us_internal_loop_data_free(loop);
   38|  6.03k|    close(loop->fd);
   39|  6.03k|    free(loop);
   40|  6.03k|}
us_create_poll:
   43|  2.15M|struct us_poll_t *us_create_poll(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
   44|  2.15M|    if (!fallthrough) {
  ------------------
  |  Branch (44:9): [True: 2.13M, False: 18.1k]
  ------------------
   45|  2.13M|        loop->num_polls++;
   46|  2.13M|    }
   47|  2.15M|    return malloc(sizeof(struct us_poll_t) + ext_size);
   48|  2.15M|}
us_poll_free:
   51|  2.15M|void us_poll_free(struct us_poll_t *p, struct us_loop_t *loop) {
   52|  2.15M|    loop->num_polls--;
   53|  2.15M|    free(p);
   54|  2.15M|}
us_poll_ext:
   56|  32.3k|void *us_poll_ext(struct us_poll_t *p) {
   57|  32.3k|    return p + 1;
   58|  32.3k|}
us_poll_init:
   61|  2.15M|void us_poll_init(struct us_poll_t *p, LIBUS_SOCKET_DESCRIPTOR fd, int poll_type) {
   62|  2.15M|    p->state.fd = fd;
   63|  2.15M|    p->state.poll_type = poll_type;
   64|  2.15M|}
us_poll_events:
   66|  11.2M|int us_poll_events(struct us_poll_t *p) {
   67|  11.2M|    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|  11.2M|#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|  11.2M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (67:13): [True: 11.1M, False: 37.1k]
  |  Branch (67:89): [True: 821k, False: 10.4M]
  ------------------
   68|  11.2M|}
us_poll_fd:
   70|  10.1M|LIBUS_SOCKET_DESCRIPTOR us_poll_fd(struct us_poll_t *p) {
   71|  10.1M|    return p->state.fd;
   72|  10.1M|}
us_internal_poll_type:
   75|  10.8M|int us_internal_poll_type(struct us_poll_t *p) {
   76|  10.8M|    return p->state.poll_type & 3;
   77|  10.8M|}
us_internal_poll_set_type:
   80|   280k|void us_internal_poll_set_type(struct us_poll_t *p, int poll_type) {
   81|   280k|    p->state.poll_type = poll_type | (p->state.poll_type & 12);
   82|   280k|}
us_timer_ext:
   85|  1.14M|void *us_timer_ext(struct us_timer_t *timer) {
   86|  1.14M|    return ((struct us_internal_callback_t *) timer) + 1;
   87|  1.14M|}
us_create_loop:
   96|  6.03k|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.03k|    struct us_loop_t *loop = (struct us_loop_t *) malloc(sizeof(struct us_loop_t) + ext_size);
   98|  6.03k|    loop->num_polls = 0;
   99|       |    /* These could be accessed if we close a poll before starting the loop */
  100|  6.03k|    loop->num_ready_polls = 0;
  101|  6.03k|    loop->current_ready_poll = 0;
  102|       |
  103|  6.03k|#ifdef LIBUS_USE_EPOLL
  104|  6.03k|    loop->fd = epoll_create1(EPOLL_CLOEXEC);
  105|       |#else
  106|       |    loop->fd = kqueue();
  107|       |#endif
  108|       |
  109|  6.03k|    us_internal_loop_data_init(loop, wakeup_cb, pre_cb, post_cb);
  110|  6.03k|    return loop;
  111|  6.03k|}
us_loop_run:
  113|  6.03k|void us_loop_run(struct us_loop_t *loop) {
  114|  6.03k|    us_loop_integrate(loop);
  115|       |
  116|       |    /* While we have non-fallthrough polls we shouldn't fall through */
  117|  1.45M|    while (loop->num_polls) {
  ------------------
  |  Branch (117:12): [True: 1.45M, False: 6.03k]
  ------------------
  118|       |        /* Emit pre callback */
  119|  1.45M|        us_internal_loop_pre(loop);
  120|       |
  121|       |        /* Fetch ready polls */
  122|  1.45M|#ifdef LIBUS_USE_EPOLL
  123|  1.45M|        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|  8.32M|        for (loop->current_ready_poll = 0; loop->current_ready_poll < loop->num_ready_polls; loop->current_ready_poll++) {
  ------------------
  |  Branch (129:44): [True: 6.87M, False: 1.45M]
  ------------------
  130|  6.87M|            struct us_poll_t *poll = GET_READY_POLL(loop, loop->current_ready_poll);
  ------------------
  |  |   28|  6.87M|#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|  6.87M|            if (poll) {
  ------------------
  |  Branch (132:17): [True: 6.87M, False: 0]
  ------------------
  133|  6.87M|#ifdef LIBUS_USE_EPOLL
  134|  6.87M|                int events = loop->ready_polls[loop->current_ready_poll].events;
  135|  6.87M|                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|  6.87M|                events &= us_poll_events(poll);
  146|  6.87M|                if (events || error) {
  ------------------
  |  Branch (146:21): [True: 5.01M, False: 1.85M]
  |  Branch (146:31): [True: 1.85M, False: 0]
  ------------------
  147|  6.87M|                    us_internal_dispatch_ready_poll(poll, error, events);
  148|  6.87M|                }
  149|  6.87M|            }
  150|  6.87M|        }
  151|       |        /* Emit post callback */
  152|  1.45M|        us_internal_loop_post(loop);
  153|  1.45M|    }
  154|  6.03k|}
us_internal_loop_update_pending_ready_polls:
  156|  2.15M|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|  2.15M|#ifdef LIBUS_USE_EPOLL
  158|       |    /* Epoll only has one ready poll per poll */
  159|  2.15M|    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|  4.30M|    for (int i = loop->current_ready_poll; i < loop->num_ready_polls && num_entries_possibly_remaining; i++) {
  ------------------
  |  Branch (168:44): [True: 4.25M, False: 47.0k]
  |  Branch (168:73): [True: 2.14M, False: 2.10M]
  ------------------
  169|  2.14M|        if (GET_READY_POLL(loop, i) == old_poll) {
  ------------------
  |  |   28|  2.14M|#define GET_READY_POLL(loop, index) (struct us_poll_t *) loop->ready_polls[index].data.ptr
  ------------------
  |  Branch (169:13): [True: 2.12M, False: 20.7k]
  ------------------
  170|       |
  171|       |            // if new events does not contain the ready events of this poll then remove (no we filter that out later on)
  172|  2.12M|            SET_READY_POLL(loop, i, new_poll);
  ------------------
  |  |   29|  2.12M|#define SET_READY_POLL(loop, index, poll) loop->ready_polls[index].data.ptr = poll
  ------------------
  173|       |
  174|  2.12M|            num_entries_possibly_remaining--;
  175|  2.12M|        }
  176|  2.14M|    }
  177|  2.15M|}
us_poll_resize:
  205|  33.5k|struct us_poll_t *us_poll_resize(struct us_poll_t *p, struct us_loop_t *loop, unsigned int ext_size) {
  206|  33.5k|    int events = us_poll_events(p);
  207|       |
  208|  33.5k|    struct us_poll_t *new_p = realloc(p, sizeof(struct us_poll_t) + ext_size);
  209|  33.5k|    if (p != new_p && events) {
  ------------------
  |  Branch (209:9): [True: 0, False: 33.5k]
  |  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|  33.5k|    return new_p;
  224|  33.5k|}
us_poll_start:
  226|  2.15M|void us_poll_start(struct us_poll_t *p, struct us_loop_t *loop, int events) {
  227|  2.15M|    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|  2.15M|#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|  2.15M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (227:54): [True: 2.15M, False: 2.76k]
  |  Branch (227:118): [True: 2.76k, False: 2.15M]
  ------------------
  228|       |
  229|  2.15M|#ifdef LIBUS_USE_EPOLL
  230|  2.15M|    struct epoll_event event;
  231|  2.15M|    event.events = events;
  232|  2.15M|    event.data.ptr = p;
  233|  2.15M|    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|  2.15M|}
us_poll_change:
  239|   735k|void us_poll_change(struct us_poll_t *p, struct us_loop_t *loop, int events) {
  240|   735k|    int old_events = us_poll_events(p);
  241|   735k|    if (old_events != events) {
  ------------------
  |  Branch (241:9): [True: 622k, False: 112k]
  ------------------
  242|       |
  243|   622k|        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|   622k|#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|   622k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (243:58): [True: 593k, False: 28.8k]
  |  Branch (243:122): [True: 313k, False: 308k]
  ------------------
  244|       |
  245|   622k|#ifdef LIBUS_USE_EPOLL
  246|   622k|        struct epoll_event event;
  247|   622k|        event.events = events;
  248|   622k|        event.data.ptr = p;
  249|   622k|        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|   622k|    }
  256|   735k|}
us_poll_stop:
  258|  2.15M|void us_poll_stop(struct us_poll_t *p, struct us_loop_t *loop) {
  259|  2.15M|    int old_events = us_poll_events(p);
  260|  2.15M|    int new_events = 0;
  261|  2.15M|#ifdef LIBUS_USE_EPOLL
  262|  2.15M|    struct epoll_event event;
  263|  2.15M|    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|  2.15M|    us_internal_loop_update_pending_ready_polls(loop, p, 0, old_events, new_events);
  272|  2.15M|}
us_internal_accept_poll_event:
  274|  3.48M|unsigned int us_internal_accept_poll_event(struct us_poll_t *p) {
  275|  3.48M|#ifdef LIBUS_USE_EPOLL
  276|  3.48M|    int fd = us_poll_fd(p);
  277|  3.48M|    uint64_t buf;
  278|  3.48M|    int read_length = read(fd, &buf, 8);
  279|  3.48M|    (void)read_length;
  280|  3.48M|    return buf;
  281|       |#else
  282|       |    /* Kqueue has no underlying FD for timers or user events */
  283|       |    return 0;
  284|       |#endif
  285|  3.48M|}
us_create_timer:
  289|  12.0k|struct us_timer_t *us_create_timer(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
  290|  12.0k|    struct us_poll_t *p = us_create_poll(loop, fallthrough, sizeof(struct us_internal_callback_t) + ext_size);
  291|  12.0k|    int timerfd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC);
  292|  12.0k|    if (timerfd == -1) {
  ------------------
  |  Branch (292:9): [True: 0, False: 12.0k]
  ------------------
  293|      0|      return NULL;
  294|      0|    }
  295|  12.0k|    us_poll_init(p, timerfd, POLL_TYPE_CALLBACK);
  296|       |
  297|  12.0k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  298|  12.0k|    cb->loop = loop;
  299|  12.0k|    cb->cb_expects_the_loop = 0;
  300|  12.0k|    cb->leave_poll_ready = 0;
  301|       |
  302|  12.0k|    return (struct us_timer_t *) cb;
  303|  12.0k|}
us_timer_close:
  325|  12.0k|void us_timer_close(struct us_timer_t *timer) {
  326|  12.0k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) timer;
  327|       |
  328|  12.0k|    us_poll_stop(&cb->p, cb->loop);
  329|  12.0k|    close(us_poll_fd(&cb->p));
  330|       |
  331|       |    /* (regular) sockets are the only polls which are not freed immediately */
  332|  12.0k|    us_poll_free((struct us_poll_t *) timer, cb->loop);
  333|  12.0k|}
us_timer_set:
  335|  12.0k|void us_timer_set(struct us_timer_t *t, void (*cb)(struct us_timer_t *t), int ms, int repeat_ms) {
  336|  12.0k|    struct us_internal_callback_t *internal_cb = (struct us_internal_callback_t *) t;
  337|       |
  338|  12.0k|    internal_cb->cb = (void (*)(struct us_internal_callback_t *)) cb;
  339|       |
  340|  12.0k|    struct itimerspec timer_spec = {
  341|  12.0k|        {repeat_ms / 1000, (long) (repeat_ms % 1000) * (long) 1000000},
  342|  12.0k|        {ms / 1000, (long) (ms % 1000) * (long) 1000000}
  343|  12.0k|    };
  344|       |
  345|  12.0k|    timerfd_settime(us_poll_fd((struct us_poll_t *) t), 0, &timer_spec, NULL);
  346|  12.0k|    us_poll_start((struct us_poll_t *) t, internal_cb->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  12.0k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  347|  12.0k|}
us_internal_create_async:
  374|  6.03k|struct us_internal_async *us_internal_create_async(struct us_loop_t *loop, int fallthrough, unsigned int ext_size) {
  375|  6.03k|    struct us_poll_t *p = us_create_poll(loop, fallthrough, sizeof(struct us_internal_callback_t) + ext_size);
  376|  6.03k|    us_poll_init(p, eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC), POLL_TYPE_CALLBACK);
  377|       |
  378|  6.03k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  379|  6.03k|    cb->loop = loop;
  380|  6.03k|    cb->cb_expects_the_loop = 1;
  381|  6.03k|    cb->leave_poll_ready = 0;
  382|       |
  383|  6.03k|    return (struct us_internal_async *) cb;
  384|  6.03k|}
us_internal_async_close:
  387|  6.03k|void us_internal_async_close(struct us_internal_async *a) {
  388|  6.03k|    struct us_internal_callback_t *cb = (struct us_internal_callback_t *) a;
  389|       |
  390|  6.03k|    us_poll_stop(&cb->p, cb->loop);
  391|  6.03k|    close(us_poll_fd(&cb->p));
  392|       |
  393|       |    /* (regular) sockets are the only polls which are not freed immediately */
  394|  6.03k|    us_poll_free((struct us_poll_t *) a, cb->loop);
  395|  6.03k|}
us_internal_async_set:
  397|  6.03k|void us_internal_async_set(struct us_internal_async *a, void (*cb)(struct us_internal_async *)) {
  398|  6.03k|    struct us_internal_callback_t *internal_cb = (struct us_internal_callback_t *) a;
  399|       |
  400|  6.03k|    internal_cb->cb = (void (*)(struct us_internal_callback_t *)) cb;
  401|       |
  402|  6.03k|    us_poll_start((struct us_poll_t *) a, internal_cb->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  6.03k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  403|  6.03k|}
us_internal_async_wakeup:
  405|  6.94k|void us_internal_async_wakeup(struct us_internal_async *a) {
  406|  6.94k|    uint64_t one = 1;
  407|  6.94k|    int written = write(us_poll_fd((struct us_poll_t *) a), &one, 8);
  408|  6.94k|    (void)written;
  409|  6.94k|}

us_internal_loop_data_init:
   26|  6.03k|    void (*pre_cb)(struct us_loop_t *loop), void (*post_cb)(struct us_loop_t *loop)) {
   27|  6.03k|    loop->data.sweep_timer = us_create_timer(loop, 1, 0);
   28|  6.03k|    loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   22|  6.03k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
                  loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   26|  6.03k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
   29|  6.03k|    loop->data.ssl_data = 0;
   30|  6.03k|    loop->data.head = 0;
   31|  6.03k|    loop->data.iterator = 0;
   32|  6.03k|    loop->data.closed_head = 0;
   33|  6.03k|    loop->data.low_prio_head = 0;
   34|  6.03k|    loop->data.low_prio_budget = 0;
   35|       |
   36|  6.03k|    loop->data.pre_cb = pre_cb;
   37|  6.03k|    loop->data.post_cb = post_cb;
   38|  6.03k|    loop->data.iteration_nr = 0;
   39|       |
   40|  6.03k|    loop->data.wakeup_async = us_internal_create_async(loop, 1, 0);
   41|  6.03k|    us_internal_async_set(loop->data.wakeup_async, (void (*)(struct us_internal_async *)) wakeup_cb);
   42|  6.03k|}
us_internal_loop_data_free:
   44|  6.03k|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.03k|    free(loop->data.recv_buf);
   50|       |
   51|  6.03k|    us_timer_close(loop->data.sweep_timer);
   52|  6.03k|    us_internal_async_close(loop->data.wakeup_async);
   53|  6.03k|}
us_wakeup_loop:
   55|  6.94k|void us_wakeup_loop(struct us_loop_t *loop) {
   56|  6.94k|    us_internal_async_wakeup(loop->data.wakeup_async);
   57|  6.94k|}
us_internal_loop_link:
   59|  24.1k|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|  24.1k|    context->next = loop->data.head;
   62|  24.1k|    context->prev = 0;
   63|  24.1k|    if (loop->data.head) {
  ------------------
  |  Branch (63:9): [True: 18.1k, False: 6.03k]
  ------------------
   64|  18.1k|        loop->data.head->prev = context;
   65|  18.1k|    }
   66|  24.1k|    loop->data.head = context;
   67|  24.1k|}
us_internal_loop_unlink:
   70|  24.1k|void us_internal_loop_unlink(struct us_loop_t *loop, struct us_socket_context_t *context) {
   71|  24.1k|    if (loop->data.head == context) {
  ------------------
  |  Branch (71:9): [True: 12.0k, False: 12.0k]
  ------------------
   72|  12.0k|        loop->data.head = context->next;
   73|  12.0k|        if (loop->data.head) {
  ------------------
  |  Branch (73:13): [True: 6.03k, False: 6.03k]
  ------------------
   74|  6.03k|            loop->data.head->prev = 0;
   75|  6.03k|        }
   76|  12.0k|    } else {
   77|  12.0k|        context->prev->next = context->next;
   78|  12.0k|        if (context->next) {
  ------------------
  |  Branch (78:13): [True: 0, False: 12.0k]
  ------------------
   79|      0|            context->next->prev = context->prev;
   80|      0|        }
   81|  12.0k|    }
   82|  24.1k|}
us_internal_timer_sweep:
   85|  1.20M|void us_internal_timer_sweep(struct us_loop_t *loop) {
   86|  1.20M|    struct us_internal_loop_data_t *loop_data = &loop->data;
   87|       |    /* For all socket contexts in this loop */
   88|  6.00M|    for (loop_data->iterator = loop_data->head; loop_data->iterator; loop_data->iterator = loop_data->iterator->next) {
  ------------------
  |  Branch (88:49): [True: 4.80M, False: 1.20M]
  ------------------
   89|       |
   90|  4.80M|        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|  4.80M|        context->global_tick++;
   94|  4.80M|        unsigned char short_ticks = context->timestamp = context->global_tick % 240;
   95|  4.80M|        unsigned char long_ticks = context->long_timestamp = (context->global_tick / 15) % 240;
   96|       |
   97|       |        /* Begin at head */
   98|  4.80M|        struct us_socket_t *s = context->head_sockets;
   99|  4.81M|        while (s) {
  ------------------
  |  Branch (99:16): [True: 153k, False: 4.66M]
  ------------------
  100|       |            /* Seek until end or timeout found (tightest loop) */
  101|   361k|            while (1) {
  ------------------
  |  Branch (101:20): [Folded - Ignored]
  ------------------
  102|       |                /* We only read from 1 random cache line here */
  103|   361k|                if (short_ticks == s->timeout || long_ticks == s->long_timeout) {
  ------------------
  |  Branch (103:21): [True: 8.55k, False: 353k]
  |  Branch (103:50): [True: 0, False: 353k]
  ------------------
  104|  8.55k|                    break;
  105|  8.55k|                }
  106|       |
  107|       |                /* Did we reach the end without a find? */
  108|   353k|                if ((s = s->next) == 0) {
  ------------------
  |  Branch (108:21): [True: 144k, False: 208k]
  ------------------
  109|   144k|                    goto next_context;
  110|   144k|                }
  111|   353k|            }
  112|       |
  113|       |            /* Here we have a timeout to emit (slow path) */
  114|  8.55k|            context->iterator = s;
  115|       |
  116|  8.55k|            if (short_ticks == s->timeout) {
  ------------------
  |  Branch (116:17): [True: 8.55k, False: 0]
  ------------------
  117|  8.55k|                s->timeout = 255;
  118|  8.55k|                context->on_socket_timeout(s);
  119|  8.55k|            }
  120|       |
  121|  8.55k|            if (context->iterator == s && long_ticks == s->long_timeout) {
  ------------------
  |  Branch (121:17): [True: 2.29k, False: 6.26k]
  |  Branch (121:43): [True: 0, False: 2.29k]
  ------------------
  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|  8.55k|            if (s == context->iterator) {
  ------------------
  |  Branch (127:17): [True: 2.29k, False: 6.26k]
  ------------------
  128|  2.29k|                s = s->next;
  129|  6.26k|            } else {
  130|       |                /* The iterator was changed by event handler */
  131|  6.26k|                s = context->iterator;
  132|  6.26k|            }
  133|  8.55k|        }
  134|       |        /* We always store a 0 to context->iterator here since we are no longer iterating this context */
  135|  4.80M|        next_context:
  136|  4.80M|        context->iterator = 0;
  137|  4.80M|    }
  138|  1.20M|}
us_internal_handle_low_priority_sockets:
  145|  1.45M|void us_internal_handle_low_priority_sockets(struct us_loop_t *loop) {
  146|  1.45M|    struct us_internal_loop_data_t *loop_data = &loop->data;
  147|  1.45M|    struct us_socket_t *s;
  148|       |
  149|  1.45M|    loop_data->low_prio_budget = MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION;
  150|       |
  151|  1.45M|    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: 1.45M]
  |  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|  1.45M|}
us_internal_free_closed_sockets:
  165|  1.45M|void us_internal_free_closed_sockets(struct us_loop_t *loop) {
  166|       |    /* Free all closed sockets (maybe it is better to reverse order?) */
  167|  1.45M|    if (loop->data.closed_head) {
  ------------------
  |  Branch (167:9): [True: 195k, False: 1.25M]
  ------------------
  168|  2.33M|        for (struct us_socket_t *s = loop->data.closed_head; s; ) {
  ------------------
  |  Branch (168:62): [True: 2.13M, False: 195k]
  ------------------
  169|  2.13M|            struct us_socket_t *next = s->next;
  170|  2.13M|            us_poll_free((struct us_poll_t *) s, loop);
  171|  2.13M|            s = next;
  172|  2.13M|        }
  173|   195k|        loop->data.closed_head = 0;
  174|   195k|    }
  175|  1.45M|}
sweep_timer_cb:
  177|  1.20M|void sweep_timer_cb(struct us_internal_callback_t *cb) {
  178|  1.20M|    us_internal_timer_sweep(cb->loop);
  179|  1.20M|}
us_loop_iteration_number:
  181|  6.03k|long long us_loop_iteration_number(struct us_loop_t *loop) {
  182|  6.03k|    return loop->data.iteration_nr;
  183|  6.03k|}
us_internal_loop_pre:
  186|  1.45M|void us_internal_loop_pre(struct us_loop_t *loop) {
  187|  1.45M|    loop->data.iteration_nr++;
  188|  1.45M|    us_internal_handle_low_priority_sockets(loop);
  189|  1.45M|    loop->data.pre_cb(loop);
  190|  1.45M|}
us_internal_loop_post:
  192|  1.45M|void us_internal_loop_post(struct us_loop_t *loop) {
  193|  1.45M|    us_internal_free_closed_sockets(loop);
  194|  1.45M|    loop->data.post_cb(loop);
  195|  1.45M|}
us_internal_dispatch_ready_poll:
  197|  6.87M|void us_internal_dispatch_ready_poll(struct us_poll_t *p, int error, int events) {
  198|  6.87M|    switch (us_internal_poll_type(p)) {
  ------------------
  |  Branch (198:13): [True: 0, False: 6.87M]
  ------------------
  199|  3.48M|    case POLL_TYPE_CALLBACK: {
  ------------------
  |  Branch (199:5): [True: 3.48M, False: 3.39M]
  ------------------
  200|  3.48M|            struct us_internal_callback_t *cb = (struct us_internal_callback_t *) p;
  201|       |            /* Timers, asyncs should accept (read), while UDP sockets should obviously not */
  202|  3.48M|            if (!cb->leave_poll_ready) {
  ------------------
  |  Branch (202:17): [True: 3.48M, False: 0]
  ------------------
  203|       |                /* Let's just have this macro to silence the CodeQL alert regarding empty function when using libuv */
  204|  3.48M|    #ifndef LIBUS_USE_LIBUV
  205|  3.48M|                us_internal_accept_poll_event(p);
  206|  3.48M|    #endif
  207|  3.48M|            }
  208|  3.48M|            cb->cb(cb->cb_expects_the_loop ? (struct us_internal_callback_t *) cb->loop : (struct us_internal_callback_t *) &cb->p);
  ------------------
  |  Branch (208:20): [True: 1.13M, False: 2.34M]
  ------------------
  209|  3.48M|        }
  210|  3.48M|        break;
  211|  1.11M|    case POLL_TYPE_SEMI_SOCKET: {
  ------------------
  |  Branch (211:5): [True: 1.11M, False: 5.75M]
  ------------------
  212|       |            /* Both connect and listen sockets are semi-sockets
  213|       |             * but they poll for different events */
  214|  1.11M|            if (us_poll_events(p) == LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|  1.11M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (214:17): [True: 2.72k, False: 1.11M]
  ------------------
  215|  2.72k|                struct us_socket_t *s = (struct us_socket_t *) p;
  216|       |
  217|       |                /* It is perfectly possible to come here with an error */
  218|  2.72k|                if (error) {
  ------------------
  |  Branch (218:21): [True: 2.44k, False: 281]
  ------------------
  219|       |                    /* Emit error, close without emitting on_close */
  220|  2.44k|                    s->context->on_connect_error(s, 0);
  221|  2.44k|                    us_socket_close_connecting(0, s);
  222|  2.44k|                } else {
  223|       |                    /* All sockets poll for readable */
  224|    281|                    us_poll_change(p, s->context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|    281|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  225|       |
  226|       |                    /* We always use nodelay */
  227|    281|                    bsd_socket_nodelay(us_poll_fd(p), 1);
  228|       |
  229|       |                    /* We are now a proper socket */
  230|    281|                    us_internal_poll_set_type(p, POLL_TYPE_SOCKET);
  231|       |
  232|       |                    /* If we used a connection timeout we have to reset it here */
  233|    281|                    us_socket_timeout(0, s, 0);
  234|       |
  235|    281|                    s->context->on_open(s, 1, 0, 0);
  236|    281|                }
  237|  1.11M|            } else {
  238|  1.11M|                struct us_listen_socket_t *listen_socket = (struct us_listen_socket_t *) p;
  239|  1.11M|                struct bsd_addr_t addr;
  240|       |
  241|  1.11M|                LIBUS_SOCKET_DESCRIPTOR client_fd = bsd_accept_socket(us_poll_fd(p), &addr);
  ------------------
  |  |   38|  1.11M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  242|  1.11M|                if (client_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  1.11M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (242:21): [True: 958k, False: 157k]
  ------------------
  243|       |                    /* Todo: start timer here */
  244|       |
  245|   958k|                } else {
  246|       |
  247|       |                    /* Todo: stop timer if any */
  248|       |
  249|  2.12M|                    do {
  250|  2.12M|                        struct us_poll_t *accepted_p = us_create_poll(us_socket_context(0, &listen_socket->s)->loop, 0, sizeof(struct us_socket_t) - sizeof(struct us_poll_t) + listen_socket->socket_ext_size);
  251|  2.12M|                        us_poll_init(accepted_p, client_fd, POLL_TYPE_SOCKET);
  252|  2.12M|                        us_poll_start(accepted_p, listen_socket->s.context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  2.12M|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  253|       |
  254|  2.12M|                        struct us_socket_t *s = (struct us_socket_t *) accepted_p;
  255|       |
  256|  2.12M|                        s->context = listen_socket->s.context;
  257|  2.12M|                        s->timeout = 255;
  258|  2.12M|                        s->long_timeout = 255;
  259|  2.12M|                        s->low_prio_state = 0;
  260|       |
  261|       |                        /* We always use nodelay */
  262|  2.12M|                        bsd_socket_nodelay(client_fd, 1);
  263|       |
  264|  2.12M|                        us_internal_socket_context_link_socket(listen_socket->s.context, s);
  265|       |
  266|  2.12M|                        listen_socket->s.context->on_open(s, 0, bsd_addr_get_ip(&addr), bsd_addr_get_ip_length(&addr));
  267|       |
  268|       |                        /* Exit accept loop if listen socket was closed in on_open handler */
  269|  2.12M|                        if (us_socket_is_closed(0, &listen_socket->s)) {
  ------------------
  |  Branch (269:29): [True: 0, False: 2.12M]
  ------------------
  270|      0|                            break;
  271|      0|                        }
  272|       |
  273|  2.12M|                    } while ((client_fd = bsd_accept_socket(us_poll_fd(p), &addr)) != LIBUS_SOCKET_ERROR);
  ------------------
  |  |   44|  2.12M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (273:30): [True: 1.97M, False: 157k]
  ------------------
  274|   157k|                }
  275|  1.11M|            }
  276|  1.11M|        }
  277|      0|        break;
  278|  1.33k|    case POLL_TYPE_SOCKET_SHUT_DOWN:
  ------------------
  |  Branch (278:5): [True: 1.33k, False: 6.87M]
  ------------------
  279|  2.27M|    case POLL_TYPE_SOCKET: {
  ------------------
  |  Branch (279:5): [True: 2.27M, False: 4.60M]
  ------------------
  280|       |            /* We should only use s, no p after this point */
  281|  2.27M|            struct us_socket_t *s = (struct us_socket_t *) p;
  282|       |
  283|       |            /* Such as epollerr epollhup */
  284|  2.27M|            if (error) {
  ------------------
  |  Branch (284:17): [True: 1.80M, False: 467k]
  ------------------
  285|       |                /* Todo: decide what code we give here */
  286|  1.80M|                s = us_socket_close(0, s, 0, NULL);
  287|  1.80M|                return;
  288|  1.80M|            }
  289|       |
  290|   467k|            if (events & LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|   467k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (290:17): [True: 12.3k, False: 455k]
  ------------------
  291|       |                /* Note: if we failed a write as a socket of one loop then adopted
  292|       |                 * to another loop, this will be wrong. Absurd case though */
  293|  12.3k|                s->context->loop->data.last_write_failed = 0;
  294|       |
  295|  12.3k|                s = s->context->on_writable(s);
  296|       |
  297|  12.3k|                if (us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (297:21): [True: 194, False: 12.1k]
  ------------------
  298|    194|                    return;
  299|    194|                }
  300|       |
  301|       |                /* If we have no failed write or if we shut down, then stop polling for more writable */
  302|  12.1k|                if (!s->context->loop->data.last_write_failed || us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (302:21): [True: 2.61k, False: 9.57k]
  |  Branch (302:66): [True: 0, False: 9.57k]
  ------------------
  303|  2.61k|                    us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  2.61k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  304|  2.61k|                }
  305|  12.1k|            }
  306|       |
  307|   467k|            if (events & LIBUS_SOCKET_READABLE) {
  ------------------
  |  |   27|   467k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  |  Branch (307:17): [True: 461k, False: 6.40k]
  ------------------
  308|       |                /* Contexts may prioritize down sockets that are currently readable, e.g. when SSL handshake has to be done.
  309|       |                 * SSL handshakes are CPU intensive, so we limit the number of handshakes per loop iteration, and move the rest
  310|       |                 * to the low-priority queue */
  311|   461k|                if (s->context->is_low_prio(s)) {
  ------------------
  |  Branch (311:21): [True: 0, False: 461k]
  ------------------
  312|      0|                    if (s->low_prio_state == 2) {
  ------------------
  |  Branch (312:25): [True: 0, False: 0]
  ------------------
  313|      0|                        s->low_prio_state = 0; /* Socket has been delayed and now it's time to process incoming data for one iteration */
  314|      0|                    } else if (s->context->loop->data.low_prio_budget > 0) {
  ------------------
  |  Branch (314:32): [True: 0, False: 0]
  ------------------
  315|      0|                        s->context->loop->data.low_prio_budget--; /* Still having budget for this iteration - do normal processing */
  316|      0|                    } else {
  317|      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
  ------------------
  318|      0|                        us_internal_socket_context_unlink_socket(s->context, s);
  319|       |
  320|       |                        /* Link this socket to the low-priority queue - we use a LIFO queue, to prioritize newer clients that are
  321|       |                         * maybe not already timeouted - sounds unfair, but works better in real-life with smaller client-timeouts
  322|       |                         * under high load */
  323|      0|                        s->prev = 0;
  324|      0|                        s->next = s->context->loop->data.low_prio_head;
  325|      0|                        if (s->next) s->next->prev = s;
  ------------------
  |  Branch (325:29): [True: 0, False: 0]
  ------------------
  326|      0|                        s->context->loop->data.low_prio_head = s;
  327|       |
  328|      0|                        s->low_prio_state = 1;
  329|       |
  330|      0|                        break;
  331|      0|                    }
  332|      0|                }
  333|       |
  334|   461k|                int length = bsd_recv(us_poll_fd(&s->p), s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, LIBUS_RECV_BUFFER_LENGTH, 0);
  ------------------
  |  |   26|   461k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
                              int length = bsd_recv(us_poll_fd(&s->p), s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, LIBUS_RECV_BUFFER_LENGTH, 0);
  ------------------
  |  |   22|   461k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  335|   461k|                if (length > 0) {
  ------------------
  |  Branch (335:21): [True: 430k, False: 30.9k]
  ------------------
  336|   430k|                    s = s->context->on_data(s, s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, length);
  ------------------
  |  |   26|   430k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
  337|   430k|                } else if (!length) {
  ------------------
  |  Branch (337:28): [True: 29.0k, False: 1.83k]
  ------------------
  338|  29.0k|                    if (us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (338:25): [True: 198, False: 28.8k]
  ------------------
  339|       |                        /* We got FIN back after sending it */
  340|       |                        /* Todo: We should give "CLEAN SHUTDOWN" as reason here */
  341|    198|                        s = us_socket_close(0, s, 0, NULL);
  342|  28.8k|                    } else {
  343|       |                        /* We got FIN, so stop polling for readable */
  344|  28.8k|                        us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  28.8k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  345|  28.8k|                        s = s->context->on_end(s);
  346|  28.8k|                    }
  347|  29.0k|                } else if (length == LIBUS_SOCKET_ERROR && !bsd_would_block()) {
  ------------------
  |  |   44|  3.66k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (347:28): [True: 1.83k, False: 0]
  |  Branch (347:60): [True: 0, False: 1.83k]
  ------------------
  348|       |                    /* Todo: decide also here what kind of reason we should give */
  349|      0|                    s = us_socket_close(0, s, 0, NULL);
  350|      0|                }
  351|   461k|            }
  352|   467k|        }
  353|   467k|        break;
  354|  6.87M|    }
  355|  6.87M|}
us_loop_integrate:
  358|  6.03k|void us_loop_integrate(struct us_loop_t *loop) {
  359|  6.03k|    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.03k|#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.03k|#define LIBUS_TIMEOUT_GRANULARITY 4
  ------------------
  360|  6.03k|}
us_loop_ext:
  362|  6.86M|void *us_loop_ext(struct us_loop_t *loop) {
  363|  6.86M|    return loop + 1;
  364|  6.86M|}

us_socket_local_port:
   28|  2.76k|int us_socket_local_port(int ssl, struct us_socket_t *s) {
   29|  2.76k|    struct bsd_addr_t addr;
   30|  2.76k|    if (bsd_local_addr(us_poll_fd(&s->p), &addr)) {
  ------------------
  |  Branch (30:9): [True: 2.76k, False: 0]
  ------------------
   31|  2.76k|        return -1;
   32|  2.76k|    } else {
   33|      0|        return bsd_addr_get_port(&addr);
   34|      0|    }
   35|  2.76k|}
us_socket_shutdown_read:
   37|    613|void us_socket_shutdown_read(int ssl, struct us_socket_t *s) {
   38|       |    /* This syscall is idempotent so no extra check is needed */
   39|    613|    bsd_shutdown_socket_read(us_poll_fd((struct us_poll_t *) s));
   40|    613|}
us_socket_remote_address:
   42|  32.3k|void us_socket_remote_address(int ssl, struct us_socket_t *s, char *buf, int *length) {
   43|  32.3k|    struct bsd_addr_t addr;
   44|  32.3k|    if (bsd_remote_addr(us_poll_fd(&s->p), &addr) || *length < bsd_addr_get_ip_length(&addr)) {
  ------------------
  |  Branch (44:9): [True: 0, False: 32.3k]
  |  Branch (44:54): [True: 0, False: 32.3k]
  ------------------
   45|      0|        *length = 0;
   46|  32.3k|    } else {
   47|  32.3k|        *length = bsd_addr_get_ip_length(&addr);
   48|  32.3k|        memcpy(buf, bsd_addr_get_ip(&addr), *length);
   49|  32.3k|    }
   50|  32.3k|}
us_socket_context:
   52|  9.89M|struct us_socket_context_t *us_socket_context(int ssl, struct us_socket_t *s) {
   53|  9.89M|    return s->context;
   54|  9.89M|}
us_socket_timeout:
   56|  2.38M|void us_socket_timeout(int ssl, struct us_socket_t *s, unsigned int seconds) {
   57|  2.38M|    if (seconds) {
  ------------------
  |  Branch (57:9): [True: 2.33M, False: 51.6k]
  ------------------
   58|  2.33M|        s->timeout = ((unsigned int)s->context->timestamp + ((seconds + 3) >> 2)) % 240;
   59|  2.33M|    } else {
   60|  51.6k|        s->timeout = 255;
   61|  51.6k|    }
   62|  2.38M|}
us_socket_long_timeout:
   64|  33.5k|void us_socket_long_timeout(int ssl, struct us_socket_t *s, unsigned int minutes) {
   65|  33.5k|    if (minutes) {
  ------------------
  |  Branch (65:9): [True: 0, False: 33.5k]
  ------------------
   66|      0|        s->long_timeout = ((unsigned int)s->context->long_timestamp + minutes) % 240;
   67|  33.5k|    } else {
   68|  33.5k|        s->long_timeout = 255;
   69|  33.5k|    }
   70|  33.5k|}
us_socket_flush:
   72|    281|void us_socket_flush(int ssl, struct us_socket_t *s) {
   73|    281|    if (!us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (73:9): [True: 281, False: 0]
  ------------------
   74|    281|        bsd_socket_flush(us_poll_fd((struct us_poll_t *) s));
   75|    281|    }
   76|    281|}
us_socket_is_closed:
   78|  6.59M|int us_socket_is_closed(int ssl, struct us_socket_t *s) {
   79|  6.59M|    return s->prev == (struct us_socket_t *) s->context;
   80|  6.59M|}
us_socket_is_established:
   82|  2.76k|int us_socket_is_established(int ssl, struct us_socket_t *s) {
   83|       |    /* Everything that is not POLL_TYPE_SEMI_SOCKET is established */
   84|  2.76k|    return us_internal_poll_type((struct us_poll_t *) s) != POLL_TYPE_SEMI_SOCKET;
   85|  2.76k|}
us_socket_close_connecting:
   88|  2.44k|struct us_socket_t *us_socket_close_connecting(int ssl, struct us_socket_t *s) {
   89|  2.44k|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (89:9): [True: 2.44k, False: 0]
  ------------------
   90|  2.44k|        us_internal_socket_context_unlink_socket(s->context, s);
   91|  2.44k|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
   92|  2.44k|        bsd_close_socket(us_poll_fd((struct us_poll_t *) s));
   93|       |
   94|       |        /* Link this socket to the close-list and let it be deleted after this iteration */
   95|  2.44k|        s->next = s->context->loop->data.closed_head;
   96|  2.44k|        s->context->loop->data.closed_head = s;
   97|       |
   98|       |        /* Any socket with prev = context is marked as closed */
   99|  2.44k|        s->prev = (struct us_socket_t *) s->context;
  100|       |
  101|       |        //return s->context->on_close(s, code, reason);
  102|  2.44k|    }
  103|  2.44k|    return s;
  104|  2.44k|}
us_socket_close:
  107|  2.13M|struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, void *reason) {
  108|  2.13M|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (108:9): [True: 2.13M, False: 0]
  ------------------
  109|  2.13M|        if (s->low_prio_state == 1) {
  ------------------
  |  Branch (109:13): [True: 0, False: 2.13M]
  ------------------
  110|       |            /* Unlink this socket from the low-priority queue */
  111|      0|            if (!s->prev) s->context->loop->data.low_prio_head = s->next;
  ------------------
  |  Branch (111:17): [True: 0, False: 0]
  ------------------
  112|      0|            else s->prev->next = s->next;
  113|       |
  114|      0|            if (s->next) s->next->prev = s->prev;
  ------------------
  |  Branch (114:17): [True: 0, False: 0]
  ------------------
  115|       |
  116|      0|            s->prev = 0;
  117|      0|            s->next = 0;
  118|      0|            s->low_prio_state = 0;
  119|  2.13M|        } else {
  120|  2.13M|            us_internal_socket_context_unlink_socket(s->context, s);
  121|  2.13M|        }
  122|  2.13M|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
  123|  2.13M|        bsd_close_socket(us_poll_fd((struct us_poll_t *) s));
  124|       |
  125|       |        /* Link this socket to the close-list and let it be deleted after this iteration */
  126|  2.13M|        s->next = s->context->loop->data.closed_head;
  127|  2.13M|        s->context->loop->data.closed_head = s;
  128|       |
  129|       |        /* Any socket with prev = context is marked as closed */
  130|  2.13M|        s->prev = (struct us_socket_t *) s->context;
  131|       |
  132|  2.13M|        return s->context->on_close(s, code, reason);
  133|  2.13M|    }
  134|      0|    return s;
  135|  2.13M|}
us_socket_get_native_handle:
  139|  32.3k|void *us_socket_get_native_handle(int ssl, struct us_socket_t *s) {
  140|       |#ifndef LIBUS_NO_SSL
  141|       |    if (ssl) {
  142|       |        return us_internal_ssl_socket_get_native_handle((struct us_internal_ssl_socket_t *) s);
  143|       |    }
  144|       |#endif
  145|       |
  146|  32.3k|    return (void *) (uintptr_t) us_poll_fd((struct us_poll_t *) s);
  147|  32.3k|}
us_socket_write:
  164|   431k|int us_socket_write(int ssl, struct us_socket_t *s, const char *data, int length, int msg_more) {
  165|       |#ifndef LIBUS_NO_SSL
  166|       |    if (ssl) {
  167|       |        return us_internal_ssl_socket_write((struct us_internal_ssl_socket_t *) s, data, length, msg_more);
  168|       |    }
  169|       |#endif
  170|       |
  171|   431k|    if (us_socket_is_closed(ssl, s) || us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (171:9): [True: 0, False: 431k]
  |  Branch (171:40): [True: 0, False: 431k]
  ------------------
  172|      0|        return 0;
  173|      0|    }
  174|       |
  175|   431k|    int written = bsd_send(us_poll_fd(&s->p), data, length, msg_more);
  176|   431k|    if (written != length) {
  ------------------
  |  Branch (176:9): [True: 423k, False: 8.37k]
  ------------------
  177|   423k|        s->context->loop->data.last_write_failed = 1;
  178|   423k|        us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   27|   423k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                      us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|   423k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  179|   423k|    }
  180|       |
  181|   431k|    return written < 0 ? 0 : written;
  ------------------
  |  Branch (181:12): [True: 8.20k, False: 423k]
  ------------------
  182|   431k|}
us_socket_ext:
  184|  6.77M|void *us_socket_ext(int ssl, struct us_socket_t *s) {
  185|       |#ifndef LIBUS_NO_SSL
  186|       |    if (ssl) {
  187|       |        return us_internal_ssl_socket_ext((struct us_internal_ssl_socket_t *) s);
  188|       |    }
  189|       |#endif
  190|       |
  191|  6.77M|    return s + 1;
  192|  6.77M|}
us_socket_is_shut_down:
  194|  1.17M|int us_socket_is_shut_down(int ssl, struct us_socket_t *s) {
  195|       |#ifndef LIBUS_NO_SSL
  196|       |    if (ssl) {
  197|       |        return us_internal_ssl_socket_is_shut_down((struct us_internal_ssl_socket_t *) s);
  198|       |    }
  199|       |#endif
  200|       |
  201|  1.17M|    return us_internal_poll_type(&s->p) == POLL_TYPE_SOCKET_SHUT_DOWN;
  202|  1.17M|}
us_socket_shutdown:
  204|   280k|void us_socket_shutdown(int ssl, struct us_socket_t *s) {
  205|       |#ifndef LIBUS_NO_SSL
  206|       |    if (ssl) {
  207|       |        us_internal_ssl_socket_shutdown((struct us_internal_ssl_socket_t *) s);
  208|       |        return;
  209|       |    }
  210|       |#endif
  211|       |
  212|       |    /* Todo: should we emit on_close if calling shutdown on an already half-closed socket?
  213|       |     * We need more states in that case, we need to track RECEIVED_FIN
  214|       |     * so far, the app has to track this and call close as needed */
  215|   280k|    if (!us_socket_is_closed(ssl, s) && !us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (215:9): [True: 280k, False: 0]
  |  Branch (215:41): [True: 280k, False: 0]
  ------------------
  216|   280k|        us_internal_poll_set_type(&s->p, POLL_TYPE_SOCKET_SHUT_DOWN);
  217|   280k|        us_poll_change(&s->p, s->context->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|   280k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  218|   280k|        bsd_shutdown_socket(us_poll_fd((struct us_poll_t *) s));
  219|   280k|    }
  220|   280k|}

_Z4testv:
   11|  6.03k|void test() {
   12|       |	/* ws->getUserData returns one of these */
   13|  6.03k|    struct PerSocketData {
   14|       |        /* Fill with user data */
   15|  6.03k|    };
   16|       |
   17|  6.03k|    {
   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.03k|        auto app = uWS::App({
   21|       |            /* There are example certificates in uWebSockets.js repo */
   22|  6.03k|            .key_file_name = "../misc/key.pem",
   23|  6.03k|            .cert_file_name = "../misc/cert.pem",
   24|  6.03k|            .passphrase = "1234"
   25|  6.03k|        }).ws<PerSocketData>("/empty", {
   26|       |        /* Having no handlers here should not crash */
   27|  6.03k|        }).get("/*", [](auto *res, auto *req) {
   28|  6.03k|            if (req->getHeader("write").length()) {
   29|  6.03k|                res->writeStatus("200 OK")->writeHeader("write", "true")->write("Hello");
   30|  6.03k|                res->write(" world!");
   31|  6.03k|                res->end();
   32|  6.03k|            } else if (req->getQuery().length()) {
   33|  6.03k|                res->close();
   34|  6.03k|            } else {
   35|  6.03k|                res->end("Hello world!");
   36|  6.03k|            }
   37|  6.03k|        }).post("/*", [](auto *res, auto *req) {
   38|  6.03k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  6.03k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  6.03k|                });
   43|  6.03k|            });
   44|  6.03k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  6.03k|                if (isEnd) {
   46|  6.03k|                    res->cork([res, chunk]() {
   47|  6.03k|                        res->write("something ahead");
   48|  6.03k|                        res->end(chunk);
   49|  6.03k|                    });
   50|  6.03k|                }
   51|  6.03k|            });
   52|  6.03k|        }).any("/:candy/*", [](auto *res, auto *req) {
   53|  6.03k|            if (req->getParameter(0).length() == 0) {
   54|  6.03k|                free((void *) -1);
   55|  6.03k|            }
   56|       |            /* Some invalid queries */
   57|  6.03k|            req->getParameter(30000);
   58|  6.03k|            req->getParameter((unsigned short) -34234);
   59|  6.03k|            req->getHeader("yhello");
   60|  6.03k|            req->getQuery();
   61|  6.03k|            req->getQuery("assd");
   62|       |
   63|  6.03k|            res->end("done");
   64|  6.03k|        }).ws<PerSocketData>("/*", {
   65|       |            /* Settings */
   66|  6.03k|            .compression = uWS::SHARED_COMPRESSOR,
   67|  6.03k|            .maxPayloadLength = 16 * 1024,
   68|  6.03k|            .idleTimeout = 12,
   69|  6.03k|            .maxBackpressure = 1024,
   70|       |            /* Handlers */
   71|  6.03k|            .open = [](auto *ws) {
   72|       |                /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
   73|  6.03k|                ws->getNativeHandle();
   74|  6.03k|                ws->getRemoteAddressAsText();
   75|  6.03k|                us_poll_ext((struct us_poll_t *) ws);
   76|  6.03k|            },
   77|  6.03k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   78|  6.03k|                ws->send(message, opCode, true);
   79|  6.03k|            },
   80|  6.03k|            .drain = [](auto *ws) {
   81|       |                /* Check ws->getBufferedAmount() here */
   82|  6.03k|            },
   83|  6.03k|            .ping = [](auto *ws, std::string_view) {
   84|       |                /* We use this to trigger the async/wakeup feature */
   85|  6.03k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  6.03k|                });
   88|  6.03k|            },
   89|  6.03k|            .pong = [](auto *ws, std::string_view) {
   90|       |                /* Not implemented yet */
   91|  6.03k|            },
   92|  6.03k|            .close = [](auto *ws, int code, std::string_view message) {
   93|       |                /* You may access ws->getUserData() here */
   94|  6.03k|            }
   95|  6.03k|        }).listen(9001, [](auto *listenSocket) {
   96|  6.03k|            listen_socket = listenSocket;
   97|  6.03k|        });
   98|       |
   99|       |        /* Here we want to stress the connect feature, since nothing else stresses it */
  100|  6.03k|        struct us_loop_t *loop = (struct us_loop_t *) uWS::Loop::get();
  101|       |        /* This function is stupid */
  102|  6.03k|        us_loop_iteration_number(loop);
  103|  6.03k|        struct us_socket_context_t *client_context = us_create_socket_context(0, loop, 0, {});
  104|  6.03k|        us_socket_context_timestamp(0, client_context);
  105|  6.03k|        client = us_socket_context_connect(0, client_context, "hostname", 5000, "localhost", 0, 0);
  106|       |	    
  107|  6.03k|        if (client) {
  ------------------
  |  Branch (107:13): [True: 2.76k, False: 3.27k]
  ------------------
  108|  2.76k|            us_socket_is_established(0, client);
  109|  2.76k|            us_socket_local_port(0, client);
  110|  2.76k|        }
  111|       |
  112|  6.03k|        us_socket_context_on_connect_error(0, client_context, [](struct us_socket_t *s, int code) {
  113|  6.03k|            client = nullptr;
  114|  6.03k|            return s;
  115|  6.03k|        });
  116|       |
  117|  6.03k|        us_socket_context_on_open(0, client_context, [](struct us_socket_t *s, int is_client, char *ip, int ip_length) {
  118|  6.03k|            us_socket_flush(0, s);
  119|  6.03k|            return s;
  120|  6.03k|        });
  121|       |
  122|  6.03k|        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.03k|            us_socket_write(0, s, "asdadasdasdasdaddfgdfhdfgdfg", 28, false);
  125|  6.03k|            return s;
  126|  6.03k|        });
  127|       |
  128|  6.03k|        us_socket_context_on_data(0, client_context, [](struct us_socket_t *s, char *data, int length) {
  129|  6.03k|            return s;
  130|  6.03k|        });
  131|       |
  132|  6.03k|        us_socket_context_on_writable(0, client_context, [](struct us_socket_t *s) {
  133|       |            /* Let's defer a close here */
  134|  6.03k|            us_socket_shutdown_read(0, s);
  135|  6.03k|            return s;
  136|  6.03k|        });
  137|       |
  138|  6.03k|        us_socket_context_on_close(0, client_context, [](struct us_socket_t *s, int code, void *reason) {
  139|  6.03k|            client = NULL;
  140|  6.03k|            return s;
  141|  6.03k|        });
  142|       |
  143|       |        /* Trigger some context functions */
  144|  6.03k|        app.addServerName("servername", {});
  145|  6.03k|        app.removeServerName("servername");
  146|  6.03k|        app.missingServerName(nullptr);
  147|  6.03k|        app.getNativeHandle();
  148|       |
  149|  6.03k|        app.run();
  150|       |
  151|       |        /* After done we also free the client context */
  152|  6.03k|        us_socket_context_free(0, client_context);
  153|  6.03k|    }
  154|  6.03k|    uWS::Loop::get()->setSilent(true);
  155|  6.03k|    uWS::Loop::get()->free();
  156|  6.03k|}
_Z8teardownv:
  159|  5.98k|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|  5.98k|	if (!listen_socket && !client) {
  ------------------
  |  Branch (163:6): [True: 104, False: 5.88k]
  |  Branch (163:24): [True: 0, False: 104]
  ------------------
  164|      0|		exit(-1);
  165|      0|	}
  166|       |
  167|  5.98k|    if (client) {
  ------------------
  |  Branch (167:9): [True: 129, False: 5.85k]
  ------------------
  168|    129|        us_socket_close(0, client, 0, 0);
  169|    129|        client = NULL;
  170|    129|    }
  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|  5.98k|    if (listen_socket) {
  ------------------
  |  Branch (174:9): [True: 5.88k, False: 104]
  ------------------
  175|  5.88k|        us_listen_socket_close(0, listen_socket);
  176|  5.88k|        listen_socket = NULL;
  177|  5.88k|    }
  178|  5.98k|}
EpollHelloWorld.cpp:_ZZ4testvENK4$_10clEP11us_socket_ti:
  112|  2.44k|        us_socket_context_on_connect_error(0, client_context, [](struct us_socket_t *s, int code) {
  113|  2.44k|            client = nullptr;
  114|  2.44k|            return s;
  115|  2.44k|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_11clEP11us_socket_tiPci:
  117|    281|        us_socket_context_on_open(0, client_context, [](struct us_socket_t *s, int is_client, char *ip, int ip_length) {
  118|    281|            us_socket_flush(0, s);
  119|    281|            return s;
  120|    281|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_12clEP11us_socket_t:
  122|    836|        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|    836|            us_socket_write(0, s, "asdadasdasdasdaddfgdfhdfgdfg", 28, false);
  125|    836|            return s;
  126|    836|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_13clEP11us_socket_tPci:
  128|    427|        us_socket_context_on_data(0, client_context, [](struct us_socket_t *s, char *data, int length) {
  129|    427|            return s;
  130|    427|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_14clEP11us_socket_t:
  132|    613|        us_socket_context_on_writable(0, client_context, [](struct us_socket_t *s) {
  133|       |            /* Let's defer a close here */
  134|    613|            us_socket_shutdown_read(0, s);
  135|    613|            return s;
  136|    613|        });
EpollHelloWorld.cpp:_ZZ4testvENK4$_15clEP11us_socket_tiPv:
  138|    314|        us_socket_context_on_close(0, client_context, [](struct us_socket_t *s, int code, void *reason) {
  139|    314|            client = NULL;
  140|    314|            return s;
  141|    314|        });
EpollHelloWorld.cpp:_ZZ4testvENK3$_0clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   27|  8.50k|        }).get("/*", [](auto *res, auto *req) {
   28|  8.50k|            if (req->getHeader("write").length()) {
  ------------------
  |  Branch (28:17): [True: 691, False: 7.81k]
  ------------------
   29|    691|                res->writeStatus("200 OK")->writeHeader("write", "true")->write("Hello");
   30|    691|                res->write(" world!");
   31|    691|                res->end();
   32|  7.81k|            } else if (req->getQuery().length()) {
  ------------------
  |  Branch (32:24): [True: 910, False: 6.90k]
  ------------------
   33|    910|                res->close();
   34|  6.90k|            } else {
   35|  6.90k|                res->end("Hello world!");
   36|  6.90k|            }
   37|  8.50k|        }).post("/*", [](auto *res, auto *req) {
EpollHelloWorld.cpp:_ZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   37|  2.73k|        }).post("/*", [](auto *res, auto *req) {
   38|  2.73k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  2.73k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  2.73k|                });
   43|  2.73k|            });
   44|  2.73k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  2.73k|                if (isEnd) {
   46|  2.73k|                    res->cork([res, chunk]() {
   47|  2.73k|                        res->write("something ahead");
   48|  2.73k|                        res->end(chunk);
   49|  2.73k|                    });
   50|  2.73k|                }
   51|  2.73k|            });
   52|  2.73k|        }).any("/:candy/*", [](auto *res, auto *req) {
EpollHelloWorld.cpp:_ZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEv:
   38|  1.13k|            res->onAborted([]() {
   39|       |                /* We might as well use this opportunity to stress the loop a bit */
   40|  1.13k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  1.13k|                });
   43|  1.13k|            });
EpollHelloWorld.cpp:_ZZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvENKUlvE_clEv:
   40|  1.00k|                uWS::Loop::get()->defer([]() {
   41|       |
   42|  1.00k|                });
EpollHelloWorld.cpp:_ZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNS9_11char_traitsIcEEEEbE_clESD_b:
   44|  35.1k|            res->onData([res](std::string_view chunk, bool isEnd) {
   45|  35.1k|                if (isEnd) {
  ------------------
  |  Branch (45:21): [True: 1.59k, False: 33.5k]
  ------------------
   46|  1.59k|                    res->cork([res, chunk]() {
   47|  1.59k|                        res->write("something ahead");
   48|  1.59k|                        res->end(chunk);
   49|  1.59k|                    });
   50|  1.59k|                }
   51|  35.1k|            });
EpollHelloWorld.cpp:_ZZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNS9_11char_traitsIcEEEEbE_clESD_bENKUlvE_clEv:
   46|  1.59k|                    res->cork([res, chunk]() {
   47|  1.59k|                        res->write("something ahead");
   48|  1.59k|                        res->end(chunk);
   49|  1.59k|                    });
EpollHelloWorld.cpp:_ZZ4testvENK3$_2clIN3uWS12HttpResponseILb0EEENS1_11HttpRequestEEEDaPT_PT0_:
   52|  3.36k|        }).any("/:candy/*", [](auto *res, auto *req) {
   53|  3.36k|            if (req->getParameter(0).length() == 0) {
  ------------------
  |  Branch (53:17): [True: 0, False: 3.36k]
  ------------------
   54|      0|                free((void *) -1);
   55|      0|            }
   56|       |            /* Some invalid queries */
   57|  3.36k|            req->getParameter(30000);
   58|  3.36k|            req->getParameter((unsigned short) -34234);
   59|  3.36k|            req->getHeader("yhello");
   60|  3.36k|            req->getQuery();
   61|  3.36k|            req->getQuery("assd");
   62|       |
   63|  3.36k|            res->end("done");
   64|  3.36k|        }).ws<PerSocketData>("/*", {
EpollHelloWorld.cpp:_ZZ4testvENK3$_3clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   71|  32.3k|            .open = [](auto *ws) {
   72|       |                /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
   73|  32.3k|                ws->getNativeHandle();
   74|  32.3k|                ws->getRemoteAddressAsText();
   75|  32.3k|                us_poll_ext((struct us_poll_t *) ws);
   76|  32.3k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_4clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS1_6OpCodeE:
   77|  13.7k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   78|  13.7k|                ws->send(message, opCode, true);
   79|  13.7k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_5clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   80|  5.10k|            .drain = [](auto *ws) {
   81|       |                /* Check ws->getBufferedAmount() here */
   82|  5.10k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   83|  5.81k|            .ping = [](auto *ws, std::string_view) {
   84|       |                /* We use this to trigger the async/wakeup feature */
   85|  5.81k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  5.81k|                });
   88|  5.81k|            },
EpollHelloWorld.cpp:_ZZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEENKUlvE_clEv:
   85|  4.20k|                uWS::Loop::get()->defer([]() {
   86|       |                    /* Do nothing */
   87|  4.20k|                });
EpollHelloWorld.cpp:_ZZ4testvENK3$_7clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   89|  1.00k|            .pong = [](auto *ws, std::string_view) {
   90|       |                /* Not implemented yet */
   91|  1.00k|            },
EpollHelloWorld.cpp:_ZZ4testvENK3$_8clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_iNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   92|  32.3k|            .close = [](auto *ws, int code, std::string_view message) {
   93|       |                /* You may access ws->getUserData() here */
   94|  32.3k|            }
EpollHelloWorld.cpp:_ZZ4testvENK3$_9clI18us_listen_socket_tEEDaPT_:
   95|  6.03k|        }).listen(9001, [](auto *listenSocket) {
   96|  6.03k|            listen_socket = listenSocket;
   97|  6.03k|        });

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

