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

_ZN3uWS11AsyncSocketILb0EE4corkEv:
  133|   197k|    void cork() {
  134|       |        /* Extra check for invalid corking of others */
  135|   197k|        if (getLoopData()->corkOffset && getLoopData()->corkedSocket != this) {
  ------------------
  |  Branch (135:13): [True: 0, False: 197k]
  |  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|   197k|        getLoopData()->corkedSocket = this;
  142|   197k|    }
_ZN3uWS11AsyncSocketILb0EE11getLoopDataEv:
   85|  2.11M|    LoopData *getLoopData() {
   86|  2.11M|        return (LoopData *) us_loop_ext(us_socket_context_loop(SSL, us_socket_context(SSL, (us_socket_t *) this)));
   87|  2.11M|    }
_ZN3uWS11AsyncSocketILb0EE6uncorkEPKcib:
  332|   197k|    std::pair<int, bool> uncork(const char *src = nullptr, int length = 0, bool optionally = false) {
  333|   197k|        LoopData *loopData = getLoopData();
  334|       |
  335|   197k|        if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (335:13): [True: 197k, False: 0]
  ------------------
  336|   197k|            loopData->corkedSocket = nullptr;
  337|       |
  338|   197k|            if (loopData->corkOffset) {
  ------------------
  |  Branch (338:17): [True: 47.0k, False: 150k]
  ------------------
  339|       |                /* Corked data is already accounted for via its write call */
  340|  47.0k|                auto [written, failed] = write(loopData->corkBuffer, (int) loopData->corkOffset, false, length);
  341|  47.0k|                loopData->corkOffset = 0;
  342|       |
  343|  47.0k|                if (failed) {
  ------------------
  |  Branch (343:21): [True: 39.5k, False: 7.44k]
  ------------------
  344|       |                    /* We do not need to care for buffering here, write does that */
  345|  39.5k|                    return {0, true};
  346|  39.5k|                }
  347|  47.0k|            }
  348|       |
  349|       |            /* We should only return with new writes, not things written to cork already */
  350|   157k|            return write(src, length, optionally, 0);
  351|   197k|        } else {
  352|       |            /* We are not even corked! */
  353|      0|            return {0, false};
  354|      0|        }
  355|   197k|    }
_ZN3uWS11AsyncSocketILb0EE5writeEPKcibi:
  241|  1.35M|    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.35M|        if (us_socket_is_closed(SSL, (us_socket_t *) this)) {
  ------------------
  |  Branch (243:13): [True: 78.8k, False: 1.28M]
  ------------------
  244|  78.8k|            return {length, false};
  245|  78.8k|        }
  246|       |
  247|  1.28M|        LoopData *loopData = getLoopData();
  248|  1.28M|        AsyncSocketData<SSL> *asyncSocketData = getAsyncSocketData();
  249|       |
  250|       |        /* We are limited if we have a per-socket buffer */
  251|  1.28M|        if (asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (251:13): [True: 90.8k, False: 1.18M]
  ------------------
  252|       |            /* Write off as much as we can */
  253|  90.8k|            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|  90.8k|            if ((unsigned int) written < asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (256:17): [True: 86.8k, False: 3.97k]
  ------------------
  257|       |
  258|       |                /* Update buffering (todo: we can do better here if we keep track of what happens to this guy later on) */
  259|  86.8k|                asyncSocketData->buffer.erase((unsigned int) written);
  260|       |
  261|  86.8k|                if (optionally) {
  ------------------
  |  Branch (261:21): [True: 2.18k, False: 84.6k]
  ------------------
  262|       |                    /* Thankfully we can exit early here */
  263|  2.18k|                    return {0, true};
  264|  84.6k|                } else {
  265|       |                    /* This path is horrible and points towards erroneous usage */
  266|  84.6k|                    asyncSocketData->buffer.append(src, (unsigned int) length);
  267|       |
  268|  84.6k|                    return {length, true};
  269|  84.6k|                }
  270|  86.8k|            }
  271|       |
  272|       |            /* At this point we simply have no buffer and can continue as normal */
  273|  3.97k|            asyncSocketData->buffer.clear();
  274|  3.97k|        }
  275|       |
  276|  1.19M|        if (length) {
  ------------------
  |  Branch (276:13): [True: 1.14M, False: 49.8k]
  ------------------
  277|  1.14M|            if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (277:17): [True: 1.10M, False: 43.1k]
  ------------------
  278|       |                /* We are corked */
  279|  1.10M|                if (LoopData::CORK_BUFFER_SIZE - loopData->corkOffset >= (unsigned int) length) {
  ------------------
  |  Branch (279:21): [True: 1.10M, False: 0]
  ------------------
  280|       |                    /* If the entire chunk fits in cork buffer */
  281|  1.10M|                    memcpy(loopData->corkBuffer + loopData->corkOffset, src, (unsigned int) length);
  282|  1.10M|                    loopData->corkOffset += (unsigned int) length;
  283|       |                    /* Fall through to default return */
  284|  1.10M|                } 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.10M|            } else {
  300|       |                /* We are not corked */
  301|  43.1k|                int written = us_socket_write(SSL, (us_socket_t *) this, src, length, nextLength != 0);
  302|       |
  303|       |                /* Did we fail? */
  304|  43.1k|                if (written < length) {
  ------------------
  |  Branch (304:21): [True: 40.2k, False: 2.93k]
  ------------------
  305|       |                    /* If the write was optional then just bail out */
  306|  40.2k|                    if (optionally) {
  ------------------
  |  Branch (306:25): [True: 0, False: 40.2k]
  ------------------
  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|  40.2k|                    if (nextLength) {
  ------------------
  |  Branch (312:25): [True: 0, False: 40.2k]
  ------------------
  313|      0|                        asyncSocketData->buffer.reserve(asyncSocketData->buffer.length() + (size_t) (length - written + nextLength));
  314|      0|                    }
  315|       |
  316|       |                    /* Buffer this chunk */
  317|  40.2k|                    asyncSocketData->buffer.append(src + written, (size_t) (length - written));
  318|       |
  319|       |                    /* Return the failure */
  320|  40.2k|                    return {length, true};
  321|  40.2k|                }
  322|       |                /* Fall through to default return */
  323|  43.1k|            }
  324|  1.14M|        }
  325|       |
  326|       |        /* Default fall through return */
  327|  1.15M|        return {length, false};
  328|  1.19M|    }
_ZN3uWS11AsyncSocketILb0EE7timeoutEj:
   95|   144k|    void timeout(unsigned int seconds) {
   96|   144k|        us_socket_timeout(SSL, (us_socket_t *) this, seconds);
   97|   144k|    }
_ZN3uWS11AsyncSocketILb0EE17getBufferedAmountEv:
  198|   123k|    unsigned int getBufferedAmount() {
  199|       |        /* We return the actual amount of bytes in backbuffer, including pendingRemoval */
  200|   123k|        return (unsigned int) getAsyncSocketData()->buffer.totalLength();
  201|   123k|    }
_ZN3uWS11AsyncSocketILb0EE8shutdownEv:
  100|  1.96k|    void shutdown() {
  101|  1.96k|        us_socket_shutdown(SSL, (us_socket_t *) this);
  102|  1.96k|    }
_ZN3uWS11AsyncSocketILb0EE5closeEv:
  117|  21.1k|    us_socket_t *close() {
  118|  21.1k|        return us_socket_close(SSL, (us_socket_t *) this, 0, nullptr);
  119|  21.1k|    }
_ZN3uWS11AsyncSocketILb0EE18getAsyncSocketDataEv:
   90|  1.95M|    AsyncSocketData<SSL> *getAsyncSocketData() {
   91|  1.95M|        return (AsyncSocketData<SSL> *) us_socket_ext(SSL, (us_socket_t *) this);
   92|  1.95M|    }
_ZN3uWS11AsyncSocketILb0EE8isCorkedEv:
  150|   126k|    bool isCorked() {
  151|   126k|        return getLoopData()->corkedSocket == this;
  152|   126k|    }
_ZN3uWS11AsyncSocketILb0EE13getSendBufferEm:
  160|  30.3k|    std::pair<char *, SendBufferAttribute> getSendBuffer(size_t size) {
  161|       |        /* First step is to determine if we already have backpressure or not */
  162|  30.3k|        LoopData *loopData = getLoopData();
  163|  30.3k|        BackPressure &backPressure = getAsyncSocketData()->buffer;
  164|  30.3k|        size_t existingBackpressure = backPressure.length();
  165|  30.3k|        if ((!existingBackpressure) && (isCorked() || canCork()) && (loopData->corkOffset + size < LoopData::CORK_BUFFER_SIZE)) {
  ------------------
  |  Branch (165:13): [True: 2.21k, False: 28.0k]
  |  Branch (165:41): [True: 2.21k, False: 0]
  |  Branch (165:55): [True: 0, False: 0]
  |  Branch (165:69): [True: 2.14k, False: 69]
  ------------------
  166|       |            /* Cork automatically if we can */
  167|  2.14k|            if (isCorked()) {
  ------------------
  |  Branch (167:17): [True: 2.14k, False: 0]
  ------------------
  168|  2.14k|                char *sendBuffer = loopData->corkBuffer + loopData->corkOffset;
  169|  2.14k|                loopData->corkOffset += (unsigned int) size;
  170|  2.14k|                return {sendBuffer, SendBufferAttribute::NEEDS_NOTHING};
  171|  2.14k|            } 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|  28.1k|        } 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|  28.1k|            unsigned int ourCorkOffset = 0;
  182|  28.1k|            if (isCorked() && loopData->corkOffset) {
  ------------------
  |  Branch (182:17): [True: 28.1k, False: 0]
  |  Branch (182:31): [True: 69, False: 28.0k]
  ------------------
  183|     69|                ourCorkOffset = loopData->corkOffset;
  184|     69|                loopData->corkOffset = 0;
  185|     69|            }
  186|       |
  187|       |            /* Fallback is to use the backpressure as buffer */
  188|  28.1k|            backPressure.resize(ourCorkOffset + existingBackpressure + size);
  189|       |
  190|       |            /* And copy corkbuffer in front */
  191|  28.1k|            memcpy((char *) backPressure.data() + existingBackpressure, loopData->corkBuffer, ourCorkOffset);
  192|       |
  193|  28.1k|            return {(char *) backPressure.data() + ourCorkOffset + existingBackpressure, SendBufferAttribute::NEEDS_DRAIN};
  194|  28.1k|        }
  195|  30.3k|    }
_ZN3uWS11AsyncSocketILb0EE13corkUncheckedEv:
  121|  37.1k|    void corkUnchecked() {
  122|       |        /* What if another socket is corked? */
  123|  37.1k|        getLoopData()->corkedSocket = this;
  124|  37.1k|    }
_ZN3uWS11AsyncSocketILb0EE15getNativeHandleEv:
   80|  34.7k|    void *getNativeHandle() {
   81|  34.7k|        return us_socket_get_native_handle(SSL, (us_socket_t *) this);
   82|  34.7k|    }
_ZN3uWS11AsyncSocketILb0EE22getRemoteAddressAsTextEv:
  234|  34.7k|    std::string_view getRemoteAddressAsText() {
  235|  34.7k|        return addressAsText(getRemoteAddress());
  236|  34.7k|    }
_ZN3uWS11AsyncSocketILb0EE13addressAsTextENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  204|  34.7k|    std::string_view addressAsText(std::string_view binary) {
  205|  34.7k|        static thread_local char buf[64];
  206|  34.7k|        int ipLength = 0;
  207|       |
  208|  34.7k|        if (!binary.length()) {
  ------------------
  |  Branch (208:13): [True: 0, False: 34.7k]
  ------------------
  209|      0|            return {};
  210|      0|        }
  211|       |
  212|  34.7k|        unsigned char *b = (unsigned char *) binary.data();
  213|       |
  214|  34.7k|        if (binary.length() == 4) {
  ------------------
  |  Branch (214:13): [True: 12.7k, False: 21.9k]
  ------------------
  215|  12.7k|            ipLength = sprintf(buf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]);
  216|  21.9k|        } else {
  217|  21.9k|            ipLength = sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
  218|  21.9k|                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|  21.9k|                b[12], b[13], b[14], b[15]);
  220|  21.9k|        }
  221|       |
  222|  34.7k|        return {buf, (unsigned int) ipLength};
  223|  34.7k|    }
_ZN3uWS11AsyncSocketILb0EE16getRemoteAddressEv:
  226|  34.7k|    std::string_view getRemoteAddress() {
  227|  34.7k|        static thread_local char buf[16];
  228|  34.7k|        int ipLength = 16;
  229|  34.7k|        us_socket_remote_address(SSL, (us_socket_t *) this, buf, &ipLength);
  230|  34.7k|        return std::string_view(buf, (unsigned int) ipLength);
  231|  34.7k|    }

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

_ZN3uWS11BloomFilter5resetEv:
   75|  56.1k|    void reset() {
   76|  56.1k|        filter.reset();
   77|  56.1k|    }
_ZN3uWS11BloomFilter3addENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   64|   146k|    void add(std::string_view key) {
   65|   146k|        if (key.length() >= 2) {
  ------------------
  |  Branch (65:13): [True: 133k, False: 12.1k]
  ------------------
   66|   133k|            ScrambleArea s = getFeatures(key);
   67|   133k|            s.val = perfectHash(s.val);
   68|   133k|            filter[s.p[0]] = 1;
   69|   133k|            filter[s.p[1]] = 1;
   70|   133k|            filter[s.p[2]] = 1;
   71|   133k|            filter[s.p[3]] = 1;
   72|   133k|        }
   73|   146k|    }
_ZN3uWS11BloomFilter11getFeaturesENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   41|   592k|    ScrambleArea getFeatures(std::string_view key) {
   42|   592k|        ScrambleArea s;
   43|   592k|        s.p[0] = reinterpret_cast<const unsigned char&>(key[0]);
   44|   592k|        s.p[1] = reinterpret_cast<const unsigned char&>(key[key.length() - 1]);
   45|   592k|        s.p[2] = reinterpret_cast<const unsigned char&>(key[key.length() - 2]);
   46|   592k|        s.p[3] = reinterpret_cast<const unsigned char&>(key[key.length() >> 1]);
   47|   592k|        return s;
   48|   592k|    }
_ZN3uWS11BloomFilter11perfectHashEj:
   32|   592k|    static inline uint32_t perfectHash(uint32_t features) {
   33|   592k|        return features *= 1843993368;
   34|   592k|    }
_ZN3uWS11BloomFilter9mightHaveENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   51|   458k|    bool mightHave(std::string_view key) {
   52|   458k|        if (key.length() < 2) {
  ------------------
  |  Branch (52:13): [True: 0, False: 458k]
  ------------------
   53|      0|            return true;
   54|      0|        }
   55|       |    
   56|   458k|        ScrambleArea s = getFeatures(key);
   57|   458k|        s.val = perfectHash(s.val);
   58|   458k|        return filter[s.p[0]] &&
  ------------------
  |  Branch (58:16): [True: 193k, False: 264k]
  ------------------
   59|   458k|        filter[s.p[1]] &&
  ------------------
  |  Branch (59:9): [True: 118k, False: 75.4k]
  ------------------
   60|   458k|        filter[s.p[2]] &&
  ------------------
  |  Branch (60:9): [True: 116k, False: 2.17k]
  ------------------
   61|   458k|        filter[s.p[3]];
  ------------------
  |  Branch (61:9): [True: 115k, False: 437]
  ------------------
   62|   458k|    }

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

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

_ZN3uWS10HttpParser17consumePostPaddedEPcjPvS2_ON5ofats13any_invocableIFS2_S2_PNS_11HttpRequestEEEEONS4_IFS2_S2_NSt3__117basic_string_viewIcNSA_11char_traitsIcEEEEbEEE:
  527|   131k|    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|   131k|        HttpRequest req;
  532|       |
  533|   131k|        if (remainingStreamingBytes) {
  ------------------
  |  Branch (533:13): [True: 5.57k, False: 125k]
  ------------------
  534|       |
  535|       |            /* It's either chunked or with a content-length */
  536|  5.57k|            if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (536:17): [True: 4.53k, False: 1.04k]
  ------------------
  537|  4.53k|                std::string_view dataToConsume(data, length);
  538|  4.53k|                for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (538:33): [True: 3.77k, False: 4.53k]
  ------------------
  539|  3.77k|                    dataHandler(user, chunk, chunk.length() == 0);
  540|  3.77k|                }
  541|  4.53k|                if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (541:21): [True: 309, False: 4.22k]
  ------------------
  542|    309|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  543|    309|                }
  544|  4.22k|                data = (char *) dataToConsume.data();
  545|  4.22k|                length = (unsigned int) dataToConsume.length();
  546|  4.22k|            } else {
  547|       |                // this is exactly the same as below!
  548|       |                // todo: refactor this
  549|  1.04k|                if (remainingStreamingBytes >= length) {
  ------------------
  |  Branch (549:21): [True: 843, False: 197]
  ------------------
  550|    843|                    void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
  551|    843|                    remainingStreamingBytes -= length;
  552|    843|                    return {0, returnedUser};
  553|    843|                } else {
  554|    197|                    void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  555|       |
  556|    197|                    data += remainingStreamingBytes;
  557|    197|                    length -= remainingStreamingBytes;
  558|       |
  559|    197|                    remainingStreamingBytes = 0;
  560|       |
  561|    197|                    if (returnedUser != user) {
  ------------------
  |  Branch (561:25): [True: 0, False: 197]
  ------------------
  562|      0|                        return {0, returnedUser};
  563|      0|                    }
  564|    197|                }
  565|  1.04k|            }
  566|       |
  567|   125k|        } else if (fallback.length()) {
  ------------------
  |  Branch (567:20): [True: 20.1k, False: 105k]
  ------------------
  568|  20.1k|            unsigned int had = (unsigned int) fallback.length();
  569|       |
  570|  20.1k|            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|  20.1k|            fallback.reserve(fallback.length() + maxCopyDistance + std::max<unsigned int>(MINIMUM_HTTP_POST_PADDING, sizeof(std::string)));
  574|  20.1k|            fallback.append(data, maxCopyDistance);
  575|       |
  576|       |            // break here on break
  577|  20.1k|            std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<true>(fallback.data(), (unsigned int) fallback.length(), user, reserved, &req, requestHandler, dataHandler);
  578|  20.1k|            if (consumed.second != user) {
  ------------------
  |  Branch (578:17): [True: 8.33k, False: 11.7k]
  ------------------
  579|  8.33k|                return consumed;
  580|  8.33k|            }
  581|       |
  582|  11.7k|            if (consumed.first) {
  ------------------
  |  Branch (582:17): [True: 2.49k, False: 9.28k]
  ------------------
  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.49k|                fallback.clear();
  588|  2.49k|                data += consumed.first - had;
  589|  2.49k|                length -= consumed.first - had;
  590|       |
  591|  2.49k|                if (remainingStreamingBytes) {
  ------------------
  |  Branch (591:21): [True: 1.40k, False: 1.09k]
  ------------------
  592|       |                    /* It's either chunked or with a content-length */
  593|  1.40k|                    if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (593:25): [True: 621, False: 783]
  ------------------
  594|    621|                        std::string_view dataToConsume(data, length);
  595|    746|                        for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (595:41): [True: 746, False: 621]
  ------------------
  596|    746|                            dataHandler(user, chunk, chunk.length() == 0);
  597|    746|                        }
  598|    621|                        if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (598:29): [True: 258, False: 363]
  ------------------
  599|    258|                            return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  600|    258|                        }
  601|    363|                        data = (char *) dataToConsume.data();
  602|    363|                        length = (unsigned int) dataToConsume.length();
  603|    783|                    } else {
  604|       |                        // this is exactly the same as above!
  605|    783|                        if (remainingStreamingBytes >= (unsigned int) length) {
  ------------------
  |  Branch (605:29): [True: 572, False: 211]
  ------------------
  606|    572|                            void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
  607|    572|                            remainingStreamingBytes -= length;
  608|    572|                            return {0, returnedUser};
  609|    572|                        } else {
  610|    211|                            void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  611|       |
  612|    211|                            data += remainingStreamingBytes;
  613|    211|                            length -= remainingStreamingBytes;
  614|       |
  615|    211|                            remainingStreamingBytes = 0;
  616|       |
  617|    211|                            if (returnedUser != user) {
  ------------------
  |  Branch (617:33): [True: 0, False: 211]
  ------------------
  618|      0|                                return {0, returnedUser};
  619|      0|                            }
  620|    211|                        }
  621|    783|                    }
  622|  1.40k|                }
  623|       |
  624|  9.28k|            } else {
  625|  9.28k|                if (fallback.length() == MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (625:21): [True: 195, False: 9.09k]
  ------------------
  626|    195|                    return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  627|    195|                }
  628|  9.09k|                return {0, user};
  629|  9.28k|            }
  630|  11.7k|        }
  631|       |
  632|   111k|        std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<false>(data, length, user, reserved, &req, requestHandler, dataHandler);
  633|   111k|        if (consumed.second != user) {
  ------------------
  |  Branch (633:13): [True: 88.6k, False: 22.9k]
  ------------------
  634|  88.6k|            return consumed;
  635|  88.6k|        }
  636|       |
  637|  22.9k|        data += consumed.first;
  638|  22.9k|        length -= consumed.first;
  639|       |
  640|  22.9k|        if (length) {
  ------------------
  |  Branch (640:13): [True: 14.4k, False: 8.55k]
  ------------------
  641|  14.4k|            if (length < MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (641:17): [True: 14.4k, False: 0]
  ------------------
  642|  14.4k|                fallback.append(data, length);
  643|  14.4k|            } else {
  644|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  645|      0|            }
  646|  14.4k|        }
  647|       |
  648|       |        // added for now
  649|  22.9k|        return {0, user};
  650|  22.9k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi1EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|  20.1k|    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|  20.1k|        unsigned int consumedTotal = 0;
  401|  20.1k|        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|  20.1k|        data[length] = '\r';
  406|  20.1k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|  20.1k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 20.1k, False: 0]
  |  Branch (408:47): [True: 10.8k, False: 9.28k]
  ------------------
  409|  10.8k|            data += consumed;
  410|  10.8k|            length -= consumed;
  411|  10.8k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|  10.8k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|  10.8k|            req->bf.reset();
  418|  60.0k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 49.2k, False: 10.8k]
  ------------------
  419|  49.2k|                req->bf.add(h->key);
  420|  49.2k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|  10.8k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 424, False: 10.4k]
  ------------------
  424|    424|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    424|            }
  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|  10.4k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|  10.4k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|  10.4k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 844, False: 9.55k]
  |  Branch (434:52): [True: 200, False: 644]
  ------------------
  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|    200|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|    200|            }
  440|       |
  441|       |            /* Parse query */
  442|  10.2k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|  10.2k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 311, False: 9.89k]
  ------------------
  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|  10.2k|            void *returnedUser = requestHandler(user, req);
  449|  10.2k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 7.23k, False: 2.96k]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|  7.23k|                return {consumedTotal, returnedUser};
  452|  7.23k|            }
  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.96k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 621, False: 2.34k]
  ------------------
  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|    621|                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|    621|                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|  2.34k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 1.69k, False: 657]
  ------------------
  494|  1.69k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|  1.69k|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 473, False: 1.21k]
  ------------------
  496|       |                    /* Parser error */
  497|    473|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|    473|                }
  499|       |
  500|  1.21k|                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|  1.21k|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|    657|                dataHandler(user, {}, true);
  512|    657|            }
  513|       |
  514|       |            /* Consume minimally should break as easrly as possible */
  515|  2.49k|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (515:17): [Folded - Ignored]
  ------------------
  516|  2.49k|                break;
  517|  2.49k|            }
  518|  2.49k|        }
  519|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  520|  11.7k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 0, False: 11.7k]
  ------------------
  521|      0|            return {err, FULLPTR};
  522|      0|        }
  523|  11.7k|        return {consumedTotal, user};
  524|  11.7k|    }
_ZN3uWS10HttpParser10getHeadersEPcS1_PNS_11HttpRequest6HeaderEPvRj:
  286|   133k|    static unsigned int getHeaders(char *postPaddedBuffer, char *end, struct HttpRequest::Header *headers, void *reserved, unsigned int &err) {
  287|   133k|        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|   133k|            (void) reserved;
  307|   133k|            (void) end;
  308|   133k|        #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|   133k|        if (!(postPaddedBuffer = consumeRequestLine(postPaddedBuffer, headers[0]))) {
  ------------------
  |  Branch (316:13): [True: 53.5k, False: 79.8k]
  ------------------
  317|       |            /* Error - invalid request line */
  318|       |            /* Assuming it is 505 HTTP Version Not Supported */
  319|  53.5k|            err = HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED;
  320|  53.5k|            return 0;
  321|  53.5k|        }
  322|  79.8k|        headers++;
  323|       |
  324|   216k|        for (unsigned int i = 1; i < HttpRequest::MAX_HEADERS - 1; i++) {
  ------------------
  |  Branch (324:34): [True: 216k, False: 194]
  ------------------
  325|       |            /* Lower case and consume the field name */
  326|   216k|            preliminaryKey = postPaddedBuffer;
  327|   216k|            postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
  328|   216k|            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|   216k|            if (postPaddedBuffer[0] != ':') {
  ------------------
  |  Branch (331:17): [True: 8.15k, False: 208k]
  ------------------
  332|       |                /* Error: invalid chars in field name */
  333|  8.15k|                return 0;
  334|  8.15k|            }
  335|   208k|            postPaddedBuffer++;
  336|       |
  337|   208k|            preliminaryValue = postPaddedBuffer;
  338|       |            /* The goal of this call is to find next "\r\n", or any invalid field value chars, fast */
  339|   209k|            while (true) {
  ------------------
  |  Branch (339:20): [Folded - Ignored]
  ------------------
  340|   209k|                postPaddedBuffer = (char *) tryConsumeFieldValue(postPaddedBuffer);
  341|       |                /* If this is not CR then we caught some stinky invalid char on the way */
  342|   209k|                if (postPaddedBuffer[0] != '\r') {
  ------------------
  |  Branch (342:21): [True: 2.38k, False: 206k]
  ------------------
  343|       |                    /* If TAB then keep searching */
  344|  2.38k|                    if (postPaddedBuffer[0] == '\t') {
  ------------------
  |  Branch (344:25): [True: 1.15k, False: 1.22k]
  ------------------
  345|  1.15k|                        postPaddedBuffer++;
  346|  1.15k|                        continue;
  347|  1.15k|                    }
  348|       |                    /* Error - invalid chars in field value */
  349|  1.22k|                    return 0;
  350|  2.38k|                }
  351|   206k|                break;
  352|   209k|            }
  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|   206k|            if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (355:17): [True: 193k, False: 13.0k]
  ------------------
  356|       |                /* Store this header, it is valid */
  357|   193k|                headers->value = std::string_view(preliminaryValue, (size_t) (postPaddedBuffer - preliminaryValue));
  358|   193k|                postPaddedBuffer += 2;
  359|       |
  360|       |                /* Trim trailing whitespace (SP, HTAB) */
  361|   239k|                while (headers->value.length() && headers->value.back() < 33) {
  ------------------
  |  Branch (361:24): [True: 197k, False: 42.6k]
  |  Branch (361:51): [True: 45.8k, False: 151k]
  ------------------
  362|  45.8k|                    headers->value.remove_suffix(1);
  363|  45.8k|                }
  364|       |
  365|       |                /* Trim initial whitespace (SP, HTAB) */
  366|   248k|                while (headers->value.length() && headers->value.front() < 33) {
  ------------------
  |  Branch (366:24): [True: 205k, False: 42.6k]
  |  Branch (366:51): [True: 54.3k, False: 151k]
  ------------------
  367|  54.3k|                    headers->value.remove_prefix(1);
  368|  54.3k|                }
  369|       |                
  370|   193k|                headers++;
  371|       |
  372|       |                /* We definitely have at least one header (or request line), so check if we are done */
  373|   193k|                if (*postPaddedBuffer == '\r') {
  ------------------
  |  Branch (373:21): [True: 57.2k, False: 136k]
  ------------------
  374|  57.2k|                    if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (374:25): [True: 56.1k, False: 1.11k]
  ------------------
  375|       |                        /* This cann take the very last header space */
  376|  56.1k|                        headers->key = std::string_view(nullptr, 0);
  377|  56.1k|                        return (unsigned int) ((postPaddedBuffer + 2) - start);
  378|  56.1k|                    } else {
  379|       |                        /* \r\n\r plus non-\n letter is malformed request, or simply out of search space */
  380|  1.11k|                        return 0;
  381|  1.11k|                    }
  382|  57.2k|                }
  383|   193k|            } else {
  384|       |                /* We are either out of search space or this is a malformed request */
  385|  13.0k|                return 0;
  386|  13.0k|            }
  387|   206k|        }
  388|       |        /* We ran out of header space, too large request */
  389|    194|        return 0;
  390|  79.8k|    }
_ZN3uWS10HttpParser18consumeRequestLineEPcRNS_11HttpRequest6HeaderE:
  242|   133k|    static inline char *consumeRequestLine(char *data, HttpRequest::Header &header) {
  243|       |        /* Scan until single SP, assume next is / (origin request) */
  244|   133k|        char *start = data;
  245|       |        /* This catches the post padded CR and fails */
  246|   484k|        while (data[0] > 32) data++;
  ------------------
  |  Branch (246:16): [True: 350k, False: 133k]
  ------------------
  247|   133k|        if (data[0] == 32 && data[1] == '/') {
  ------------------
  |  Branch (247:13): [True: 86.9k, False: 46.4k]
  |  Branch (247:30): [True: 82.7k, False: 4.25k]
  ------------------
  248|  82.7k|            header.key = {start, (size_t) (data - start)};
  249|  82.7k|            data++;
  250|       |            /* Scan for less than 33 (catches post padded CR and fails) */
  251|  82.7k|            start = data;
  252|   148k|            for (; true; data += 8) {
  ------------------
  |  Branch (252:20): [Folded - Ignored]
  ------------------
  253|   148k|                uint64_t word;
  254|   148k|                memcpy(&word, data, sizeof(uint64_t));
  255|   148k|                if (hasLess(word, 33)) {
  ------------------
  |  Branch (255:21): [True: 82.7k, False: 65.4k]
  ------------------
  256|   471k|                    while (*(unsigned char *)data > 32) data++;
  ------------------
  |  Branch (256:28): [True: 388k, False: 82.7k]
  ------------------
  257|       |                    /* Now we stand on space */
  258|  82.7k|                    header.value = {start, (size_t) (data - start)};
  259|       |                    /* Check that the following is http 1.1 */
  260|  82.7k|                    if (memcmp(" HTTP/1.1\r\n", data, 11) == 0) {
  ------------------
  |  Branch (260:25): [True: 79.8k, False: 2.84k]
  ------------------
  261|  79.8k|                        return data + 11;
  262|  79.8k|                    }
  263|  2.84k|                    return nullptr;
  264|  82.7k|                }
  265|   148k|            }
  266|  82.7k|        }
  267|  50.7k|        return nullptr;
  268|   133k|    }
_ZN3uWS10HttpParser7hasLessEmm:
  206|  1.04M|    static inline uint64_t hasLess(uint64_t x, uint64_t n) {
  207|  1.04M|        return (((x)-~0ULL/255*(n))&~(x)&~0ULL/255*128);
  208|  1.04M|    }
_ZN3uWS10HttpParser16consumeFieldNameEPc:
  226|   216k|    static inline void *consumeFieldName(char *p) {
  227|   374k|        for (; true; p += 8) {
  ------------------
  |  Branch (227:16): [Folded - Ignored]
  ------------------
  228|   374k|            uint64_t word;
  229|   374k|            memcpy(&word, p, sizeof(uint64_t));
  230|   374k|            if (notFieldNameWord(word)) {
  ------------------
  |  Branch (230:17): [True: 216k, False: 157k]
  ------------------
  231|   794k|                while (isFieldNameByte(*(unsigned char *)p)) {
  ------------------
  |  Branch (231:24): [True: 578k, False: 216k]
  ------------------
  232|   578k|                    *(p++) |= 0x20;
  233|   578k|                }
  234|   216k|                return (void *)p;
  235|   216k|            }
  236|   157k|            word |= 0x2020202020202020ull;
  237|   157k|            memcpy(p, &word, sizeof(uint64_t));
  238|   157k|        }
  239|   216k|    }
_ZN3uWS10HttpParser16notFieldNameWordEm:
  218|   374k|    static inline bool notFieldNameWord(uint64_t x) {
  219|   374k|        return hasLess(x, '-') |
  220|   374k|        hasBetween(x, '-', '0') |
  221|   374k|        hasBetween(x, '9', 'A') |
  222|   374k|        hasBetween(x, 'Z', 'a') |
  223|   374k|        hasMore(x, 'z');
  224|   374k|    }
_ZN3uWS10HttpParser10hasBetweenEmmm:
  214|  1.12M|    static inline uint64_t hasBetween(uint64_t x, uint64_t m, uint64_t n) {
  215|  1.12M|        return (( (~0ULL/255*(127+(n))-((x)&~0ULL/255*127)) &~(x)& (((x)&~0ULL/255*127)+~0ULL/255*(127-(m))) )&~0ULL/255*128);
  216|  1.12M|    }
_ZN3uWS10HttpParser7hasMoreEmm:
  210|   374k|    static inline uint64_t hasMore(uint64_t x, uint64_t n) {
  211|   374k|        return (( ((x)+~0ULL/255*(127-(n))) |(x))&~0ULL/255*128);
  212|   374k|    }
_ZN3uWS10HttpParser15isFieldNameByteEh:
  199|   794k|    static inline bool isFieldNameByte(unsigned char x) {
  200|   794k|        return (x == '-') |
  201|   794k|        ((x > '/') & (x < ':')) |
  202|   794k|        ((x > '@') & (x < '[')) |
  203|   794k|        ((x > 96) & (x < '{'));
  204|   794k|    }
_ZN3uWS10HttpParser20tryConsumeFieldValueEPc:
  274|   209k|    static inline void *tryConsumeFieldValue(char *p) {
  275|   519k|        for (; true; p += 8) {
  ------------------
  |  Branch (275:16): [Folded - Ignored]
  ------------------
  276|   519k|            uint64_t word;
  277|   519k|            memcpy(&word, p, sizeof(uint64_t));
  278|   519k|            if (hasLess(word, 32)) {
  ------------------
  |  Branch (278:17): [True: 209k, False: 310k]
  ------------------
  279|   612k|                while (*(unsigned char *)p > 31) p++;
  ------------------
  |  Branch (279:24): [True: 403k, False: 209k]
  ------------------
  280|   209k|                return (void *)p;
  281|   209k|            }
  282|   519k|        }
  283|   209k|    }
_ZN3uWS11HttpRequest9getHeaderENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  103|   458k|    std::string_view getHeader(std::string_view lowerCasedHeader) {
  104|   458k|        if (bf.mightHave(lowerCasedHeader)) {
  ------------------
  |  Branch (104:13): [True: 115k, False: 342k]
  ------------------
  105|   245k|            for (Header *h = headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (105:39): [True: 245k, False: 406]
  ------------------
  106|   245k|                if (h->key.length() == lowerCasedHeader.length() && !strncmp(h->key.data(), lowerCasedHeader.data(), lowerCasedHeader.length())) {
  ------------------
  |  Branch (106:21): [True: 120k, False: 124k]
  |  Branch (106:69): [True: 115k, False: 5.28k]
  ------------------
  107|   115k|                    return h->value;
  108|   115k|                }
  109|   245k|            }
  110|   115k|        }
  111|   342k|        return std::string_view(nullptr, 0);
  112|   458k|    }
_ZN3uWS10HttpParser17toUnsignedIntegerENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  178|  3.47k|    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|  3.47k|        if (str.length() > 9) {
  ------------------
  |  Branch (180:13): [True: 404, False: 3.07k]
  ------------------
  181|    404|            return UINT_MAX;
  182|    404|        }
  183|       |
  184|  3.07k|        unsigned int unsignedIntegerValue = 0;
  185|  10.6k|        for (char c : str) {
  ------------------
  |  Branch (185:21): [True: 10.6k, False: 2.30k]
  ------------------
  186|       |            /* As long as the letter is 0-9 we cannot overflow. */
  187|  10.6k|            if (c < '0' || c > '9') {
  ------------------
  |  Branch (187:17): [True: 314, False: 10.3k]
  |  Branch (187:28): [True: 451, False: 9.91k]
  ------------------
  188|    765|                return UINT_MAX;
  189|    765|            }
  190|  9.91k|            unsignedIntegerValue = unsignedIntegerValue * 10u + ((unsigned int) c - (unsigned int) '0');
  191|  9.91k|        }
  192|  2.30k|        return unsignedIntegerValue;
  193|  3.07k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi0EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|   111k|    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|   111k|        unsigned int consumedTotal = 0;
  401|   111k|        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|   111k|        data[length] = '\r';
  406|   111k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|   121k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 113k, False: 8.55k]
  |  Branch (408:47): [True: 45.3k, False: 68.0k]
  ------------------
  409|  45.3k|            data += consumed;
  410|  45.3k|            length -= consumed;
  411|  45.3k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|  45.3k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|  45.3k|            req->bf.reset();
  418|   142k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 96.8k, False: 45.3k]
  ------------------
  419|  96.8k|                req->bf.add(h->key);
  420|  96.8k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|  45.3k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 395, False: 44.9k]
  ------------------
  424|    395|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    395|            }
  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|  44.9k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|  44.9k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|  44.9k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 2.82k, False: 42.0k]
  |  Branch (434:52): [True: 271, False: 2.55k]
  ------------------
  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|    271|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|    271|            }
  440|       |
  441|       |            /* Parse query */
  442|  44.6k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|  44.6k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 21.1k, False: 23.4k]
  ------------------
  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|  44.6k|            void *returnedUser = requestHandler(user, req);
  449|  44.6k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 33.3k, False: 11.3k]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|  33.3k|                return {consumedTotal, returnedUser};
  452|  33.3k|            }
  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.3k|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 2.54k, False: 8.79k]
  ------------------
  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.54k|                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.54k|                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.54k|                    std::string_view dataToConsume(data, length);
  482|  2.54k|                    for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (482:37): [True: 2.54k, False: 2.54k]
  ------------------
  483|  2.54k|                        dataHandler(user, chunk, chunk.length() == 0);
  484|  2.54k|                    }
  485|  2.54k|                    if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (485:25): [True: 433, False: 2.10k]
  ------------------
  486|    433|                        return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  487|    433|                    }
  488|  2.10k|                    unsigned int consumed = (length - (unsigned int) dataToConsume.length());
  489|  2.10k|                    data = (char *) dataToConsume.data();
  490|  2.10k|                    length = (unsigned int) dataToConsume.length();
  491|  2.10k|                    consumedTotal += consumed;
  492|  2.10k|                }
  493|  8.79k|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 1.78k, False: 7.00k]
  ------------------
  494|  1.78k|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|  1.78k|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 696, False: 1.09k]
  ------------------
  496|       |                    /* Parser error */
  497|    696|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|    696|                }
  499|       |
  500|  1.09k|                if (!CONSUME_MINIMALLY) {
  ------------------
  |  Branch (500:21): [Folded - Ignored]
  ------------------
  501|  1.09k|                    unsigned int emittable = std::min<unsigned int>(remainingStreamingBytes, length);
  502|  1.09k|                    dataHandler(user, std::string_view(data, emittable), emittable == remainingStreamingBytes);
  503|  1.09k|                    remainingStreamingBytes -= emittable;
  504|       |
  505|  1.09k|                    data += emittable;
  506|  1.09k|                    length -= emittable;
  507|  1.09k|                    consumedTotal += emittable;
  508|  1.09k|                }
  509|  7.00k|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|  7.00k|                dataHandler(user, {}, true);
  512|  7.00k|            }
  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|  76.5k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 53.5k, False: 22.9k]
  ------------------
  521|  53.5k|            return {err, FULLPTR};
  522|  53.5k|        }
  523|  22.9k|        return {consumedTotal, user};
  524|  76.5k|    }
_ZN3uWS11HttpRequest9isAncientEv:
   60|  54.4k|    bool isAncient() {
   61|  54.4k|        return ancientHttp;
   62|  54.4k|    }
_ZN3uWS11HttpRequest22getCaseSensitiveMethodEv:
  123|  54.4k|    std::string_view getCaseSensitiveMethod() {
  124|  54.4k|        return std::string_view(headers->key.data(), headers->key.length());
  125|  54.4k|    }
_ZN3uWS11HttpRequest6getUrlEv:
  114|  54.4k|    std::string_view getUrl() {
  115|  54.4k|        return std::string_view(headers->value.data(), querySeparator);
  116|  54.4k|    }
_ZN3uWS11HttpRequest8setYieldEb:
   99|  76.5k|    void setYield(bool yield) {
  100|  76.5k|        didYield = yield;
  101|  76.5k|    }
_ZN3uWS11HttpRequest13setParametersENSt3__14pairIiPNS1_17basic_string_viewIcNS1_11char_traitsIcEEEEEE:
  154|  64.3k|    void setParameters(std::pair<int, std::string_view *> parameters) {
  155|  64.3k|        currentParameters = parameters;
  156|  64.3k|    }
_ZN3uWS11HttpRequest8getYieldEv:
   64|  64.3k|    bool getYield() {
   65|  64.3k|        return didYield;
   66|  64.3k|    }
_ZN3uWS11HttpRequest8getQueryEv:
  137|  11.2k|    std::string_view getQuery() {
  138|  11.2k|        if (querySeparator < headers->value.length()) {
  ------------------
  |  Branch (138:13): [True: 4.04k, False: 7.16k]
  ------------------
  139|       |            /* Strip the initial ? */
  140|  4.04k|            return std::string_view(headers->value.data() + querySeparator + 1, headers->value.length() - querySeparator - 1);
  141|  7.16k|        } else {
  142|  7.16k|            return std::string_view(nullptr, 0);
  143|  7.16k|        }
  144|  11.2k|    }
_ZN3uWS11HttpRequest12getParameterEt:
  158|  12.3k|    std::string_view getParameter(unsigned short index) {
  159|  12.3k|        if (currentParameters.first < (int) index) {
  ------------------
  |  Branch (159:13): [True: 8.21k, False: 4.10k]
  ------------------
  160|  8.21k|            return {};
  161|  8.21k|        } else {
  162|  4.10k|            return currentParameters.second[index];
  163|  4.10k|        }
  164|  12.3k|    }
_ZN3uWS11HttpRequest8getQueryENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  147|  4.10k|    std::string_view getQuery(std::string_view key) {
  148|       |        /* Raw querystring including initial '?' sign */
  149|  4.10k|        std::string_view queryString = std::string_view(headers->value.data() + querySeparator, headers->value.length() - querySeparator);
  150|       |
  151|  4.10k|        return getDecodedQueryValue(key, queryString);
  152|  4.10k|    }

_ZN3uWS12HttpResponseILb0EE12hasRespondedEv:
  490|  28.6k|    bool hasResponded() {
  491|  28.6k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  492|       |
  493|  28.6k|        return !(httpResponseData->state & HttpResponseData<SSL>::HTTP_RESPONSE_PENDING);
  494|  28.6k|    }
_ZN3uWS12HttpResponseILb0EE19getHttpResponseDataEv:
   52|   469k|    HttpResponseData<SSL> *getHttpResponseData() {
   53|   469k|        return (HttpResponseData<SSL> *) Super::getAsyncSocketData();
   54|   469k|    }
_ZN3uWS12HttpResponseILb0EE13writeContinueEv:
  377|    231|    HttpResponse *writeContinue() {
  378|    231|        Super::write("HTTP/1.1 100 Continue\r\n\r\n", 25);
  379|    231|        return this;
  380|    231|    }
EpollHelloWorld.cpp:_ZN3uWS12HttpResponseILb0EE7upgradeIZ4testvE13PerSocketDataEEvOT_NSt3__117basic_string_viewIcNS6_11char_traitsIcEEEESA_SA_P19us_socket_context_t:
  239|  37.1k|            struct us_socket_context_t *webSocketContext) {
  240|       |
  241|       |        /* Extract needed parameters from WebSocketContextData */
  242|  37.1k|        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|  37.1k|        char secWebSocketAccept[29] = {};
  246|  37.1k|        WebSocketHandshake::generate(secWebSocketKey.data(), secWebSocketAccept);
  247|       |
  248|  37.1k|        writeStatus("101 Switching Protocols")
  249|  37.1k|            ->writeHeader("Upgrade", "websocket")
  250|  37.1k|            ->writeHeader("Connection", "Upgrade")
  251|  37.1k|            ->writeHeader("Sec-WebSocket-Accept", secWebSocketAccept);
  252|       |
  253|       |        /* Select first subprotocol if present */
  254|  37.1k|        if (secWebSocketProtocol.length()) {
  ------------------
  |  Branch (254:13): [True: 848, False: 36.3k]
  ------------------
  255|    848|            writeHeader("Sec-WebSocket-Protocol", secWebSocketProtocol.substr(0, secWebSocketProtocol.find(',')));
  256|    848|        }
  257|       |
  258|       |        /* Negotiate compression */
  259|  37.1k|        bool perMessageDeflate = false;
  260|  37.1k|        CompressOptions compressOptions = CompressOptions::DISABLED;
  261|  37.1k|        if (secWebSocketExtensions.length() && webSocketContextData->compression != DISABLED) {
  ------------------
  |  Branch (261:13): [True: 4.23k, False: 32.9k]
  |  Branch (261:48): [True: 4.03k, False: 197]
  ------------------
  262|       |
  263|       |            /* Make sure to map SHARED_DECOMPRESSOR to windowBits = 0, not 1  */
  264|  4.03k|            int wantedInflationWindow = 0;
  265|  4.03k|            if ((webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) != CompressOptions::SHARED_DECOMPRESSOR) {
  ------------------
  |  Branch (265:17): [True: 4.03k, False: 0]
  ------------------
  266|  4.03k|                wantedInflationWindow = (webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) >> 8;
  267|  4.03k|            }
  268|       |
  269|       |            /* Map from selected compressor (this automatically maps SHARED_COMPRESSOR to windowBits 0, not 1) */
  270|  4.03k|            int wantedCompressionWindow = (webSocketContextData->compression & CompressOptions::_COMPRESSOR_MASK) >> 4;
  271|       |
  272|  4.03k|            auto [negCompression, negCompressionWindow, negInflationWindow, negResponse] =
  273|  4.03k|            negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
  274|  4.03k|                                        secWebSocketExtensions);
  275|       |
  276|  4.03k|            if (negCompression) {
  ------------------
  |  Branch (276:17): [True: 2.62k, False: 1.41k]
  ------------------
  277|  2.62k|                perMessageDeflate = true;
  278|       |
  279|       |                /* Map from negotiated windowBits to compressor and decompressor */
  280|  2.62k|                if (negCompressionWindow == 0) {
  ------------------
  |  Branch (280:21): [True: 2.62k, False: 0]
  ------------------
  281|  2.62k|                    compressOptions = CompressOptions::SHARED_COMPRESSOR;
  282|  2.62k|                } 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.62k|                if (negInflationWindow == 0) {
  ------------------
  |  Branch (294:21): [True: 2.62k, False: 0]
  ------------------
  295|  2.62k|                    compressOptions = CompressOptions(compressOptions | CompressOptions::SHARED_DECOMPRESSOR);
  296|  2.62k|                } else {
  297|      0|                    compressOptions = CompressOptions(compressOptions | (negInflationWindow << 8));
  298|      0|                }
  299|       |
  300|  2.62k|                writeHeader("Sec-WebSocket-Extensions", negResponse);
  301|  2.62k|            }
  302|  4.03k|        }
  303|       |
  304|  37.1k|        internalEnd({nullptr, 0}, 0, false, false);
  305|       |
  306|       |        /* Grab the httpContext from res */
  307|  37.1k|        HttpContext<SSL> *httpContext = (HttpContext<SSL> *) us_socket_context(SSL, (struct us_socket_t *) this);
  308|       |
  309|       |        /* Move any backpressure out of HttpResponse */
  310|  37.1k|        BackPressure backpressure(std::move(((AsyncSocketData<SSL> *) getHttpResponseData())->buffer));
  311|       |
  312|       |        /* Destroy HttpResponseData */
  313|  37.1k|        getHttpResponseData()->~HttpResponseData();
  314|       |
  315|       |        /* Before we adopt and potentially change socket, check if we are corked */
  316|  37.1k|        bool wasCorked = Super::isCorked();
  317|       |
  318|       |        /* Adopting a socket invalidates it, do not rely on it directly to carry any data */
  319|  37.1k|        WebSocket<SSL, true, UserData> *webSocket = (WebSocket<SSL, true, UserData> *) us_socket_context_adopt_socket(SSL,
  320|  37.1k|                    (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|  37.1k|        if (wasCorked) {
  ------------------
  |  Branch (323:13): [True: 37.1k, False: 0]
  ------------------
  324|  37.1k|            webSocket->AsyncSocket<SSL>::corkUnchecked();
  325|  37.1k|        }
  326|       |
  327|       |        /* Initialize websocket with any moved backpressure intact */
  328|  37.1k|        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|  37.1k|        HttpContextData<SSL> *httpContextData = httpContext->getSocketContextData();
  332|  37.1k|        if (httpContextData->isParsingHttp) {
  ------------------
  |  Branch (332:13): [True: 37.1k, False: 0]
  ------------------
  333|       |            /* We need to tell the Http parser that we changed socket */
  334|  37.1k|            httpContextData->upgradedWebSocket = webSocket;
  335|  37.1k|        }
  336|       |
  337|       |        /* Arm maxLifetime timeout */
  338|  37.1k|        us_socket_long_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->maxLifetime);
  339|       |
  340|       |        /* Arm idleTimeout */
  341|  37.1k|        us_socket_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->idleTimeoutComponents.first);
  342|       |
  343|       |        /* Move construct the UserData right before calling open handler */
  344|  37.1k|        new (webSocket->getUserData()) UserData(std::move(userData));
  345|       |
  346|       |        /* Emit open event and start the timeout */
  347|  37.1k|        if (webSocketContextData->openHandler) {
  ------------------
  |  Branch (347:13): [True: 34.7k, False: 2.44k]
  ------------------
  348|  34.7k|            webSocketContextData->openHandler(webSocket);
  349|  34.7k|        }
  350|  37.1k|    }
_ZN3uWS12HttpResponseILb0EE11writeStatusENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  383|   307k|    HttpResponse *writeStatus(std::string_view status) {
  384|   307k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  385|       |
  386|       |        /* Do not allow writing more than one status */
  387|   307k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_STATUS_CALLED) {
  ------------------
  |  Branch (387:13): [True: 258k, False: 49.7k]
  ------------------
  388|   258k|            return this;
  389|   258k|        }
  390|       |
  391|       |        /* Update status */
  392|  49.7k|        httpResponseData->state |= HttpResponseData<SSL>::HTTP_STATUS_CALLED;
  393|       |
  394|  49.7k|        Super::write("HTTP/1.1 ", 9);
  395|  49.7k|        Super::write(status.data(), (int) status.length());
  396|  49.7k|        Super::write("\r\n", 2);
  397|  49.7k|        return this;
  398|   307k|    }
_ZN3uWS12HttpResponseILb0EE11writeHeaderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_:
  401|   217k|    HttpResponse *writeHeader(std::string_view key, std::string_view value) {
  402|   217k|        writeStatus(HTTP_200_OK);
  403|       |
  404|   217k|        Super::write(key.data(), (int) key.length());
  405|   217k|        Super::write(": ", 2);
  406|   217k|        Super::write(value.data(), (int) value.length());
  407|   217k|        Super::write("\r\n", 2);
  408|   217k|        return this;
  409|   217k|    }
_ZN3uWS12HttpResponseILb0EE11internalEndENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEmbbb:
   92|  49.7k|    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|  49.7k|        writeStatus(HTTP_200_OK);
   95|       |
   96|       |        /* If no total size given then assume this chunk is everything */
   97|  49.7k|        if (!totalSize) {
  ------------------
  |  Branch (97:13): [True: 38.8k, False: 10.9k]
  ------------------
   98|  38.8k|            totalSize = data.length();
   99|  38.8k|        }
  100|       |
  101|  49.7k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  102|       |
  103|       |        /* In some cases, such as when refusing huge data we want to close the connection when drained */
  104|  49.7k|        if (closeConnection) {
  ------------------
  |  Branch (104:13): [True: 0, False: 49.7k]
  ------------------
  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|  49.7k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED) {
  ------------------
  |  Branch (118:13): [True: 2.14k, False: 47.6k]
  ------------------
  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.14k|            if (data.length()) {
  ------------------
  |  Branch (123:17): [True: 502, False: 1.64k]
  ------------------
  124|    502|                Super::write("\r\n", 2);
  125|    502|                writeUnsignedHex((unsigned int) data.length());
  126|    502|                Super::write("\r\n", 2);
  127|       |
  128|       |                /* Ignoring optional for now */
  129|    502|                Super::write(data.data(), (int) data.length());
  130|    502|            }
  131|       |
  132|       |            /* Terminating 0 chunk */
  133|  2.14k|            Super::write("\r\n0\r\n\r\n", 7);
  134|       |
  135|  2.14k|            httpResponseData->markDone();
  136|       |
  137|       |            /* We need to check if we should close this socket here now */
  138|  2.14k|            if (!Super::isCorked()) {
  ------------------
  |  Branch (138:17): [True: 0, False: 2.14k]
  ------------------
  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.14k|            Super::timeout(HTTP_TIMEOUT_S);
  154|  2.14k|            return true;
  155|  47.6k|        } else {
  156|       |            /* Write content-length on first call */
  157|  47.6k|            if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_END_CALLED)) {
  ------------------
  |  Branch (157:17): [True: 47.6k, False: 0]
  ------------------
  158|       |                /* Write mark, this propagates to WebSockets too */
  159|  47.6k|                writeMark();
  160|       |
  161|       |                /* WebSocket upgrades does not allow content-length */
  162|  47.6k|                if (allowContentLength) {
  ------------------
  |  Branch (162:21): [True: 10.4k, False: 37.1k]
  ------------------
  163|       |                    /* Even zero is a valid content-length */
  164|  10.4k|                    Super::write("Content-Length: ", 16);
  165|  10.4k|                    writeUnsigned64(totalSize);
  166|  10.4k|                    Super::write("\r\n\r\n", 4);
  167|  37.1k|                } else {
  168|  37.1k|                    Super::write("\r\n", 2);
  169|  37.1k|                }
  170|       |
  171|       |                /* Mark end called */
  172|  47.6k|                httpResponseData->state |= HttpResponseData<SSL>::HTTP_END_CALLED;
  173|  47.6k|            }
  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|  47.6k|            size_t written = 0;
  180|  47.6k|            bool failed = false;
  181|  58.1k|            while (written < data.length() && !failed) {
  ------------------
  |  Branch (181:20): [True: 10.4k, False: 47.6k]
  |  Branch (181:47): [True: 10.4k, False: 0]
  ------------------
  182|       |                /* uSockets only deals with int sizes, so pass chunks of max signed int size */
  183|  10.4k|                auto writtenFailed = Super::write(data.data() + written, (int) std::min<size_t>(data.length() - written, INT_MAX), optional);
  184|       |
  185|  10.4k|                written += (size_t) writtenFailed.first;
  186|  10.4k|                failed = writtenFailed.second;
  187|  10.4k|            }
  188|       |
  189|  47.6k|            httpResponseData->offset += written;
  190|       |
  191|       |            /* Success is when we wrote the entire thing without any failures */
  192|  47.6k|            bool success = written == data.length() && !failed;
  ------------------
  |  Branch (192:28): [True: 47.6k, False: 0]
  |  Branch (192:56): [True: 47.2k, False: 409]
  ------------------
  193|       |
  194|       |            /* If we are now at the end, start a timeout. Also start a timeout if we failed. */
  195|  47.6k|            if (!success || httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (195:17): [True: 409, False: 47.2k]
  |  Branch (195:29): [True: 47.2k, False: 0]
  ------------------
  196|  47.6k|                Super::timeout(HTTP_TIMEOUT_S);
  197|  47.6k|            }
  198|       |
  199|       |            /* Remove onAborted function if we reach the end */
  200|  47.6k|            if (httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (200:17): [True: 47.6k, False: 0]
  ------------------
  201|  47.6k|                httpResponseData->markDone();
  202|       |
  203|       |                /* We need to check if we should close this socket here now */
  204|  47.6k|                if (!Super::isCorked()) {
  ------------------
  |  Branch (204:21): [True: 0, False: 47.6k]
  ------------------
  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|  47.6k|            }
  217|       |
  218|  47.6k|            return success;
  219|  47.6k|        }
  220|  49.7k|    }
_ZN3uWS12HttpResponseILb0EE16writeUnsignedHexEj:
   57|  3.31k|    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.31k|        char buf[16];
   61|  3.31k|        int length = utils::u32toaHex(value, buf);
   62|       |
   63|       |        /* For now we do this copy */
   64|  3.31k|        Super::write(buf, length);
   65|  3.31k|    }
_ZN3uWS12HttpResponseILb0EE9writeMarkEv:
   77|  49.7k|    void writeMark() {
   78|       |        /* Date is always written */
   79|  49.7k|        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|  49.7k|#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
   83|  49.7k|        if (!Super::getLoopData()->noMark) {
  ------------------
  |  Branch (83:13): [True: 49.7k, False: 0]
  ------------------
   84|       |            /* We only expose major version */
   85|  49.7k|            writeHeader("uWebSockets", "20");
   86|  49.7k|        }
   87|  49.7k|#endif
   88|  49.7k|    }
_ZN3uWS12HttpResponseILb0EE15writeUnsigned64Em:
   68|  10.4k|    void writeUnsigned64(uint64_t value) {
   69|  10.4k|        char buf[20];
   70|  10.4k|        int length = utils::u64toa(value, buf);
   71|       |
   72|       |        /* For now we do this copy */
   73|  10.4k|        Super::write(buf, length);
   74|  10.4k|    }
_ZN3uWS12HttpResponseILb0EE5writeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  443|  2.80k|    bool write(std::string_view data) {
  444|  2.80k|        writeStatus(HTTP_200_OK);
  445|       |
  446|       |        /* Do not allow sending 0 chunks, they mark end of response */
  447|  2.80k|        if (!data.length()) {
  ------------------
  |  Branch (447:13): [True: 0, False: 2.80k]
  ------------------
  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.80k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  453|       |
  454|  2.80k|        if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED)) {
  ------------------
  |  Branch (454:13): [True: 2.14k, False: 664]
  ------------------
  455|       |            /* Write mark on first call to write */
  456|  2.14k|            writeMark();
  457|       |
  458|  2.14k|            writeHeader("Transfer-Encoding", "chunked");
  459|  2.14k|            httpResponseData->state |= HttpResponseData<SSL>::HTTP_WRITE_CALLED;
  460|  2.14k|        }
  461|       |
  462|  2.80k|        Super::write("\r\n", 2);
  463|  2.80k|        writeUnsignedHex((unsigned int) data.length());
  464|  2.80k|        Super::write("\r\n", 2);
  465|       |
  466|  2.80k|        auto [written, failed] = Super::write(data.data(), (int) data.length());
  467|  2.80k|        if (failed) {
  ------------------
  |  Branch (467:13): [True: 469, False: 2.34k]
  ------------------
  468|    469|            Super::timeout(HTTP_TIMEOUT_S);
  469|    469|        }
  470|       |
  471|       |        /* If we did not fail the write, accept more */
  472|  2.80k|        return !failed;
  473|  2.80k|    }
_ZN3uWS12HttpResponseILb0EE3endENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEb:
  432|  12.6k|    void end(std::string_view data = {}, bool closeConnection = false) {
  433|  12.6k|        internalEnd(data, data.length(), false, true, closeConnection);
  434|  12.6k|    }
_ZN3uWS12HttpResponseILb0EE9onAbortedEON5ofats13any_invocableIFvvEEE:
  558|  3.15k|    HttpResponse *onAborted(MoveOnlyFunction<void()> &&handler) {
  559|  3.15k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  560|       |
  561|  3.15k|        httpResponseData->onAborted = std::move(handler);
  562|  3.15k|        return this;
  563|  3.15k|    }
_ZN3uWS12HttpResponseILb0EE6onDataEON5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS4_11char_traitsIcEEEEbEEE:
  566|  3.15k|    void onData(MoveOnlyFunction<void(std::string_view, bool)> &&handler) {
  567|  3.15k|        HttpResponseData<SSL> *data = getHttpResponseData();
  568|  3.15k|        data->inStream = std::move(handler);
  569|       |
  570|       |        /* Always reset this counter here */
  571|  3.15k|        data->received_bytes_per_timeout = 0;
  572|  3.15k|    }
_ZN3uWS12HttpResponseILb0EE4corkEON5ofats13any_invocableIFvvEEE:
  497|  1.48k|    HttpResponse *cork(MoveOnlyFunction<void()> &&handler) {
  498|  1.48k|        if (!Super::isCorked() && Super::canCork()) {
  ------------------
  |  Branch (498:13): [True: 0, False: 1.48k]
  |  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.48k|        } else {
  542|       |            /* We are already corked, or can't cork so let's just call the handler */
  543|  1.48k|            handler();
  544|  1.48k|        }
  545|       |
  546|  1.48k|        return this;
  547|  1.48k|    }

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

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

_ZN3uWS4Loop3getEPv:
  111|  75.8k|    static Loop *get(void *existingNativeLoop = nullptr) {
  112|  75.8k|        if (!getLazyLoop().loop) {
  ------------------
  |  Branch (112:13): [True: 5.93k, False: 69.9k]
  ------------------
  113|       |            /* If we are given a native loop pointer we pass that to uSockets and let it deal with it */
  114|  5.93k|            if (existingNativeLoop) {
  ------------------
  |  Branch (114:17): [True: 0, False: 5.93k]
  ------------------
  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|  5.93k|            } else {
  119|  5.93k|                getLazyLoop().loop = create(nullptr);
  120|  5.93k|                getLazyLoop().cleanMe = true;
  121|  5.93k|            }
  122|  5.93k|        }
  123|       |
  124|  75.8k|        return getLazyLoop().loop;
  125|  75.8k|    }
_ZN3uWS4Loop11getLazyLoopEv:
  103|   169k|    static LoopCleaner &getLazyLoop() {
  104|   169k|        static thread_local LoopCleaner lazyLoop;
  105|   169k|        return lazyLoop;
  106|   169k|    }
_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|  5.93k|    static Loop *create(void *hint) {
   77|  5.93k|        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|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((struct us_loop_t *) loop);
   81|  5.93k|        loopData->dateTimer = us_create_timer((struct us_loop_t *) loop, 1, sizeof(LoopData *));
   82|  5.93k|        memcpy(us_timer_ext(loopData->dateTimer), &loopData, sizeof(LoopData *));
   83|  5.93k|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   84|  5.93k|            LoopData *loopData;
   85|  5.93k|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   86|  5.93k|            loopData->updateDate();
   87|  5.93k|        }, 1000, 1000);
   88|       |
   89|  5.93k|        return loop;
   90|  5.93k|    }
_ZN3uWS4Loop8wakeupCbEP9us_loop_t:
   30|  1.43M|    static void wakeupCb(us_loop_t *loop) {
   31|  1.43M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   32|       |
   33|       |        /* Swap current deferQueue */
   34|  1.43M|        loopData->deferMutex.lock();
   35|  1.43M|        int oldDeferQueue = loopData->currentDeferQueue;
   36|  1.43M|        loopData->currentDeferQueue = (loopData->currentDeferQueue + 1) % 2;
   37|  1.43M|        loopData->deferMutex.unlock();
   38|       |
   39|       |        /* Drain the queue */
   40|  1.43M|        for (auto &x : loopData->deferQueues[oldDeferQueue]) {
  ------------------
  |  Branch (40:22): [True: 9.43k, False: 1.43M]
  ------------------
   41|  9.43k|            x();
   42|  9.43k|        }
   43|  1.43M|        loopData->deferQueues[oldDeferQueue].clear();
   44|  1.43M|    }
_ZN3uWS4Loop5preCbEP9us_loop_t:
   46|  1.74M|    static void preCb(us_loop_t *loop) {
   47|  1.74M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   48|       |
   49|  1.74M|        for (auto &p : loopData->preHandlers) {
  ------------------
  |  Branch (49:22): [True: 1.74M, False: 1.74M]
  ------------------
   50|  1.74M|            p.second((Loop *) loop);
   51|  1.74M|        }
   52|  1.74M|    }
_ZN3uWS4Loop6postCbEP9us_loop_t:
   54|  1.74M|    static void postCb(us_loop_t *loop) {
   55|  1.74M|        LoopData *loopData = (LoopData *) us_loop_ext(loop);
   56|       |
   57|  1.74M|        for (auto &p : loopData->postHandlers) {
  ------------------
  |  Branch (57:22): [True: 1.74M, False: 1.74M]
  ------------------
   58|  1.74M|            p.second((Loop *) loop);
   59|  1.74M|        }
   60|       |
   61|       |        /* After every event loop iteration, we must not hold the cork buffer */
   62|  1.74M|        if (loopData->corkedSocket) {
  ------------------
  |  Branch (62:13): [True: 0, False: 1.74M]
  ------------------
   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.74M|    }
_ZN3uWS4Loop4initEv:
   71|  5.93k|    Loop *init() {
   72|  5.93k|        new (us_loop_ext((us_loop_t *) this)) LoopData;
   73|  5.93k|        return this;
   74|  5.93k|    }
_ZZN3uWS4Loop6createEPvENKUlP10us_timer_tE_clES3_:
   83|  1.44M|        us_timer_set(loopData->dateTimer, [](struct us_timer_t *t) {
   84|  1.44M|            LoopData *loopData;
   85|  1.44M|            memcpy(&loopData, us_timer_ext(t), sizeof(LoopData *));
   86|  1.44M|            loopData->updateDate();
   87|  1.44M|        }, 1000, 1000);
_ZN3uWS4Loop9setSilentEb:
  192|  5.93k|    void setSilent(bool silent) {
  193|  5.93k|        ((LoopData *) us_loop_ext((us_loop_t *) this))->noMark = silent;
  194|  5.93k|    }
_ZN3uWS4Loop4freeEv:
  128|  5.93k|    void free() {
  129|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  130|       |
  131|       |        /* Stop and free dateTimer first */
  132|  5.93k|        us_timer_close(loopData->dateTimer);
  133|       |
  134|  5.93k|        loopData->~LoopData();
  135|       |        /* uSockets will track whether this loop is owned by us or a borrowed alien loop */
  136|  5.93k|        us_loop_free((us_loop_t *) this);
  137|       |
  138|       |        /* Reset lazyLoop */
  139|  5.93k|        getLazyLoop().loop = nullptr;
  140|  5.93k|    }
_ZN3uWS4Loop17removePostHandlerEPv:
  149|  5.93k|    void removePostHandler(void *key) {
  150|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  151|       |
  152|  5.93k|        loopData->postHandlers.erase(key);
  153|  5.93k|    }
_ZN3uWS4Loop16removePreHandlerEPv:
  162|  5.93k|    void removePreHandler(void *key) {
  163|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  164|       |
  165|  5.93k|        loopData->preHandlers.erase(key);
  166|  5.93k|    }
_ZN3uWS4Loop14addPostHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  142|  5.93k|    void addPostHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  143|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  144|       |
  145|  5.93k|        loopData->postHandlers.emplace(key, std::move(handler));
  146|  5.93k|    }
_ZN3uWS4Loop13addPreHandlerEPvON5ofats13any_invocableIFvPS0_EEE:
  155|  5.93k|    void addPreHandler(void *key, MoveOnlyFunction<void(Loop *)> &&handler) {
  156|  5.93k|        LoopData *loopData = (LoopData *) us_loop_ext((us_loop_t *) this);
  157|       |
  158|  5.93k|        loopData->preHandlers.emplace(key, std::move(handler));
  159|  5.93k|    }
_ZN3uWS4Loop5deferEON5ofats13any_invocableIFvvEEE:
  169|  10.5k|    void defer(MoveOnlyFunction<void()> &&cb) {
  170|  10.5k|        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|  10.5k|        loopData->deferMutex.lock();
  174|  10.5k|        loopData->deferQueues[loopData->currentDeferQueue].emplace_back(std::move(cb));
  175|  10.5k|        loopData->deferMutex.unlock();
  176|       |
  177|  10.5k|        us_wakeup_loop((us_loop_t *) this);
  178|  10.5k|    }
_ZN3uWS3runEv:
  198|  5.93k|inline void run() {
  199|  5.93k|    Loop::get()->run();
  200|  5.93k|}
_ZN3uWS4Loop3runEv:
  181|  5.93k|    void run() {
  182|  5.93k|        us_loop_run((us_loop_t *) this);
  183|  5.93k|    }

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

_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EDn:
  187|  11.8k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EDn:
  187|  35.6k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EDn:
  187|  17.8k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  35.6k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EDn:
  187|  23.7k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  17.8k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEED2Ev:
  206|  5.93k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE7destroyEv:
  239|  5.93k|  void destroy() noexcept {
  240|  5.93k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 5.93k, False: 0]
  ------------------
  241|  5.93k|      handle_(action::destroy, &storage_, nullptr);
  242|  5.93k|      handle_ = nullptr;
  243|  5.93k|    }
  244|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|  83.0k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|  83.0k|  void destroy() noexcept {
  240|  83.0k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 17.8k, False: 65.2k]
  ------------------
  241|  17.8k|      handle_(action::destroy, &storage_, nullptr);
  242|  17.8k|      handle_ = nullptr;
  243|  17.8k|    }
  244|  83.0k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEED2Ev:
  206|  59.3k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE7destroyEv:
  239|  59.3k|  void destroy() noexcept {
  240|  59.3k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 59.3k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  59.3k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|   118k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|   118k|  void destroy() noexcept {
  240|   118k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.8k, False: 106k]
  ------------------
  241|  11.8k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.8k|      handle_ = nullptr;
  243|  11.8k|    }
  244|   118k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEED2Ev:
  206|   118k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE7destroyEv:
  239|   118k|  void destroy() noexcept {
  240|   118k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.8k, False: 106k]
  ------------------
  241|  11.8k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.8k|      handle_ = nullptr;
  243|  11.8k|    }
  244|   118k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEED2Ev:
  206|  59.3k|  ~any_invocable_impl() { destroy(); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE7destroyEv:
  239|  59.3k|  void destroy() noexcept {
  240|  59.3k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 5.93k, False: 53.4k]
  ------------------
  241|  5.93k|      handle_(action::destroy, &storage_, nullptr);
  242|  5.93k|      handle_ = nullptr;
  243|  5.93k|    }
  244|  59.3k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEED2Ev:
  206|  35.6k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEE7destroyEv:
  239|  35.6k|  void destroy() noexcept {
  240|  35.6k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 35.6k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  35.6k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEED2Ev:
  206|  89.0k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE7destroyEv:
  239|  89.0k|  void destroy() noexcept {
  240|  89.0k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 29.6k, False: 59.3k]
  ------------------
  241|  29.6k|      handle_(action::destroy, &storage_, nullptr);
  242|  29.6k|      handle_ = nullptr;
  243|  29.6k|    }
  244|  89.0k|  }
_ZN5ofats13any_invocableIFvvEEclEv:
  345|  24.4k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  24.4k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  24.4k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4callEv:
  246|  24.4k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  24.4k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  24.4k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEED2Ev:
  206|  1.75M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE7destroyEv:
  239|  1.75M|  void destroy() noexcept {
  240|  1.75M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 27.0k, False: 1.72M]
  ------------------
  241|  27.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  27.0k|      handle_ = nullptr;
  243|  27.0k|    }
  244|  1.75M|  }
_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEclES3_:
  345|  3.48M|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  3.48M|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  3.48M|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE4callES4_:
  246|  3.48M|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  3.48M|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  3.48M|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEED2Ev:
  206|  23.7k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE7destroyEv:
  239|  23.7k|  void destroy() noexcept {
  240|  23.7k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.8k, False: 11.8k]
  ------------------
  241|  11.8k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.8k|      handle_ = nullptr;
  243|  11.8k|    }
  244|  23.7k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EDn:
  187|  5.93k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEED2Ev:
  206|  17.8k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE7destroyEv:
  239|  17.8k|  void destroy() noexcept {
  240|  17.8k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 17.8k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  17.8k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2Ev:
  186|  5.93k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEED2Ev:
  206|   100k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE7destroyEv:
  239|   100k|  void destroy() noexcept {
  240|   100k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 29.6k, False: 71.2k]
  ------------------
  241|  29.6k|      handle_(action::destroy, &storage_, nullptr);
  242|  29.6k|      handle_ = nullptr;
  243|  29.6k|    }
  244|   100k|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2Ev:
  186|  1.63M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2Ev:
  186|  1.66M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2Ev:
  186|  1.64M|  any_invocable_impl() noexcept = default;
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJEEcvbEv:
  228|  1.60M|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEED2Ev:
  206|  1.64M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE7destroyEv:
  239|  1.64M|  void destroy() noexcept {
  240|  1.64M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 3.15k, False: 1.64M]
  ------------------
  241|  3.15k|      handle_(action::destroy, &storage_, nullptr);
  242|  3.15k|      handle_ = nullptr;
  243|  3.15k|    }
  244|  1.64M|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEED2Ev:
  206|  1.68M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE7destroyEv:
  239|  1.68M|  void destroy() noexcept {
  240|  1.68M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 1.68M]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  1.68M|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEclES1_S6_b:
  345|  17.6k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  17.6k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  17.6k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE4callES2_S7_b:
  246|  17.6k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  17.6k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  17.6k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEclES1_S4_:
  345|  54.8k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  54.8k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  54.8k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE4callES2_S5_:
  246|  54.8k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  54.8k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  54.8k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEC2IZZNS2_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS1_S4_E_vEEOT_:
  303|   131k|    any_invocable(F&& f) {                                                     \
  304|   131k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   131k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEEC2Ev:
  186|   131k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE6createIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_JSE_EEEvDpOT0_:
  232|   131k|  void create(Args&&... args) {
  233|   131k|    using hdl = handler<F>;
  234|   131k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   131k|    handle_ = &hdl::handle;
  236|   131k|    call_ = &hdl::call;
  237|   131k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|   131k|    static void create(storage& s, Args&&... args) {
  119|   131k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE12handler_baseINS6_13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESC_SD_iEUlS2_S5_E_EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|   131k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   131k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 131k]
  ------------------
  105|   131k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 131k, False: 0]
  ------------------
  106|   131k|          Derived::destroy(*current);
  107|   131k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 131k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   131k|      }
  112|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E7destroyERNS0_7storageE:
  122|   131k|    static void destroy(storage& s) noexcept {
  123|   131k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   131k|      value.~T();
  125|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E4callERNS0_7storageES2_S5_:
  132|  54.8k|    static R call(storage& s, ArgTypes... args) {
  133|  54.8k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  54.8k|                         std::forward<ArgTypes>(args)...);
  135|  54.8k|    }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEclES7_:
  345|  64.3k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  64.3k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  64.3k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE4callES8_:
  246|  64.3k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  64.3k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  64.3k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEcvbEv:
  228|  20.7k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEED2Ev:
  206|   131k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE7destroyEv:
  239|   131k|  void destroy() noexcept {
  240|   131k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 131k, False: 0]
  ------------------
  241|   131k|      handle_(action::destroy, &storage_, nullptr);
  242|   131k|      handle_ = nullptr;
  243|   131k|    }
  244|   131k|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2IZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS1_S6_bE_vEEOT_:
  303|   131k|    any_invocable(F&& f) {                                                     \
  304|   131k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   131k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEEC2Ev:
  186|   131k|  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|   131k|  void create(Args&&... args) {
  233|   131k|    using hdl = handler<F>;
  234|   131k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   131k|    handle_ = &hdl::handle;
  236|   131k|    call_ = &hdl::call;
  237|   131k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  118|   131k|    static void create(storage& s, Args&&... args) {
  119|   131k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE12handler_baseINS8_13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESF_SG_iEUlS2_S7_bE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  103|   131k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   131k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 131k]
  ------------------
  105|   131k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 131k, False: 0]
  ------------------
  106|   131k|          Derived::destroy(*current);
  107|   131k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 131k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   131k|      }
  112|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E7destroyERNS0_7storageE:
  122|   131k|    static void destroy(storage& s) noexcept {
  123|   131k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   131k|      value.~T();
  125|   131k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E4callERNS0_7storageES2_S7_b:
  132|  17.6k|    static R call(storage& s, ArgTypes... args) {
  133|  17.6k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  17.6k|                         std::forward<ArgTypes>(args)...);
  135|  17.6k|    }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEclES5_b:
  345|  6.01k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  6.01k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  6.01k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4callES6_b:
  246|  6.01k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  6.01k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  6.01k|  }
_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEaSIDnDnEENS1_9enable_ifIXaantsr3stdE9is_same_vIT0_S7_Esr3stdE23is_move_constructible_vISA_EERS7_E4typeEOT_:
  335|  1.48k|    operator=(F&& f) {                                                         \
  336|  1.48k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  1.48k|      return *this;                                                            \
  338|  1.48k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EDn:
  187|  1.48k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE4swapERS7_:
  208|  7.79k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  7.79k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 3.15k, False: 4.63k]
  ------------------
  210|  3.15k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 3.15k]
  ------------------
  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|  3.15k|      } else {
  218|  3.15k|        rhs.swap(*this);
  219|  3.15k|      }
  220|  4.63k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 4.63k, False: 0]
  ------------------
  221|  4.63k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  4.63k|      handle_ = rhs.handle_;
  223|  4.63k|      call_ = rhs.call_;
  224|  4.63k|      rhs.handle_ = nullptr;
  225|  4.63k|    }
  226|  7.79k|  }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEED2Ev:
  206|   131k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE7destroyEv:
  239|   131k|  void destroy() noexcept {
  240|   131k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 131k, False: 0]
  ------------------
  241|   131k|      handle_(action::destroy, &storage_, nullptr);
  242|   131k|      handle_ = nullptr;
  243|   131k|    }
  244|   131k|  }
_ZNK5ofats10any_detail18any_invocable_implIbLb0EJmEEcvbEv:
  228|  2.50k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE4swapERS2_:
  208|  49.7k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  49.7k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 49.7k]
  ------------------
  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|  49.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 49.7k]
  ------------------
  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|  49.7k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2EOS5_:
  188|  11.8k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  11.8k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.8k, False: 0]
  ------------------
  190|  11.8k|      handle_ = rhs.handle_;
  191|  11.8k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.8k|      call_ = rhs.call_;
  193|  11.8k|      rhs.handle_ = nullptr;
  194|  11.8k|    }
  195|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E_vEEOSK_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2Ev:
  186|  11.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_JSN_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  11.8k|    static void create(storage& s, Args&&... args) {
  119|  11.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  11.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  11.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 11.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 5.93k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  5.93k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 5.93k, False: 5.93k]
  ------------------
  109|  5.93k|          Derived::move(*current, *other);
  110|  5.93k|          break;
  111|  11.8k|      }
  112|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E7destroyERNS0_7storageE:
  122|  11.8k|    static void destroy(storage& s) noexcept {
  123|  11.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  11.8k|      value.~T();
  125|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4moveERNS0_7storageESQ_:
  127|  5.93k|    static void move(storage& dst, storage& src) noexcept {
  128|  5.93k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  5.93k|      destroy(src);
  130|  5.93k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4callERNS0_7storageES4_:
  132|  1.74M|    static R call(storage& s, ArgTypes... args) {
  133|  1.74M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.74M|                         std::forward<ArgTypes>(args)...);
  135|  1.74M|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E0_vEEOSK_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_JSN_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  11.8k|    static void create(storage& s, Args&&... args) {
  119|  11.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E0_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  11.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  11.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 11.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 5.93k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  5.93k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 5.93k, False: 5.93k]
  ------------------
  109|  5.93k|          Derived::move(*current, *other);
  110|  5.93k|          break;
  111|  11.8k|      }
  112|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E7destroyERNS0_7storageE:
  122|  11.8k|    static void destroy(storage& s) noexcept {
  123|  11.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  11.8k|      value.~T();
  125|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4moveERNS0_7storageESQ_:
  127|  5.93k|    static void move(storage& dst, storage& src) noexcept {
  128|  5.93k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  5.93k|      destroy(src);
  130|  5.93k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4callERNS0_7storageES4_:
  132|  1.74M|    static R call(storage& s, ArgTypes... args) {
  133|  1.74M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.74M|                         std::forward<ArgTypes>(args)...);
  135|  1.74M|    }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|  74.3k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_iSA_:
  345|  71.8k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  71.8k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  71.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_iSB_:
  246|  71.8k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  71.8k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  71.8k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEcvbEv:
  228|  21.3k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEclES5_SA_SB_:
  345|  16.0k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  16.0k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  16.0k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4callES6_SB_SC_:
  246|  16.0k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  16.0k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  16.0k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|  11.6k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_SA_:
  345|  9.90k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  9.90k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  9.90k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_SB_:
  246|  9.90k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  9.90k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  9.90k|  }
EpollHelloWorld.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEcvbEv:
  228|  42.5k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEclES5_:
  345|  39.8k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  39.8k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  39.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4callES6_:
  246|  39.8k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  39.8k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  39.8k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EOS2_:
  188|  35.9k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  35.9k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 35.9k, False: 0]
  ------------------
  190|  35.9k|      handle_ = rhs.handle_;
  191|  35.9k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  35.9k|      call_ = rhs.call_;
  193|  35.9k|      rhs.handle_ = nullptr;
  194|  35.9k|    }
  195|  35.9k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_vEEOSI_:
  303|  11.8k|    any_invocable(F&& f) {                                                     \
  304|  11.8k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_JSL_EEEvDpOT0_:
  232|  11.8k|  void create(Args&&... args) {
  233|  11.8k|    using hdl = handler<F>;
  234|  11.8k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.8k|    handle_ = &hdl::handle;
  236|  11.8k|    call_ = &hdl::call;
  237|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E6createIJSL_EEEvRNS0_7storageEDpOT_:
  118|  29.6k|    static void create(storage& s, Args&&... args) {
  119|  29.6k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  29.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS7_NSt3__112basic_stringIcNSB_11char_traitsIcEENSB_9allocatorIcEEEEONS7_17WebSocketBehaviorIT_EEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESR_:
  103|  29.6k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  29.6k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 29.6k]
  ------------------
  105|  11.8k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.8k, False: 17.8k]
  ------------------
  106|  11.8k|          Derived::destroy(*current);
  107|  11.8k|          break;
  108|  17.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 17.8k, False: 11.8k]
  ------------------
  109|  17.8k|          Derived::move(*current, *other);
  110|  17.8k|          break;
  111|  29.6k|      }
  112|  29.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E7destroyERNS0_7storageE:
  122|  29.6k|    static void destroy(storage& s) noexcept {
  123|  29.6k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  29.6k|      value.~T();
  125|  29.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4moveERNS0_7storageESO_:
  127|  17.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  17.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  17.8k|      destroy(src);
  130|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4callERNS0_7storageE:
  132|  11.8k|    static R call(storage& s, ArgTypes... args) {
  133|  11.8k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  11.8k|                         std::forward<ArgTypes>(args)...);
  135|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEaSEOS7_:
  197|  23.7k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  23.7k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  23.7k|    return *this;
  200|  23.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EOS7_:
  188|  71.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  71.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.8k, False: 59.3k]
  ------------------
  190|  11.8k|      handle_ = rhs.handle_;
  191|  11.8k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.8k|      call_ = rhs.call_;
  193|  11.8k|      rhs.handle_ = nullptr;
  194|  11.8k|    }
  195|  71.2k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4swapERS7_:
  208|  35.6k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  35.6k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 11.8k, False: 23.7k]
  ------------------
  210|  11.8k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|      } else {
  218|  11.8k|        rhs.swap(*this);
  219|  11.8k|      }
  220|  23.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 11.8k, False: 11.8k]
  ------------------
  221|  11.8k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  11.8k|      handle_ = rhs.handle_;
  223|  11.8k|      call_ = rhs.call_;
  224|  11.8k|      rhs.handle_ = nullptr;
  225|  11.8k|    }
  226|  35.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEaSEOSD_:
  197|  11.8k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  11.8k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  11.8k|    return *this;
  200|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EOSD_:
  188|  35.6k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  35.6k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 5.93k, False: 29.6k]
  ------------------
  190|  5.93k|      handle_ = rhs.handle_;
  191|  5.93k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  5.93k|      call_ = rhs.call_;
  193|  5.93k|      rhs.handle_ = nullptr;
  194|  5.93k|    }
  195|  35.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4swapERSD_:
  208|  17.8k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  17.8k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 5.93k, False: 11.8k]
  ------------------
  210|  5.93k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 5.93k]
  ------------------
  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|  5.93k|      } else {
  218|  5.93k|        rhs.swap(*this);
  219|  5.93k|      }
  220|  11.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 5.93k, False: 5.93k]
  ------------------
  221|  5.93k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  5.93k|      handle_ = rhs.handle_;
  223|  5.93k|      call_ = rhs.call_;
  224|  5.93k|      rhs.handle_ = nullptr;
  225|  5.93k|    }
  226|  17.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEaSEOSC_:
  197|  11.8k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  11.8k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  11.8k|    return *this;
  200|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EOSC_:
  188|  35.6k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  35.6k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 35.6k]
  ------------------
  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|  35.6k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE4swapERSC_:
  208|  11.8k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  11.8k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  47.4k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  47.4k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.8k, False: 35.6k]
  ------------------
  190|  11.8k|      handle_ = rhs.handle_;
  191|  11.8k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.8k|      call_ = rhs.call_;
  193|  11.8k|      rhs.handle_ = nullptr;
  194|  11.8k|    }
  195|  47.4k|  }
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|  11.8k|    operator=(F&& f) {                                                         \
  336|  11.8k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  11.8k|      return *this;                                                            \
  338|  11.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZNS1_12TemplatedAppILb0EE2wsIS3_EEOSF_NS6_12basic_stringIcS9_NS6_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS5_iSA_E_vEEOSN_:
  303|  11.8k|    any_invocable(F&& f) {                                                     \
  304|  11.8k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.8k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  17.8k|  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|  11.8k|  void create(Args&&... args) {
  233|  11.8k|    using hdl = handler<F>;
  234|  11.8k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.8k|    handle_ = &hdl::handle;
  236|  11.8k|    call_ = &hdl::call;
  237|  11.8k|  }
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|  11.8k|    static void create(storage& s, Args&&... args) {
  142|  11.8k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  11.8k|    }
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|  23.7k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  23.7k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 23.7k]
  ------------------
  105|  11.8k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.8k, False: 11.8k]
  ------------------
  106|  11.8k|          Derived::destroy(*current);
  107|  11.8k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 11.8k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  23.7k|      }
  112|  23.7k|    }
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|  11.8k|    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|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  148|  11.8k|      dst.ptr_ = src.ptr_;
  149|  11.8k|    }
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|  37.1k|    static R call(storage& s, ArgTypes... args) {
  152|  37.1k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  37.1k|                         std::forward<ArgTypes>(args)...);
  154|  37.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  23.7k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  23.7k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 11.8k, False: 11.8k]
  ------------------
  210|  11.8k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|      } else {
  218|  11.8k|        rhs.swap(*this);
  219|  11.8k|      }
  220|  11.8k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 11.8k, False: 0]
  ------------------
  221|  11.8k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  11.8k|      handle_ = rhs.handle_;
  223|  11.8k|      call_ = rhs.call_;
  224|  11.8k|      rhs.handle_ = nullptr;
  225|  11.8k|    }
  226|  23.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEaSEOSC_:
  197|  23.7k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  23.7k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  23.7k|    return *this;
  200|  23.7k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  71.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  71.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.8k, False: 59.3k]
  ------------------
  190|  11.8k|      handle_ = rhs.handle_;
  191|  11.8k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.8k|      call_ = rhs.call_;
  193|  11.8k|      rhs.handle_ = nullptr;
  194|  11.8k|    }
  195|  71.2k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  35.6k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  35.6k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 11.8k, False: 23.7k]
  ------------------
  210|  11.8k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 11.8k]
  ------------------
  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|  11.8k|      } else {
  218|  11.8k|        rhs.swap(*this);
  219|  11.8k|      }
  220|  23.7k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 11.8k, False: 11.8k]
  ------------------
  221|  11.8k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  11.8k|      handle_ = rhs.handle_;
  223|  11.8k|      call_ = rhs.call_;
  224|  11.8k|      rhs.handle_ = nullptr;
  225|  11.8k|    }
  226|  35.6k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEcvbEv:
  228|  29.6k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2EOS9_:
  188|  71.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  71.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 71.2k, False: 0]
  ------------------
  190|  71.2k|      handle_ = rhs.handle_;
  191|  71.2k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  71.2k|      call_ = rhs.call_;
  193|  71.2k|      rhs.handle_ = nullptr;
  194|  71.2k|    }
  195|  71.2k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2EOS8_:
  188|  59.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  59.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 59.3k, False: 0]
  ------------------
  190|  59.3k|      handle_ = rhs.handle_;
  191|  59.3k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  59.3k|      call_ = rhs.call_;
  193|  59.3k|      rhs.handle_ = nullptr;
  194|  59.3k|    }
  195|  59.3k|  }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEC2IZNS1_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS0_IFvPNS1_12HttpResponseILb0EEEPNS1_11HttpRequestEEEEbEUlPT_E_vEEOSS_:
  303|  29.6k|    any_invocable(F&& f) {                                                     \
  304|  29.6k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  29.6k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2Ev:
  186|  29.6k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE6createIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_JSV_EEEvDpOT0_:
  232|  29.6k|  void create(Args&&... args) {
  233|  29.6k|    using hdl = handler<F>;
  234|  29.6k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  29.6k|    handle_ = &hdl::handle;
  236|  29.6k|    call_ = &hdl::call;
  237|  29.6k|  }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E6createIJSV_EEEvRNS0_7storageEDpOT_:
  141|  29.6k|    static void create(storage& s, Args&&... args) {
  142|  29.6k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  29.6k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE12handler_baseINS9_13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSE_11char_traitsIcEENSE_9allocatorIcEEEESK_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_EEE6handleENS0_6actionEPNS0_7storageES11_:
  103|   100k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   100k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 100k]
  ------------------
  105|  29.6k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 29.6k, False: 71.2k]
  ------------------
  106|  29.6k|          Derived::destroy(*current);
  107|  29.6k|          break;
  108|  71.2k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 71.2k, False: 29.6k]
  ------------------
  109|  71.2k|          Derived::move(*current, *other);
  110|  71.2k|          break;
  111|   100k|      }
  112|   100k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E7destroyERNS0_7storageE:
  145|  29.6k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4moveERNS0_7storageESY_:
  147|  71.2k|    static void move(storage& dst, storage& src) noexcept {
  148|  71.2k|      dst.ptr_ = src.ptr_;
  149|  71.2k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4callERNS0_7storageES8_:
  151|  64.3k|    static R call(storage& s, ArgTypes... args) {
  152|  64.3k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  64.3k|                         std::forward<ArgTypes>(args)...);
  154|  64.3k|    }
_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEclES4_S6_:
  345|  64.3k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  64.3k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  64.3k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE4callES5_S7_:
  246|  64.3k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  64.3k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  64.3k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EOSA_:
  188|  23.7k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  23.7k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 23.7k]
  ------------------
  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|  23.7k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_vEEOSN_:
  303|  11.8k|    any_invocable(F&& f) {                                                     \
  304|  11.8k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.8k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2Ev:
  186|  29.6k|  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|  11.8k|  void create(Args&&... args) {
  233|  11.8k|    using hdl = handler<F>;
  234|  11.8k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.8k|    handle_ = &hdl::handle;
  236|  11.8k|    call_ = &hdl::call;
  237|  11.8k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E6createIJST_EEEvRNS0_7storageEDpOT_:
  141|  11.8k|    static void create(storage& s, Args&&... args) {
  142|  11.8k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSC_NSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEEONSC_17WebSocketBehaviorIT_EEEUlPSO_PT0_E_EEE6handleENS0_6actionEPNS0_7storageESZ_:
  103|  35.6k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  35.6k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 35.6k]
  ------------------
  105|  11.8k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.8k, False: 23.7k]
  ------------------
  106|  11.8k|          Derived::destroy(*current);
  107|  11.8k|          break;
  108|  23.7k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 23.7k, False: 11.8k]
  ------------------
  109|  23.7k|          Derived::move(*current, *other);
  110|  23.7k|          break;
  111|  35.6k|      }
  112|  35.6k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E7destroyERNS0_7storageE:
  145|  11.8k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4moveERNS0_7storageESW_:
  147|  23.7k|    static void move(storage& dst, storage& src) noexcept {
  148|  23.7k|      dst.ptr_ = src.ptr_;
  149|  23.7k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4callERNS0_7storageES5_S7_:
  151|  49.3k|    static R call(storage& s, ArgTypes... args) {
  152|  49.3k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  49.3k|                         std::forward<ArgTypes>(args)...);
  154|  49.3k|    }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEcvbEv:
  228|  37.1k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats13any_invocableIFvvEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|  49.7k|    operator=(F&& f) {                                                         \
  336|  49.7k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  49.7k|      return *this;                                                            \
  338|  49.7k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EDn:
  187|  49.7k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4swapERS2_:
  208|  56.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  56.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 3.15k, False: 52.9k]
  ------------------
  210|  3.15k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 3.15k]
  ------------------
  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|  3.15k|      } else {
  218|  3.15k|        rhs.swap(*this);
  219|  3.15k|      }
  220|  52.9k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 4.63k, False: 48.3k]
  ------------------
  221|  4.63k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  4.63k|      handle_ = rhs.handle_;
  223|  4.63k|      call_ = rhs.call_;
  224|  4.63k|      rhs.handle_ = nullptr;
  225|  4.63k|    }
  226|  56.1k|  }
_ZN5ofats13any_invocableIFbmEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|  49.7k|    operator=(F&& f) {                                                         \
  336|  49.7k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  49.7k|      return *this;                                                            \
  338|  49.7k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2EDn:
  187|  49.7k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_0vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_0JSA_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_0EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4moveERNS0_7storageESD_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_0E4callERNS0_7storageES5_S7_:
  132|  7.76k|    static R call(storage& s, ArgTypes... args) {
  133|  7.76k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  7.76k|                         std::forward<ArgTypes>(args)...);
  135|  7.76k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_1vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_1JSA_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_1EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4moveERNS0_7storageESD_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_1E4callERNS0_7storageES5_S7_:
  132|  3.15k|    static R call(storage& s, ArgTypes... args) {
  133|  3.15k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  3.15k|                         std::forward<ArgTypes>(args)...);
  135|  3.15k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEaSEOS2_:
  197|  3.15k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  3.15k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  3.15k|    return *this;
  200|  3.15k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_vEEOSA_:
  303|  3.15k|    any_invocable(F&& f) {                                                     \
  304|  3.15k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  3.15k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_JSE_EEEvDpOT0_:
  232|  3.15k|  void create(Args&&... args) {
  233|  3.15k|    using hdl = handler<F>;
  234|  3.15k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  3.15k|    handle_ = &hdl::handle;
  236|  3.15k|    call_ = &hdl::call;
  237|  3.15k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  10.9k|    static void create(storage& s, Args&&... args) {
  119|  10.9k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_EUlvE_EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  10.9k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  10.9k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 10.9k]
  ------------------
  105|  3.15k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 3.15k, False: 7.79k]
  ------------------
  106|  3.15k|          Derived::destroy(*current);
  107|  3.15k|          break;
  108|  7.79k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 7.79k, False: 3.15k]
  ------------------
  109|  7.79k|          Derived::move(*current, *other);
  110|  7.79k|          break;
  111|  10.9k|      }
  112|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E7destroyERNS0_7storageE:
  122|  10.9k|    static void destroy(storage& s) noexcept {
  123|  10.9k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  10.9k|      value.~T();
  125|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4moveERNS0_7storageESH_:
  127|  7.79k|    static void move(storage& dst, storage& src) noexcept {
  128|  7.79k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  7.79k|      destroy(src);
  130|  7.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_EUlvE_E4callERNS0_7storageE:
  132|  1.67k|    static R call(storage& s, ArgTypes... args) {
  133|  1.67k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.67k|                         std::forward<ArgTypes>(args)...);
  135|  1.67k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_vEEOSA_:
  303|  1.67k|    any_invocable(F&& f) {                                                     \
  304|  1.67k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  1.67k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_JSF_EEEvDpOT0_:
  232|  1.67k|  void create(Args&&... args) {
  233|  1.67k|    using hdl = handler<F>;
  234|  1.67k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  1.67k|    handle_ = &hdl::handle;
  236|  1.67k|    call_ = &hdl::call;
  237|  1.67k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  3.35k|    static void create(storage& s, Args&&... args) {
  119|  3.35k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  3.35k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  3.35k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  3.35k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 3.35k]
  ------------------
  105|  1.67k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 1.67k, False: 1.68k]
  ------------------
  106|  1.67k|          Derived::destroy(*current);
  107|  1.67k|          break;
  108|  1.68k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 1.68k, False: 1.67k]
  ------------------
  109|  1.68k|          Derived::move(*current, *other);
  110|  1.68k|          break;
  111|  3.35k|      }
  112|  3.35k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E7destroyERNS0_7storageE:
  122|  3.35k|    static void destroy(storage& s) noexcept {
  123|  3.35k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  3.35k|      value.~T();
  125|  3.35k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4moveERNS0_7storageESI_:
  127|  1.68k|    static void move(storage& dst, storage& src) noexcept {
  128|  1.68k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  1.68k|      destroy(src);
  130|  1.68k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlvE_clEvEUlvE_E4callERNS0_7storageE:
  132|  1.56k|    static R call(storage& s, ArgTypes... args) {
  133|  1.56k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.56k|                         std::forward<ArgTypes>(args)...);
  135|  1.56k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEaSEOS7_:
  197|  3.15k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  3.15k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  3.15k|    return *this;
  200|  3.15k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2EOS7_:
  188|  3.15k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  3.15k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 3.15k, False: 0]
  ------------------
  190|  3.15k|      handle_ = rhs.handle_;
  191|  3.15k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  3.15k|      call_ = rhs.call_;
  193|  3.15k|      rhs.handle_ = nullptr;
  194|  3.15k|    }
  195|  3.15k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvNSt3__117basic_string_viewIcNS1_11char_traitsIcEEEEbEEC2IZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS5_bE_vEEOSF_:
  303|  3.15k|    any_invocable(F&& f) {                                                     \
  304|  3.15k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  3.15k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE6createIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_JSJ_EEEvDpOT0_:
  232|  3.15k|  void create(Args&&... args) {
  233|  3.15k|    using hdl = handler<F>;
  234|  3.15k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  3.15k|    handle_ = &hdl::handle;
  236|  3.15k|    call_ = &hdl::call;
  237|  3.15k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E6createIJSJ_EEEvRNS0_7storageEDpOT_:
  118|  10.9k|    static void create(storage& s, Args&&... args) {
  119|  10.9k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE12handler_baseINS7_13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSC_11HttpRequestEEEDaPT_PT0_EUlS6_bE_EEE6handleENS0_6actionEPNS0_7storageESP_:
  103|  10.9k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  10.9k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 10.9k]
  ------------------
  105|  3.15k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 3.15k, False: 7.79k]
  ------------------
  106|  3.15k|          Derived::destroy(*current);
  107|  3.15k|          break;
  108|  7.79k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 7.79k, False: 3.15k]
  ------------------
  109|  7.79k|          Derived::move(*current, *other);
  110|  7.79k|          break;
  111|  10.9k|      }
  112|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E7destroyERNS0_7storageE:
  122|  10.9k|    static void destroy(storage& s) noexcept {
  123|  10.9k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  10.9k|      value.~T();
  125|  10.9k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4moveERNS0_7storageESM_:
  127|  7.79k|    static void move(storage& dst, storage& src) noexcept {
  128|  7.79k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  7.79k|      destroy(src);
  130|  7.79k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE13small_handlerIZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENSB_11HttpRequestEEEDaPT_PT0_EUlS6_bE_E4callERNS0_7storageES6_b:
  132|  6.01k|    static R call(storage& s, ArgTypes... args) {
  133|  6.01k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  6.01k|                         std::forward<ArgTypes>(args)...);
  135|  6.01k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_vEEOSA_:
  303|  1.48k|    any_invocable(F&& f) {                                                     \
  304|  1.48k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  1.48k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_JSK_EEEvDpOT0_:
  232|  1.48k|  void create(Args&&... args) {
  233|  1.48k|    using hdl = handler<F>;
  234|  1.48k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  1.48k|    handle_ = &hdl::handle;
  236|  1.48k|    call_ = &hdl::call;
  237|  1.48k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E6createIJSK_EEEvRNS0_7storageEDpOT_:
  141|  1.48k|    static void create(storage& s, Args&&... args) {
  142|  1.48k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  1.48k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS7_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSF_11char_traitsIcEEEEbE_clESJ_bEUlvE_EEE6handleENS0_6actionEPNS0_7storageESQ_:
  103|  1.48k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  1.48k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 1.48k]
  ------------------
  105|  1.48k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 1.48k, False: 0]
  ------------------
  106|  1.48k|          Derived::destroy(*current);
  107|  1.48k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 1.48k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|  1.48k|      }
  112|  1.48k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZZ4testvENK3$_1clIN3uWS12HttpResponseILb0EEENS6_11HttpRequestEEEDaPT_PT0_ENKUlNSt3__117basic_string_viewIcNSE_11char_traitsIcEEEEbE_clESI_bEUlvE_E7destroyERNS0_7storageE:
  145|  1.48k|    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.48k|    static R call(storage& s, ArgTypes... args) {
  152|  1.48k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  1.48k|                         std::forward<ArgTypes>(args)...);
  154|  1.48k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZ4testvE3$_2vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZ4testvE3$_2JSA_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E6createIJSA_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13small_handlerIZ4testvE3$_2EEE6handleENS0_6actionEPNS0_7storageESG_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4moveERNS0_7storageESD_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13small_handlerIZ4testvE3$_2E4callERNS0_7storageES5_S7_:
  132|  4.10k|    static R call(storage& s, ArgTypes... args) {
  133|  4.10k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  4.10k|                         std::forward<ArgTypes>(args)...);
  135|  4.10k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_3vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2Ev:
  186|  11.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_3JS9_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_3EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4moveERNS0_7storageESC_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_3E4callERNS0_7storageES6_:
  132|  34.7k|    static R call(storage& s, ArgTypes... args) {
  133|  34.7k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  34.7k|                         std::forward<ArgTypes>(args)...);
  135|  34.7k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEC2IZ4testvE3$_4vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2Ev:
  186|  5.93k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE6createIZ4testvE3$_4JSF_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE12handler_baseINSD_13small_handlerIZ4testvE3$_4EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4moveERNS0_7storageESI_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_4E4callERNS0_7storageES6_SB_SC_:
  132|  16.0k|    static R call(storage& s, ArgTypes... args) {
  133|  16.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  16.0k|                         std::forward<ArgTypes>(args)...);
  135|  16.0k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_5vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_5JS9_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_5EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4moveERNS0_7storageESC_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_5E4callERNS0_7storageES6_:
  132|  5.11k|    static R call(storage& s, ArgTypes... args) {
  133|  5.11k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  5.11k|                         std::forward<ArgTypes>(args)...);
  135|  5.11k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_6vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  11.8k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_6JSE_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_6EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4moveERNS0_7storageESH_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_6E4callERNS0_7storageES6_SB_:
  132|  8.89k|    static R call(storage& s, ArgTypes... args) {
  133|  8.89k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  8.89k|                         std::forward<ArgTypes>(args)...);
  135|  8.89k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_vEEOSA_:
  303|  8.89k|    any_invocable(F&& f) {                                                     \
  304|  8.89k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  8.89k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_JSH_EEEvDpOT0_:
  232|  8.89k|  void create(Args&&... args) {
  233|  8.89k|    using hdl = handler<F>;
  234|  8.89k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  8.89k|    handle_ = &hdl::handle;
  236|  8.89k|    call_ = &hdl::call;
  237|  8.89k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  118|  22.1k|    static void create(storage& s, Args&&... args) {
  119|  22.1k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  22.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSD_11char_traitsIcEEEEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  103|  22.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  22.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 22.1k]
  ------------------
  105|  8.89k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 8.89k, False: 13.2k]
  ------------------
  106|  8.89k|          Derived::destroy(*current);
  107|  8.89k|          break;
  108|  13.2k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 13.2k, False: 8.89k]
  ------------------
  109|  13.2k|          Derived::move(*current, *other);
  110|  13.2k|          break;
  111|  22.1k|      }
  112|  22.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E7destroyERNS0_7storageE:
  122|  22.1k|    static void destroy(storage& s) noexcept {
  123|  22.1k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  22.1k|      value.~T();
  125|  22.1k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4moveERNS0_7storageESK_:
  127|  13.2k|    static void move(storage& dst, storage& src) noexcept {
  128|  13.2k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  13.2k|      destroy(src);
  130|  13.2k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4callERNS0_7storageE:
  132|  7.87k|    static R call(storage& s, ArgTypes... args) {
  133|  7.87k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  7.87k|                         std::forward<ArgTypes>(args)...);
  135|  7.87k|    }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_7vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_7JSE_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_7EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_7E4moveERNS0_7storageESH_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
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|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_8JSE_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  17.8k|    static void create(storage& s, Args&&... args) {
  119|  17.8k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_8EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  17.8k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  17.8k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 17.8k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 11.8k]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|  11.8k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.8k, False: 5.93k]
  ------------------
  109|  11.8k|          Derived::move(*current, *other);
  110|  11.8k|          break;
  111|  17.8k|      }
  112|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E7destroyERNS0_7storageE:
  122|  17.8k|    static void destroy(storage& s) noexcept {
  123|  17.8k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  17.8k|      value.~T();
  125|  17.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4moveERNS0_7storageESH_:
  127|  11.8k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.8k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.8k|      destroy(src);
  130|  11.8k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_8E4callERNS0_7storageES6_iSB_:
  132|  34.7k|    static R call(storage& s, ArgTypes... args) {
  133|  34.7k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  34.7k|                         std::forward<ArgTypes>(args)...);
  135|  34.7k|    }
_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEclES2_:
  345|  5.93k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  5.93k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  5.93k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE4callES3_:
  246|  5.93k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  5.93k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEC2IZ4testvE3$_9vEEOT_:
  303|  5.93k|    any_invocable(F&& f) {                                                     \
  304|  5.93k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.93k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEEC2Ev:
  186|  5.93k|  any_invocable_impl() noexcept = default;
EpollHelloWorld.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE6createIZ4testvE3$_9JS6_EEEvDpOT0_:
  232|  5.93k|  void create(Args&&... args) {
  233|  5.93k|    using hdl = handler<F>;
  234|  5.93k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.93k|    handle_ = &hdl::handle;
  236|  5.93k|    call_ = &hdl::call;
  237|  5.93k|  }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E6createIJS6_EEEvRNS0_7storageEDpOT_:
  118|  5.93k|    static void create(storage& s, Args&&... args) {
  119|  5.93k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  5.93k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE12handler_baseINS4_13small_handlerIZ4testvE3$_9EEE6handleENS0_6actionEPNS0_7storageESC_:
  103|  5.93k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  5.93k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 5.93k]
  ------------------
  105|  5.93k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.93k, False: 0]
  ------------------
  106|  5.93k|          Derived::destroy(*current);
  107|  5.93k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 5.93k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|  5.93k|      }
  112|  5.93k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E7destroyERNS0_7storageE:
  122|  5.93k|    static void destroy(storage& s) noexcept {
  123|  5.93k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  5.93k|      value.~T();
  125|  5.93k|    }
EpollHelloWorld.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE3$_9E4callERNS0_7storageES3_:
  132|  5.93k|    static R call(storage& s, ArgTypes... args) {
  133|  5.93k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  5.93k|                         std::forward<ArgTypes>(args)...);
  135|  5.93k|    }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEaSEOS4_:
  197|  5.93k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  5.93k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  5.93k|    return *this;
  200|  5.93k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2EOS4_:
  188|  5.93k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  5.93k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 5.93k]
  ------------------
  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|  5.93k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE4swapERS4_:
  208|  5.93k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  5.93k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 5.93k]
  ------------------
  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|  5.93k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 5.93k]
  ------------------
  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|  5.93k|  }

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

EpollHelloWorld.cpp:_ZN3uWSL20getDecodedQueryValueENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEES4_:
   28|  4.10k|    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|  4.10k|        if (!key.length()) {
  ------------------
  |  Branch (31:13): [True: 0, False: 4.10k]
  ------------------
   32|      0|            return {};
   33|      0|        }
   34|       |
   35|       |        /* Start with the whole querystring including initial '?' */
   36|  4.10k|        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.97k|        while (queryString.length()) {
  ------------------
  |  Branch (39:16): [True: 4.09k, False: 2.87k]
  ------------------
   40|       |            /* Find boundaries of this statement */
   41|  4.09k|            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.09k|            if (statement.length() && statement[0] == key[0]) {
  ------------------
  |  Branch (44:17): [True: 2.64k, False: 1.45k]
  |  Branch (44:39): [True: 2.33k, False: 314]
  ------------------
   45|       |                /* Equal sign must be present and not in the end of statement */
   46|  2.33k|                auto equality = statement.find('=');
   47|  2.33k|                if (equality != std::string_view::npos) {
  ------------------
  |  Branch (47:21): [True: 2.03k, False: 295]
  ------------------
   48|       |
   49|  2.03k|                    std::string_view statementKey = statement.substr(0, equality);
   50|  2.03k|                    std::string_view statementValue = statement.substr(equality + 1);
   51|       |
   52|       |                    /* String comparison */
   53|  2.03k|                    if (key == statementKey) {
  ------------------
  |  Branch (53:25): [True: 937, False: 1.09k]
  ------------------
   54|       |
   55|       |                        /* Decode value inplace, put null at end if before length of original */
   56|    937|                        char *in = (char *) statementValue.data();
   57|       |
   58|       |                        /* Write offset */
   59|    937|                        unsigned int out = 0;
   60|       |
   61|       |                        /* Walk over all chars until end or null char, decoding in place */
   62|  9.76k|                        for (unsigned int i = 0; i < statementValue.length() && in[i]; i++) {
  ------------------
  |  Branch (62:50): [True: 9.03k, False: 732]
  |  Branch (62:81): [True: 9.03k, False: 0]
  ------------------
   63|       |                                /* Only bother with '%' */
   64|  9.03k|                                if (in[i] == '%') {
  ------------------
  |  Branch (64:37): [True: 2.06k, False: 6.96k]
  ------------------
   65|       |                                    /* Do we have enough data for two bytes hex? */
   66|  2.06k|                                    if (i + 2 >= statementValue.length()) {
  ------------------
  |  Branch (66:41): [True: 205, False: 1.85k]
  ------------------
   67|    205|                                        return {};
   68|    205|                                    }
   69|       |
   70|       |                                    /* Two bytes hex */
   71|  1.85k|                                    int hex1 = in[i + 1] - '0';
   72|  1.85k|                                    if (hex1 > 9) {
  ------------------
  |  Branch (72:41): [True: 1.32k, False: 536]
  ------------------
   73|  1.32k|                                        hex1 &= 223;
   74|  1.32k|                                        hex1 -= 7;
   75|  1.32k|                                    }
   76|       |
   77|  1.85k|                                    int hex2 = in[i + 2] - '0';
   78|  1.85k|                                    if (hex2 > 9) {
  ------------------
  |  Branch (78:41): [True: 980, False: 878]
  ------------------
   79|    980|                                        hex2 &= 223;
   80|    980|                                        hex2 -= 7;
   81|    980|                                    }
   82|       |
   83|  1.85k|                                    *((unsigned char *) &in[out]) = (unsigned char) (hex1 * 16 + hex2);
   84|  1.85k|                                    i += 2;
   85|  6.96k|                                } else {
   86|       |                                    /* Is this even a rule? */
   87|  6.96k|                                    if (in[i] == '+') {
  ------------------
  |  Branch (87:41): [True: 278, False: 6.69k]
  ------------------
   88|    278|                                        in[out] = ' ';
   89|  6.69k|                                    } else {
   90|  6.69k|                                        in[out] = in[i];
   91|  6.69k|                                    }
   92|  6.96k|                                }
   93|       |
   94|       |                                /* We always only write one char */
   95|  8.82k|                                out++;
   96|  8.82k|                        }
   97|       |
   98|       |                        /* If decoded string is shorter than original, put null char to stop next read */
   99|    732|                        if (out < statementValue.length()) {
  ------------------
  |  Branch (99:29): [True: 312, False: 420]
  ------------------
  100|    312|                            in[out] = 0;
  101|    312|                        }
  102|       |
  103|    732|                        return statementValue.substr(0, out);
  104|    937|                    }
  105|  2.03k|                } else {
  106|       |                    /* This querystring is invalid, cannot parse it */
  107|    295|                    return {nullptr, 0};
  108|    295|                }
  109|  2.33k|            }
  110|       |
  111|  2.86k|            queryString.remove_prefix(statement.length() + 1);
  112|  2.86k|        }
  113|       |
  114|       |        /* Nothing found is given as nullptr, while empty string is given as some pointer to the given buffer */
  115|  2.87k|        return {nullptr, 0};
  116|  4.10k|    }

_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEC2ENSt3__18functionIFbPNS_10SubscriberERS1_NS3_13IteratorFlagsEEEE:
  147|  5.93k|    TopicTree(std::function<bool(Subscriber *, T &, IteratorFlags)> cb) : cb(cb) {
  148|       |
  149|  5.93k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE5drainEv:
  268|  3.48M|    void drain() {
  269|  3.48M|        if (drainableSubscribers) {
  ------------------
  |  Branch (269:13): [True: 0, False: 3.48M]
  ------------------
  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|  3.48M|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE14freeSubscriberEPNS_10SubscriberE:
  222|  37.1k|    void freeSubscriber(Subscriber *s) {
  223|       |
  224|       |        /* I guess we call this one even if we are not subscribers */
  225|  37.1k|        if (!s) {
  ------------------
  |  Branch (225:13): [True: 37.1k, False: 0]
  ------------------
  226|  37.1k|            return;
  227|  37.1k|        }
  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.31k|inline int u32toaHex(uint32_t value, char *dst) {
   29|  3.31k|    char palette[] = "0123456789abcdef";
   30|  3.31k|    char temp[10];
   31|  3.31k|    char *p = temp;
   32|  3.52k|    do {
   33|  3.52k|        *p++ = palette[value & 15];
   34|  3.52k|        value >>= 4;
   35|  3.52k|    } while (value > 0);
  ------------------
  |  Branch (35:14): [True: 218, False: 3.31k]
  ------------------
   36|       |
   37|  3.31k|    int ret = (int) (p - temp);
   38|       |
   39|  3.52k|    do {
   40|  3.52k|        *dst++ = *--p;
   41|  3.52k|    } while (p != temp);
  ------------------
  |  Branch (41:14): [True: 218, False: 3.31k]
  ------------------
   42|       |
   43|  3.31k|    return ret;
   44|  3.31k|}
_ZN3uWS5utils6u64toaEmPc:
   46|  10.4k|inline int u64toa(uint64_t value, char *dst) {
   47|  10.4k|    char temp[20];
   48|  10.4k|    char *p = temp;
   49|  16.8k|    do {
   50|  16.8k|        *p++ = (char) ((value % 10) + '0');
   51|  16.8k|        value /= 10;
   52|  16.8k|    } while (value > 0);
  ------------------
  |  Branch (52:14): [True: 6.36k, False: 10.4k]
  ------------------
   53|       |
   54|  10.4k|    int ret = (int) (p - temp);
   55|       |
   56|  16.8k|    do {
   57|  16.8k|        *dst++ = *--p;
   58|  16.8k|    } while (p != temp);
  ------------------
  |  Branch (58:14): [True: 6.36k, False: 10.4k]
  ------------------
   59|       |
   60|  10.4k|    return ret;
   61|  10.4k|}

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

EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6createEPNS_4LoopEP19us_socket_context_tPNS_9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEE:
  420|  11.8k|    static WebSocketContext *create(Loop */*loop*/, us_socket_context_t *parentSocketContext, TopicTree<TopicTreeMessage, TopicTreeBigMessage> *topicTree) {
  421|  11.8k|        WebSocketContext *webSocketContext = (WebSocketContext *) us_create_child_socket_context(SSL, parentSocketContext, sizeof(WebSocketContextData<SSL, USERDATA>));
  422|  11.8k|        if (!webSocketContext) {
  ------------------
  |  Branch (422:13): [True: 0, False: 11.8k]
  ------------------
  423|      0|            return nullptr;
  424|      0|        }
  425|       |
  426|       |        /* Init socket context data */
  427|  11.8k|        new ((WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *)webSocketContext)) WebSocketContextData<SSL, USERDATA>(topicTree);
  428|  11.8k|        return webSocketContext->init();
  429|  11.8k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEv:
  248|  11.8k|    WebSocketContext<SSL, isServer, USERDATA> *init() {
  249|       |        /* Adopting a socket does not trigger open event.
  250|       |         * We arreive as WebSocket with timeout set and
  251|       |         * any backpressure from HTTP state kept. */
  252|       |
  253|       |        /* Handle socket disconnections */
  254|  11.8k|        us_socket_context_on_close(SSL, getSocketContext(), [](auto *s, int code, void *reason) {
  255|       |            /* For whatever reason, if we already have emitted close event, do not emit it again */
  256|  11.8k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  11.8k|            if (!webSocketData->isShuttingDown) {
  258|       |                /* Emit close event */
  259|  11.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  260|       |
  261|       |                /* At this point we iterate all currently held subscriptions and emit an event for all of them */
  262|  11.8k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  263|  11.8k|                    for (Topic *t : webSocketData->subscriber->topics) {
  264|  11.8k|                        webSocketContextData->subscriptionHandler((WebSocket<SSL, isServer, USERDATA> *) s, t->name, (int) t->size() - 1, (int) t->size());
  265|  11.8k|                    }
  266|  11.8k|                }
  267|       |
  268|       |                /* Make sure to unsubscribe from any pub/sub node at exit */
  269|  11.8k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  11.8k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  11.8k|                if (webSocketContextData->closeHandler) {
  273|  11.8k|                    webSocketContextData->closeHandler((WebSocket<SSL, isServer, USERDATA> *) s, 1006, {(char *) reason, (size_t) code});
  274|  11.8k|                }
  275|  11.8k|            }
  276|       |
  277|       |            /* Destruct in-placed data struct */
  278|  11.8k|            webSocketData->~WebSocketData();
  279|       |
  280|  11.8k|            return s;
  281|  11.8k|        });
  282|       |
  283|       |        /* Handle WebSocket data streams */
  284|  11.8k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  285|       |
  286|       |            /* We need the websocket data */
  287|  11.8k|            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|  11.8k|            if (webSocketData->isShuttingDown) {
  292|  11.8k|                return s;
  293|  11.8k|            }
  294|       |
  295|  11.8k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  296|  11.8k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  297|       |
  298|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  299|  11.8k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  300|  11.8k|            webSocketData->hasTimedOut = false;
  301|       |
  302|       |            /* We always cork on data */
  303|  11.8k|            asyncSocket->cork();
  304|       |
  305|       |            /* This parser has virtually no overhead */
  306|  11.8k|            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|  11.8k|            asyncSocket->uncork();
  310|       |
  311|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  312|  11.8k|            if (asyncSocket->getBufferedAmount() == 0) {
  313|       |                /* We can now be in shutdown state */
  314|  11.8k|                if (webSocketData->isShuttingDown) {
  315|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  316|  11.8k|                    asyncSocket->shutdown();
  317|  11.8k|                }
  318|  11.8k|            }
  319|       |
  320|  11.8k|            return s;
  321|  11.8k|        });
  322|       |
  323|       |        /* Handle HTTP write out (note: SSL_read may trigger this spuriously, the app need to handle spurious calls) */
  324|  11.8k|        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|  11.8k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  332|  11.8k|                return s;
  333|  11.8k|            }
  334|       |
  335|  11.8k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  336|  11.8k|            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|  11.8k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  341|       |
  342|       |            /* Drain as much as possible */
  343|  11.8k|            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|  11.8k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  348|  11.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  349|  11.8k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  350|  11.8k|                webSocketData->hasTimedOut = false;
  351|  11.8k|            }
  352|       |
  353|       |            /* Are we in (WebSocket) shutdown mode? */
  354|  11.8k|            if (webSocketData->isShuttingDown) {
  355|       |                /* Check if we just now drained completely */
  356|  11.8k|                if (asyncSocket->getBufferedAmount() == 0) {
  357|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  358|  11.8k|                    asyncSocket->shutdown();
  359|  11.8k|                }
  360|  11.8k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  361|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  362|  11.8k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  363|  11.8k|                if (webSocketContextData->drainHandler) {
  364|  11.8k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  365|  11.8k|                }
  366|       |                /* No need to check for closed here as we leave the handler immediately*/
  367|  11.8k|            }
  368|       |
  369|  11.8k|            return s;
  370|  11.8k|        });
  371|       |
  372|       |        /* Handle FIN, HTTP does not support half-closed sockets, so simply close */
  373|  11.8k|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  374|       |
  375|       |            /* If we get a fin, we just close I guess */
  376|  11.8k|            us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  377|       |
  378|  11.8k|            return s;
  379|  11.8k|        });
  380|       |
  381|  11.8k|        us_socket_context_on_long_timeout(SSL, getSocketContext(), [](auto *s) {
  382|  11.8k|            ((WebSocket<SSL, isServer, USERDATA> *) s)->end(1000, "please reconnect");
  383|       |
  384|  11.8k|            return s;
  385|  11.8k|        });
  386|       |
  387|       |        /* Handle socket timeouts, simply close them so to not confuse client with FIN */
  388|  11.8k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  389|       |
  390|  11.8k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  391|  11.8k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  392|       |
  393|  11.8k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  394|  11.8k|                webSocketData->hasTimedOut = true;
  395|  11.8k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  396|       |                /* Send ping without being corked */
  397|  11.8k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  398|  11.8k|                return s;
  399|  11.8k|            }
  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|  11.8k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  404|       |
  405|  11.8k|            return s;
  406|  11.8k|        });
  407|       |
  408|  11.8k|        return this;
  409|  11.8k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_iPvE_clI11us_socket_tEEDaS4_iS5_:
  254|  37.1k|        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|  37.1k|            WebSocketData *webSocketData = (WebSocketData *) (us_socket_ext(SSL, s));
  257|  37.1k|            if (!webSocketData->isShuttingDown) {
  ------------------
  |  Branch (257:17): [True: 32.1k, False: 5.06k]
  ------------------
  258|       |                /* Emit close event */
  259|  32.1k|                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|  32.1k|                if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (262:21): [True: 0, False: 32.1k]
  |  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|  32.1k|                webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  270|  32.1k|                webSocketData->subscriber = nullptr;
  271|       |
  272|  32.1k|                if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (272:21): [True: 32.1k, False: 0]
  ------------------
  273|  32.1k|                    webSocketContextData->closeHandler((WebSocket<SSL, isServer, USERDATA> *) s, 1006, {(char *) reason, (size_t) code});
  274|  32.1k|                }
  275|  32.1k|            }
  276|       |
  277|       |            /* Destruct in-placed data struct */
  278|  37.1k|            webSocketData->~WebSocketData();
  279|       |
  280|  37.1k|            return s;
  281|  37.1k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_PciE_clI11us_socket_tEEDaS4_S5_i:
  284|  66.2k|        us_socket_context_on_data(SSL, getSocketContext(), [](auto *s, char *data, int length) {
  285|       |
  286|       |            /* We need the websocket data */
  287|  66.2k|            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|  66.2k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (291:17): [True: 429, False: 65.8k]
  ------------------
  292|    429|                return s;
  293|    429|            }
  294|       |
  295|  65.8k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  296|  65.8k|            auto *asyncSocket = (AsyncSocket<SSL> *) s;
  297|       |
  298|       |            /* Every time we get data and not in shutdown state we simply reset the timeout */
  299|  65.8k|            asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  300|  65.8k|            webSocketData->hasTimedOut = false;
  301|       |
  302|       |            /* We always cork on data */
  303|  65.8k|            asyncSocket->cork();
  304|       |
  305|       |            /* This parser has virtually no overhead */
  306|  65.8k|            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|  65.8k|            asyncSocket->uncork();
  310|       |
  311|       |            /* If uncorking was successful and we are in shutdown state then send TCP FIN */
  312|  65.8k|            if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (312:17): [True: 26.1k, False: 39.6k]
  ------------------
  313|       |                /* We can now be in shutdown state */
  314|  26.1k|                if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (314:21): [True: 787, False: 25.3k]
  ------------------
  315|       |                    /* Shutting down a closed socket is handled by uSockets and just fine */
  316|    787|                    asyncSocket->shutdown();
  317|    787|                }
  318|  26.1k|            }
  319|       |
  320|  65.8k|            return s;
  321|  66.2k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE13setCompressedEPNS_14WebSocketStateILb1EEEPv:
   44|  5.34k|    static bool setCompressed(WebSocketState<isServer> */*wState*/, void *s) {
   45|  5.34k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   46|       |
   47|  5.34k|        if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::ENABLED) {
  ------------------
  |  Branch (47:13): [True: 2.10k, False: 3.24k]
  ------------------
   48|  2.10k|            webSocketData->compressionStatus = WebSocketData::CompressionStatus::COMPRESSED_FRAME;
   49|  2.10k|            return true;
   50|  3.24k|        } else {
   51|  3.24k|            return false;
   52|  3.24k|        }
   53|  5.34k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE10forceCloseEPNS_14WebSocketStateILb1EEEPvNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   55|  16.7k|    static void forceClose(WebSocketState<isServer> */*wState*/, void *s, std::string_view reason = {}) {
   56|  16.7k|        us_socket_close(SSL, (us_socket_t *) s, (int) reason.length(), (void *) reason.data());
   57|  16.7k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE19refusePayloadLengthEmPNS_14WebSocketStateILb1EEEPv:
  241|   126k|    static bool refusePayloadLength(uint64_t length, WebSocketState<isServer> */*wState*/, void *s) {
  242|   126k|        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|   126k|        return webSocketContextData->maxPayloadLength < length;
  246|   126k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE14handleFragmentEPcmjibPNS_14WebSocketStateILb1EEEPv:
   60|   103k|    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|   103k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
   63|   103k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) s);
   64|       |
   65|       |        /* Is this a non-control frame? */
   66|   103k|        if (opCode < 3) {
  ------------------
  |  Branch (66:13): [True: 82.1k, False: 21.7k]
  ------------------
   67|       |            /* Did we get everything in one go? */
   68|  82.1k|            if (!remainingBytes && fin && !webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (68:17): [True: 44.1k, False: 37.9k]
  |  Branch (68:36): [True: 25.5k, False: 18.6k]
  |  Branch (68:43): [True: 20.7k, False: 4.76k]
  ------------------
   69|       |
   70|       |                /* Handle compressed frame */
   71|  20.7k|                if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (71:21): [True: 1.01k, False: 19.7k]
  ------------------
   72|  1.01k|                        webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
   73|       |
   74|  1.01k|                        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|  1.01k|                        std::optional<std::string_view> inflatedFrame;
   77|  1.01k|                        if (webSocketData->inflationStream) {
  ------------------
  |  Branch (77:29): [True: 0, False: 1.01k]
  ------------------
   78|      0|                            inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, false);
   79|  1.01k|                        } else {
   80|  1.01k|                            inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {data, length}, webSocketContextData->maxPayloadLength, true);
   81|  1.01k|                        }
   82|       |
   83|  1.01k|                        if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (83:29): [True: 0, False: 1.01k]
  ------------------
   84|      0|                            forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
   85|      0|                            return true;
   86|  1.01k|                        } else {
   87|  1.01k|                            data = (char *) inflatedFrame->data();
   88|  1.01k|                            length = inflatedFrame->length();
   89|  1.01k|                        }
   90|  1.01k|                }
   91|       |
   92|       |                /* Check text messages for Utf-8 validity */
   93|  20.7k|                if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (93:21): [True: 18.6k, False: 2.15k]
  |  Branch (93:36): [True: 3.70k, False: 14.9k]
  ------------------
   94|  3.70k|                    forceClose(webSocketState, s, ERR_INVALID_TEXT);
   95|  3.70k|                    return true;
   96|  3.70k|                }
   97|       |
   98|       |                /* Emit message event & break if we are closed or shut down when returning */
   99|  17.0k|                if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (99:21): [True: 12.0k, False: 5.05k]
  ------------------
  100|  12.0k|                    webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  101|  12.0k|                    if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (101:25): [True: 0, False: 12.0k]
  |  Branch (101:72): [True: 0, False: 12.0k]
  ------------------
  102|      0|                        return true;
  103|      0|                    }
  104|  12.0k|                }
  105|  61.3k|            } else {
  106|       |                /* Allocate fragment buffer up front first time */
  107|  61.3k|                if (!webSocketData->fragmentBuffer.length()) {
  ------------------
  |  Branch (107:21): [True: 17.2k, False: 44.0k]
  ------------------
  108|  17.2k|                    webSocketData->fragmentBuffer.reserve(length + remainingBytes);
  109|  17.2k|                }
  110|       |                /* Fragments forming a big message are not caught until appending them */
  111|  61.3k|                if (refusePayloadLength(length + webSocketData->fragmentBuffer.length(), webSocketState, s)) {
  ------------------
  |  Branch (111:21): [True: 109, False: 61.2k]
  ------------------
  112|    109|                    forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE);
  113|    109|                    return true;
  114|    109|                }
  115|  61.2k|                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|  61.2k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (119:21): [True: 23.3k, False: 37.8k]
  |  Branch (119:40): [True: 4.76k, False: 18.6k]
  ------------------
  120|       |
  121|       |                    /* Handle compression */
  122|  4.76k|                    if (webSocketData->compressionStatus == WebSocketData::CompressionStatus::COMPRESSED_FRAME) {
  ------------------
  |  Branch (122:25): [True: 915, False: 3.84k]
  ------------------
  123|    915|                            webSocketData->compressionStatus = WebSocketData::CompressionStatus::ENABLED;
  124|       |
  125|       |                            /* 9 bytes of padding for libdeflate, 4 for zlib */
  126|    915|                            webSocketData->fragmentBuffer.append("123456789");
  127|       |
  128|    915|                            LoopData *loopData = (LoopData *) us_loop_ext(
  129|    915|                                us_socket_context_loop(SSL,
  130|    915|                                    us_socket_context(SSL, (us_socket_t *) s)
  131|    915|                                )
  132|    915|                            );
  133|       |
  134|       |                            /* Decompress using shared or dedicated decompressor */
  135|    915|                            std::optional<std::string_view> inflatedFrame;
  136|    915|                            if (webSocketData->inflationStream) {
  ------------------
  |  Branch (136:33): [True: 0, False: 915]
  ------------------
  137|      0|                                inflatedFrame = webSocketData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, false);
  138|    915|                            } else {
  139|    915|                                inflatedFrame = loopData->inflationStream->inflate(loopData->zlibContext, {webSocketData->fragmentBuffer.data(), webSocketData->fragmentBuffer.length() - 9}, webSocketContextData->maxPayloadLength, true);
  140|    915|                            }
  141|       |
  142|    915|                            if (!inflatedFrame.has_value()) {
  ------------------
  |  Branch (142:33): [True: 0, False: 915]
  ------------------
  143|      0|                                forceClose(webSocketState, s, ERR_TOO_BIG_MESSAGE_INFLATION);
  144|      0|                                return true;
  145|    915|                            } else {
  146|    915|                                data = (char *) inflatedFrame->data();
  147|    915|                                length = inflatedFrame->length();
  148|    915|                            }
  149|       |
  150|       |
  151|  3.84k|                    } else {
  152|       |                        // reset length and data ptrs
  153|  3.84k|                        length = webSocketData->fragmentBuffer.length();
  154|  3.84k|                        data = webSocketData->fragmentBuffer.data();
  155|  3.84k|                    }
  156|       |
  157|       |                    /* Check text messages for Utf-8 validity */
  158|  4.76k|                    if (opCode == 1 && !protocol::isValidUtf8((unsigned char *) data, length)) {
  ------------------
  |  Branch (158:25): [True: 1.22k, False: 3.53k]
  |  Branch (158:40): [True: 488, False: 738]
  ------------------
  159|    488|                        forceClose(webSocketState, s, ERR_INVALID_TEXT);
  160|    488|                        return true;
  161|    488|                    }
  162|       |
  163|       |                    /* Emit message and check for shutdown or close */
  164|  4.27k|                    if (webSocketContextData->messageHandler) {
  ------------------
  |  Branch (164:25): [True: 4.00k, False: 266]
  ------------------
  165|  4.00k|                        webSocketContextData->messageHandler((WebSocket<SSL, isServer, USERDATA> *) s, std::string_view(data, length), (OpCode) opCode);
  166|  4.00k|                        if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (166:29): [True: 0, False: 4.00k]
  |  Branch (166:76): [True: 0, False: 4.00k]
  ------------------
  167|      0|                            return true;
  168|      0|                        }
  169|  4.00k|                    }
  170|       |
  171|       |                    /* If we shutdown or closed, this will be taken care of elsewhere */
  172|  4.27k|                    webSocketData->fragmentBuffer.clear();
  173|  4.27k|                }
  174|  61.2k|            }
  175|  82.1k|        } else {
  176|       |            /* Control frames need the websocket to send pings, pongs and close */
  177|  21.7k|            WebSocket<SSL, isServer, USERDATA> *webSocket = (WebSocket<SSL, isServer, USERDATA> *) s;
  178|       |
  179|  21.7k|            if (!remainingBytes && fin && !webSocketData->controlTipLength) {
  ------------------
  |  Branch (179:17): [True: 16.7k, False: 4.99k]
  |  Branch (179:36): [True: 16.7k, False: 0]
  |  Branch (179:43): [True: 12.4k, False: 4.27k]
  ------------------
  180|  12.4k|                if (opCode == CLOSE) {
  ------------------
  |  Branch (180:21): [True: 3.02k, False: 9.42k]
  ------------------
  181|  3.02k|                    auto closeFrame = protocol::parseClosePayload(data, length);
  182|  3.02k|                    webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  183|  3.02k|                    return true;
  184|  9.42k|                } else {
  185|  9.42k|                    if (opCode == PING) {
  ------------------
  |  Branch (185:25): [True: 7.88k, False: 1.53k]
  ------------------
  186|  7.88k|                        webSocket->send(std::string_view(data, length), (OpCode) OpCode::PONG);
  187|  7.88k|                        if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (187:29): [True: 7.54k, False: 348]
  ------------------
  188|  7.54k|                            webSocketContextData->pingHandler(webSocket, {data, length});
  189|  7.54k|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (189:33): [True: 0, False: 7.54k]
  |  Branch (189:80): [True: 0, False: 7.54k]
  ------------------
  190|      0|                                return true;
  191|      0|                            }
  192|  7.54k|                        }
  193|  7.88k|                    } else if (opCode == PONG) {
  ------------------
  |  Branch (193:32): [True: 1.53k, False: 0]
  ------------------
  194|  1.53k|                        if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (194:29): [True: 548, False: 990]
  ------------------
  195|    548|                            webSocketContextData->pongHandler(webSocket, {data, length});
  196|    548|                            if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (196:33): [True: 0, False: 548]
  |  Branch (196:80): [True: 0, False: 548]
  ------------------
  197|      0|                                return true;
  198|      0|                            }
  199|    548|                        }
  200|  1.53k|                    }
  201|  9.42k|                }
  202|  12.4k|            } else {
  203|       |                /* Here we never mind any size optimizations as we are in the worst possible path */
  204|  9.26k|                webSocketData->fragmentBuffer.append(data, length);
  205|  9.26k|                webSocketData->controlTipLength += (unsigned int) length;
  206|       |
  207|  9.26k|                if (!remainingBytes && fin) {
  ------------------
  |  Branch (207:21): [True: 4.27k, False: 4.99k]
  |  Branch (207:40): [True: 4.27k, False: 0]
  ------------------
  208|  4.27k|                    char *controlBuffer = (char *) webSocketData->fragmentBuffer.data() + webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength;
  209|  4.27k|                    if (opCode == CLOSE) {
  ------------------
  |  Branch (209:25): [True: 2.03k, False: 2.23k]
  ------------------
  210|  2.03k|                        protocol::CloseFrame closeFrame = protocol::parseClosePayload(controlBuffer, webSocketData->controlTipLength);
  211|  2.03k|                        webSocket->end(closeFrame.code, std::string_view(closeFrame.message, closeFrame.length));
  212|  2.03k|                        return true;
  213|  2.23k|                    } else {
  214|  2.23k|                        if (opCode == PING) {
  ------------------
  |  Branch (214:29): [True: 1.58k, False: 651]
  ------------------
  215|  1.58k|                            webSocket->send(std::string_view(controlBuffer, webSocketData->controlTipLength), (OpCode) OpCode::PONG);
  216|  1.58k|                            if (webSocketContextData->pingHandler) {
  ------------------
  |  Branch (216:33): [True: 1.35k, False: 224]
  ------------------
  217|  1.35k|                                webSocketContextData->pingHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  218|  1.35k|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (218:37): [True: 0, False: 1.35k]
  |  Branch (218:84): [True: 0, False: 1.35k]
  ------------------
  219|      0|                                    return true;
  220|      0|                                }
  221|  1.35k|                            }
  222|  1.58k|                        } else if (opCode == PONG) {
  ------------------
  |  Branch (222:36): [True: 651, False: 0]
  ------------------
  223|    651|                            if (webSocketContextData->pongHandler) {
  ------------------
  |  Branch (223:33): [True: 453, False: 198]
  ------------------
  224|    453|                                webSocketContextData->pongHandler(webSocket, std::string_view(controlBuffer, webSocketData->controlTipLength));
  225|    453|                                if (us_socket_is_closed(SSL, (us_socket_t *) s) || webSocketData->isShuttingDown) {
  ------------------
  |  Branch (225:37): [True: 0, False: 453]
  |  Branch (225:84): [True: 0, False: 453]
  ------------------
  226|      0|                                    return true;
  227|      0|                                }
  228|    453|                            }
  229|    651|                        }
  230|  2.23k|                    }
  231|       |
  232|       |                    /* Same here, we do not care for any particular smart allocation scheme */
  233|  2.23k|                    webSocketData->fragmentBuffer.resize((unsigned int) webSocketData->fragmentBuffer.length() - webSocketData->controlTipLength);
  234|  2.23k|                    webSocketData->controlTipLength = 0;
  235|  2.23k|                }
  236|  9.26k|            }
  237|  21.7k|        }
  238|  94.5k|        return false;
  239|   103k|    }
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E_clI11us_socket_tEEDaS4_:
  324|  8.61k|        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.61k|            if (us_socket_is_shut_down(SSL, (us_socket_t *) s)) {
  ------------------
  |  Branch (331:17): [True: 0, False: 8.61k]
  ------------------
  332|      0|                return s;
  333|      0|            }
  334|       |
  335|  8.61k|            AsyncSocket<SSL> *asyncSocket = (AsyncSocket<SSL> *) s;
  336|  8.61k|            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.61k|            unsigned int backpressure = asyncSocket->getBufferedAmount();
  341|       |
  342|       |            /* Drain as much as possible */
  343|  8.61k|            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.61k|            if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (347:17): [True: 560, False: 8.05k]
  |  Branch (347:34): [True: 5.66k, False: 2.39k]
  ------------------
  348|  6.22k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  349|  6.22k|                asyncSocket->timeout(webSocketContextData->idleTimeoutComponents.first);
  350|  6.22k|                webSocketData->hasTimedOut = false;
  351|  6.22k|            }
  352|       |
  353|       |            /* Are we in (WebSocket) shutdown mode? */
  354|  8.61k|            if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (354:17): [True: 1.65k, False: 6.96k]
  ------------------
  355|       |                /* Check if we just now drained completely */
  356|  1.65k|                if (asyncSocket->getBufferedAmount() == 0) {
  ------------------
  |  Branch (356:21): [True: 591, False: 1.06k]
  ------------------
  357|       |                    /* Now perform the actual TCP/TLS shutdown which was postponed due to backpressure */
  358|    591|                    asyncSocket->shutdown();
  359|    591|                }
  360|  6.96k|            } else if (!backpressure || backpressure > asyncSocket->getBufferedAmount()) {
  ------------------
  |  Branch (360:24): [True: 560, False: 6.40k]
  |  Branch (360:41): [True: 4.80k, False: 1.60k]
  ------------------
  361|       |                /* Only call drain if we actually drained backpressure or if we came here with 0 backpressure */
  362|  5.36k|                auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  363|  5.36k|                if (webSocketContextData->drainHandler) {
  ------------------
  |  Branch (363:21): [True: 5.11k, False: 245]
  ------------------
  364|  5.11k|                    webSocketContextData->drainHandler((WebSocket<SSL, isServer, USERDATA> *) s);
  365|  5.11k|                }
  366|       |                /* No need to check for closed here as we leave the handler immediately*/
  367|  5.36k|            }
  368|       |
  369|  8.61k|            return s;
  370|  8.61k|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E0_clI11us_socket_tEEDaS4_:
  373|    586|        us_socket_context_on_end(SSL, getSocketContext(), [](auto *s) {
  374|       |
  375|       |            /* If we get a fin, we just close I guess */
  376|    586|            us_socket_close(SSL, (us_socket_t *) s, 0, nullptr);
  377|       |
  378|    586|            return s;
  379|    586|        });
EpollHelloWorld.cpp:_ZZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4initEvENKUlPT_E2_clI11us_socket_tEEDaS4_:
  388|  4.97k|        us_socket_context_on_timeout(SSL, getSocketContext(), [](auto *s) {
  389|       |
  390|  4.97k|            auto *webSocketData = (WebSocketData *)(us_socket_ext(SSL, s));
  391|  4.97k|            auto *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, us_socket_context(SSL, (us_socket_t *) s));
  392|       |
  393|  4.97k|            if (webSocketContextData->sendPingsAutomatically && !webSocketData->isShuttingDown && !webSocketData->hasTimedOut) {
  ------------------
  |  Branch (393:17): [True: 4.97k, False: 0]
  |  Branch (393:65): [True: 2.25k, False: 2.72k]
  |  Branch (393:99): [True: 1.94k, False: 311]
  ------------------
  394|  1.94k|                webSocketData->hasTimedOut = true;
  395|  1.94k|                us_socket_timeout(SSL, s, webSocketContextData->idleTimeoutComponents.second);
  396|       |                /* Send ping without being corked */
  397|  1.94k|                ((AsyncSocket<SSL> *) s)->write("\x89\x00", 2);
  398|  1.94k|                return s;
  399|  1.94k|            }
  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.03k|            forceClose(nullptr, s, ERR_WEBSOCKET_TIMEOUT);
  404|       |
  405|  3.03k|            return s;
  406|  4.97k|        });
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE4freeEv:
  411|  11.8k|    void free() {
  412|  11.8k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
  413|  11.8k|        webSocketContextData->~WebSocketContextData();
  414|       |
  415|  11.8k|        us_socket_context_free(SSL, (us_socket_context_t *) this);
  416|  11.8k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE16getSocketContextEv:
   35|  77.1k|    us_socket_context_t *getSocketContext() {
   36|  77.1k|        return (us_socket_context_t *) this;
   37|  77.1k|    }
EpollHelloWorld.cpp:_ZN3uWS16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataE6getExtEv:
   39|   178k|    WebSocketContextData<SSL, USERDATA> *getExt() {
   40|   178k|        return (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL, (us_socket_context_t *) this);
   41|   178k|    }

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

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

EpollHelloWorld.cpp:_ZN3uWSL20negotiateCompressionEbiiNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  144|  4.03k|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.03k|    if (!wantCompression) {
  ------------------
  |  Branch (147:9): [True: 0, False: 4.03k]
  ------------------
  148|      0|        return {false, 0, 0, ""};
  149|      0|    }
  150|       |
  151|  4.03k|    ExtensionsParser ep(offer.data(), offer.length());
  152|       |
  153|  4.03k|    static thread_local std::string response;
  154|  4.03k|    response = "";
  155|       |
  156|  4.03k|    int compressionWindow = wantedCompressionWindow;
  157|  4.03k|    int inflationWindow = wantedInflationWindow;
  158|  4.03k|    bool compression = false;
  159|       |
  160|  4.03k|    if (ep.xWebKitDeflateFrame) {
  ------------------
  |  Branch (160:9): [True: 834, False: 3.20k]
  ------------------
  161|       |        /* We now have compression */
  162|    834|        compression = true;
  163|    834|        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|    834|        if (ep.noContextTakeover) {
  ------------------
  |  Branch (167:13): [True: 300, False: 534]
  ------------------
  168|       |            /* We must fail here right now (fix pub/sub) */
  169|    300|#ifndef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  170|    300|            if (wantedCompressionWindow != 0) {
  ------------------
  |  Branch (170:17): [True: 0, False: 300]
  ------------------
  171|      0|                return {false, 0, 0, ""};
  172|      0|            }
  173|    300|#endif
  174|       |
  175|    300|            compressionWindow = 0;
  176|    300|        }
  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|    834|        if (ep.maxWindowBits && ep.maxWindowBits < compressionWindow) {
  ------------------
  |  Branch (180:13): [True: 303, False: 531]
  |  Branch (180:33): [True: 0, False: 303]
  ------------------
  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|    834|        if (wantedInflationWindow < 15) {
  ------------------
  |  Branch (191:13): [True: 834, False: 0]
  ------------------
  192|    834|            if (!wantedInflationWindow) {
  ------------------
  |  Branch (192:17): [True: 834, False: 0]
  ------------------
  193|    834|                response += "; no_context_takeover";
  194|    834|            } else {
  195|      0|                response += "; max_window_bits=" + std::to_string(wantedInflationWindow);
  196|      0|            }
  197|    834|        }
  198|  3.20k|    } else if (ep.perMessageDeflate) {
  ------------------
  |  Branch (198:16): [True: 1.78k, False: 1.41k]
  ------------------
  199|       |        /* We now have compression */
  200|  1.78k|        compression = true;
  201|  1.78k|        response = "permessage-deflate";
  202|       |
  203|  1.78k|        if (ep.clientNoContextTakeover) {
  ------------------
  |  Branch (203:13): [True: 220, False: 1.56k]
  ------------------
  204|    220|            inflationWindow = 0;
  205|  1.56k|        } else if (ep.clientMaxWindowBits && ep.clientMaxWindowBits != 1) {
  ------------------
  |  Branch (205:20): [True: 604, False: 962]
  |  Branch (205:46): [True: 382, False: 222]
  ------------------
  206|    382|            inflationWindow = std::min<int>(ep.clientMaxWindowBits, inflationWindow);
  207|    382|        }
  208|       |
  209|       |        /* Whatever we have now, write */
  210|  1.78k|        if (inflationWindow < 15) {
  ------------------
  |  Branch (210:13): [True: 1.78k, False: 0]
  ------------------
  211|  1.78k|            if (!inflationWindow || !ep.clientMaxWindowBits) {
  ------------------
  |  Branch (211:17): [True: 1.78k, False: 0]
  |  Branch (211:37): [True: 0, False: 0]
  ------------------
  212|  1.78k|                response += "; client_no_context_takeover";
  213|  1.78k|                inflationWindow = 0;
  214|  1.78k|            } else {
  215|      0|                response += "; client_max_window_bits=" + std::to_string(inflationWindow);
  216|      0|            }
  217|  1.78k|        }
  218|       |
  219|       |        /* This block basically lets the client lower it */
  220|  1.78k|        if (ep.serverNoContextTakeover) {
  ------------------
  |  Branch (220:13): [True: 216, False: 1.57k]
  ------------------
  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.57k|        } else if (ep.serverMaxWindowBits) {
  ------------------
  |  Branch (226:20): [True: 251, False: 1.31k]
  ------------------
  227|    251|            compressionWindow = std::min<int>(ep.serverMaxWindowBits, compressionWindow);
  228|    251|#ifndef UWS_ALLOW_8_WINDOW_BITS
  229|       |            /* Zlib cannot do windowBits=8, memLevel=1 so we raise it up to 9 minimum */
  230|    251|            if (compressionWindow == 8) {
  ------------------
  |  Branch (230:17): [True: 0, False: 251]
  ------------------
  231|      0|                compressionWindow = 9;
  232|      0|            }
  233|    251|#endif
  234|    251|        }
  235|       |
  236|       |        /* Whatever we have now, write */
  237|  1.78k|        if (compressionWindow < 15) {
  ------------------
  |  Branch (237:13): [True: 1.78k, False: 0]
  ------------------
  238|  1.78k|            if (!compressionWindow) {
  ------------------
  |  Branch (238:17): [True: 1.78k, False: 0]
  ------------------
  239|  1.78k|                response += "; server_no_context_takeover";
  240|  1.78k|            } else {
  241|      0|                response += "; server_max_window_bits=" + std::to_string(compressionWindow);
  242|      0|            }
  243|  1.78k|        }
  244|  1.78k|    }
  245|       |
  246|       |    /* A final sanity check (this check does not actually catch too high values!) */
  247|  4.03k|    if ((compressionWindow && compressionWindow < 8) || compressionWindow > 15 || (inflationWindow && inflationWindow < 8) || inflationWindow > 15) {
  ------------------
  |  Branch (247:10): [True: 0, False: 4.03k]
  |  Branch (247:31): [True: 0, False: 0]
  |  Branch (247:57): [True: 0, False: 4.03k]
  |  Branch (247:84): [True: 0, False: 4.03k]
  |  Branch (247:103): [True: 0, False: 0]
  |  Branch (247:127): [True: 0, False: 4.03k]
  ------------------
  248|      0|        return {false, 0, 0, ""};
  249|      0|    }
  250|       |
  251|  4.03k|    return {compression, compressionWindow, inflationWindow, response};
  252|  4.03k|}
_ZN3uWS16ExtensionsParserC2EPKcm:
   93|  4.03k|    ExtensionsParser(const char *data, size_t length) {
   94|  4.03k|        const char *stop = data + length;
   95|  4.03k|        int token = 1;
   96|       |
   97|       |        /* Ignore anything before permessage-deflate or x-webkit-deflate-frame */
   98|  12.0k|        for (; token && token != TOK_PERMESSAGE_DEFLATE && token != TOK_X_WEBKIT_DEFLATE_FRAME; token = getToken(data, stop));
  ------------------
  |  Branch (98:16): [True: 10.6k, False: 1.41k]
  |  Branch (98:25): [True: 8.84k, False: 1.78k]
  |  Branch (98:60): [True: 8.01k, False: 834]
  ------------------
   99|       |
  100|       |        /* What protocol are we going to use? */
  101|  4.03k|        perMessageDeflate = (token == TOK_PERMESSAGE_DEFLATE);
  102|  4.03k|        xWebKitDeflateFrame = (token == TOK_X_WEBKIT_DEFLATE_FRAME);
  103|       |
  104|  15.2k|        while ((token = getToken(data, stop))) {
  ------------------
  |  Branch (104:16): [True: 11.6k, False: 3.60k]
  ------------------
  105|  11.6k|            switch (token) {
  106|    194|            case TOK_X_WEBKIT_DEFLATE_FRAME:
  ------------------
  |  Branch (106:13): [True: 194, False: 11.4k]
  ------------------
  107|       |                /* Duplicates not allowed/supported */
  108|    194|                return;
  109|    495|            case TOK_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (109:13): [True: 495, False: 11.1k]
  ------------------
  110|    495|                noContextTakeover = true;
  111|    495|                break;
  112|    586|            case TOK_MAX_WINDOW_BITS:
  ------------------
  |  Branch (112:13): [True: 586, False: 11.0k]
  ------------------
  113|    586|                maxWindowBits = 1;
  114|    586|                lastInteger = &maxWindowBits;
  115|    586|                break;
  116|    235|            case TOK_PERMESSAGE_DEFLATE:
  ------------------
  |  Branch (116:13): [True: 235, False: 11.3k]
  ------------------
  117|       |                /* Duplicates not allowed/supported */
  118|    235|                return;
  119|    622|            case TOK_SERVER_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (119:13): [True: 622, False: 11.0k]
  ------------------
  120|    622|                serverNoContextTakeover = true;
  121|    622|                break;
  122|    388|            case TOK_CLIENT_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (122:13): [True: 388, False: 11.2k]
  ------------------
  123|    388|                clientNoContextTakeover = true;
  124|    388|                break;
  125|    427|            case TOK_SERVER_MAX_WINDOW_BITS:
  ------------------
  |  Branch (125:13): [True: 427, False: 11.1k]
  ------------------
  126|    427|                serverMaxWindowBits = 1;
  127|    427|                lastInteger = &serverMaxWindowBits;
  128|    427|                break;
  129|    789|            case TOK_CLIENT_MAX_WINDOW_BITS:
  ------------------
  |  Branch (129:13): [True: 789, False: 10.8k]
  ------------------
  130|    789|                clientMaxWindowBits = 1;
  131|    789|                lastInteger = &clientMaxWindowBits;
  132|    789|                break;
  133|  7.88k|            default:
  ------------------
  |  Branch (133:13): [True: 7.88k, False: 3.73k]
  ------------------
  134|  7.88k|                if (token < 0 && lastInteger) {
  ------------------
  |  Branch (134:21): [True: 2.35k, False: 5.53k]
  |  Branch (134:34): [True: 1.86k, False: 495]
  ------------------
  135|  1.86k|                    *lastInteger = -token;
  136|  1.86k|                }
  137|  7.88k|                break;
  138|  11.6k|            }
  139|  11.6k|        }
  140|  4.03k|    }
_ZN3uWS16ExtensionsParser8getTokenERPKcS2_:
   69|  23.2k|    int getToken(const char *&in, const char *stop) {
   70|  49.3k|        while (in != stop && !isalnum(*in)) {
  ------------------
  |  Branch (70:16): [True: 45.4k, False: 3.89k]
  |  Branch (70:30): [True: 26.0k, False: 19.3k]
  ------------------
   71|  26.0k|            in++;
   72|  26.0k|        }
   73|       |
   74|       |        /* Don't care more than this for now */
   75|  23.2k|        static_assert(SHRT_MIN > INT_MIN, "Integer overflow fix is invalid for this platform, report this as a bug!");
   76|       |
   77|  23.2k|        int hashedToken = 0;
   78|   200k|        while (in != stop && (isalnum(*in) || *in == '-' || *in == '_')) {
  ------------------
  |  Branch (78:16): [True: 193k, False: 6.60k]
  |  Branch (78:31): [True: 167k, False: 26.5k]
  |  Branch (78:47): [True: 8.46k, False: 18.1k]
  |  Branch (78:61): [True: 1.47k, False: 16.6k]
  ------------------
   79|   177k|            if (isdigit(*in)) {
  ------------------
  |  Branch (79:17): [True: 17.4k, False: 159k]
  ------------------
   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|  17.4k|                if (hashedToken > SHRT_MIN && hashedToken < SHRT_MAX) {
  ------------------
  |  Branch (82:21): [True: 16.9k, False: 543]
  |  Branch (82:47): [True: 14.5k, False: 2.42k]
  ------------------
   83|  14.5k|                    hashedToken = hashedToken * 10 - (*in - '0');
   84|  14.5k|                }
   85|   159k|            } else {
   86|   159k|                hashedToken += *in;
   87|   159k|            }
   88|   177k|            in++;
   89|   177k|        }
   90|  23.2k|        return hashedToken;
   91|  23.2k|    }

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

EpollHelloWorld.cpp:_ZN3uWS8protocolL13formatMessageILb1EEEmPcPKcmNS_6OpCodeEmbb:
  209|  30.3k|static inline size_t formatMessage(char *dst, const char *src, size_t length, OpCode opCode, size_t reportedLength, bool compressed, bool fin) {
  210|  30.3k|    size_t messageLength;
  211|  30.3k|    size_t headerLength;
  212|  30.3k|    if (reportedLength < 126) {
  ------------------
  |  Branch (212:9): [True: 29.6k, False: 611]
  ------------------
  213|  29.6k|        headerLength = 2;
  214|  29.6k|        dst[1] = (char) reportedLength;
  215|  29.6k|    } else if (reportedLength <= UINT16_MAX) {
  ------------------
  |  Branch (215:16): [True: 611, False: 0]
  ------------------
  216|    611|        headerLength = 4;
  217|    611|        dst[1] = 126;
  218|    611|        uint16_t tmp = cond_byte_swap<uint16_t>((uint16_t) reportedLength);
  219|    611|        memcpy(&dst[2], &tmp, sizeof(uint16_t));
  220|    611|    } 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|  30.3k|    dst[0] = (char) ((fin ? 128 : 0) | ((compressed && opCode) ? SND_COMPRESSED : 0) | (char) opCode);
  ------------------
  |  Branch (227:23): [True: 30.3k, False: 0]
  |  Branch (227:42): [True: 3.68k, False: 26.6k]
  |  Branch (227:56): [True: 3.68k, False: 0]
  ------------------
  228|       |
  229|       |    //printf("%d\n", (int)dst[0]);
  230|       |
  231|  30.3k|    char mask[4];
  232|  30.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|  30.3k|    messageLength = headerLength + length;
  241|  30.3k|    memcpy(dst + headerLength, src, length);
  242|       |
  243|  30.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|  30.3k|    return messageLength;
  257|  30.3k|}
_ZN3uWS8protocol14cond_byte_swapItEET_S2_:
   95|  14.3k|T cond_byte_swap(T value) {
   96|  14.3k|    uint32_t endian_test = 1;
   97|  14.3k|    if (*((char *)&endian_test)) {
  ------------------
  |  Branch (97:9): [True: 14.3k, False: 0]
  ------------------
   98|  14.3k|        union {
   99|  14.3k|            T i;
  100|  14.3k|            uint8_t b[sizeof(T)];
  101|  14.3k|        } src = { value }, dst;
  102|       |
  103|  42.9k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 28.6k, False: 14.3k]
  ------------------
  104|  28.6k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  28.6k|        }
  106|       |
  107|  14.3k|        return dst.i;
  108|  14.3k|    }
  109|      0|    return value;
  110|  14.3k|}
_ZN3uWS8protocol14cond_byte_swapImEET_S2_:
   95|  4.83k|T cond_byte_swap(T value) {
   96|  4.83k|    uint32_t endian_test = 1;
   97|  4.83k|    if (*((char *)&endian_test)) {
  ------------------
  |  Branch (97:9): [True: 4.83k, False: 0]
  ------------------
   98|  4.83k|        union {
   99|  4.83k|            T i;
  100|  4.83k|            uint8_t b[sizeof(T)];
  101|  4.83k|        } src = { value }, dst;
  102|       |
  103|  43.5k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 38.7k, False: 4.83k]
  ------------------
  104|  38.7k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  38.7k|        }
  106|       |
  107|  4.83k|        return dst.i;
  108|  4.83k|    }
  109|      0|    return value;
  110|  4.83k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL16messageFrameSizeEm:
  193|  30.3k|static inline size_t messageFrameSize(size_t messageSize) {
  194|  30.3k|    if (messageSize < 126) {
  ------------------
  |  Branch (194:9): [True: 29.6k, False: 611]
  ------------------
  195|  29.6k|        return 2 + messageSize;
  196|  29.6k|    } else if (messageSize <= UINT16_MAX) {
  ------------------
  |  Branch (196:16): [True: 611, False: 0]
  ------------------
  197|    611|        return 4 + messageSize;
  198|    611|    }
  199|      0|    return 10 + messageSize;
  200|  30.3k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE7consumeEPcjPNS_14WebSocketStateILb1EEEPv:
  458|  65.8k|    static inline void consume(char *src, unsigned int length, WebSocketState<isServer> *wState, void *user) {
  459|  65.8k|        if (wState->state.spillLength) {
  ------------------
  |  Branch (459:13): [True: 2.65k, False: 63.1k]
  ------------------
  460|  2.65k|            src -= wState->state.spillLength;
  461|  2.65k|            length += wState->state.spillLength;
  462|  2.65k|            memcpy(src, wState->state.spill, wState->state.spillLength);
  463|  2.65k|        }
  464|  65.8k|        if (wState->state.wantsHead) {
  ------------------
  |  Branch (464:13): [True: 26.7k, False: 39.0k]
  ------------------
  465|  31.9k|            parseNext:
  466|  78.3k|            while (length >= SHORT_MESSAGE_HEADER) {
  ------------------
  |  Branch (466:20): [True: 74.7k, False: 3.65k]
  ------------------
  467|       |
  468|       |                // invalid reserved bits / invalid opcodes / invalid control frames / set compressed frame
  469|  74.7k|                if ((rsv1(src) && !Impl::setCompressed(wState, user)) || rsv23(src) || (getOpCode(src) > 2 && getOpCode(src) < 8) ||
  ------------------
  |  Branch (469:22): [True: 5.34k, False: 69.3k]
  |  Branch (469:35): [True: 3.24k, False: 2.10k]
  |  Branch (469:74): [True: 1.10k, False: 70.3k]
  |  Branch (469:89): [True: 18.5k, False: 51.8k]
  |  Branch (469:111): [True: 375, False: 18.1k]
  ------------------
  470|  74.7k|                    getOpCode(src) > 10 || (getOpCode(src) > 2 && (!isFin(src) || payloadLength(src) > 125))) {
  ------------------
  |  Branch (470:21): [True: 357, False: 69.6k]
  |  Branch (470:45): [True: 17.8k, False: 51.8k]
  |  Branch (470:68): [True: 280, False: 17.5k]
  |  Branch (470:83): [True: 375, False: 17.1k]
  ------------------
  471|  5.73k|                    Impl::forceClose(wState, user);
  472|  5.73k|                    return;
  473|  5.73k|                }
  474|       |
  475|  69.0k|                if (payloadLength(src) < 126) {
  ------------------
  |  Branch (475:21): [True: 55.2k, False: 13.7k]
  ------------------
  476|  55.2k|                    if (consumeMessage<SHORT_MESSAGE_HEADER, uint8_t>(payloadLength(src), src, length, wState, user)) {
  ------------------
  |  Branch (476:25): [True: 14.8k, False: 40.4k]
  ------------------
  477|  14.8k|                        return;
  478|  14.8k|                    }
  479|  55.2k|                } else if (payloadLength(src) == 126) {
  ------------------
  |  Branch (479:28): [True: 8.61k, False: 5.15k]
  ------------------
  480|  8.61k|                    if (length < MEDIUM_MESSAGE_HEADER) {
  ------------------
  |  Branch (480:25): [True: 265, False: 8.35k]
  ------------------
  481|    265|                        break;
  482|  8.35k|                    } 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: 4.02k, False: 4.33k]
  ------------------
  483|  4.02k|                        return;
  484|  4.02k|                    }
  485|  8.61k|                } else if (length < LONG_MESSAGE_HEADER) {
  ------------------
  |  Branch (485:28): [True: 312, False: 4.83k]
  ------------------
  486|    312|                    break;
  487|  4.83k|                } 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: 3.14k, False: 1.69k]
  ------------------
  488|  3.14k|                    return;
  489|  3.14k|                }
  490|  69.0k|            }
  491|  4.22k|            if (length) {
  ------------------
  |  Branch (491:17): [True: 3.46k, False: 766]
  ------------------
  492|  3.46k|                memcpy(wState->state.spill, src, length);
  493|  3.46k|                wState->state.spillLength = length & 0xf;
  494|  3.46k|            }
  495|  39.0k|        } else if (consumeContinuation(src, length, wState, user)) {
  ------------------
  |  Branch (495:20): [True: 5.18k, False: 33.9k]
  ------------------
  496|  5.18k|            goto parseNext;
  497|  5.18k|        }
  498|  65.8k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE4rsv1EPc:
  274|  74.7k|    static inline bool rsv1(char *frame) {return *((unsigned char *) frame) & 64;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5rsv23EPc:
  273|  71.4k|    static inline bool rsv23(char *frame) {return *((unsigned char *) frame) & 48;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE9getOpCodeEPc:
  271|   358k|    static inline unsigned char getOpCode(char *frame) {return *((unsigned char *) frame) & 15;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5isFinEPc:
  270|   148k|    static inline bool isFin(char *frame) {return *((unsigned char *) frame) & 128;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13payloadLengthEPc:
  272|   155k|    static inline unsigned char payloadLength(char *frame) {return ((unsigned char *) frame)[1] & 127;}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj6EhEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  55.2k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  55.2k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 45.7k, False: 9.43k]
  ------------------
  342|  45.7k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 1.16k, False: 44.6k]
  |  Branch (342:48): [True: 4.92k, False: 39.7k]
  |  Branch (342:74): [True: 247, False: 4.67k]
  ------------------
  343|  1.41k|                Impl::forceClose(wState, user);
  344|  1.41k|                return true;
  345|  1.41k|            }
  346|  44.3k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  44.3k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 219, False: 9.21k]
  ------------------
  348|    219|            Impl::forceClose(wState, user);
  349|    219|            return true;
  350|    219|        }
  351|  53.5k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  53.5k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 0, False: 53.5k]
  ------------------
  354|      0|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|      0|            return true;
  356|      0|        }
  357|       |
  358|  53.5k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 45.4k, False: 8.13k]
  ------------------
  359|  45.4k|            bool fin = isFin(src);
  360|  45.4k|            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|  45.4k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  45.4k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 5.05k, False: 40.4k]
  ------------------
  364|  5.05k|                    return true;
  365|  5.05k|                }
  366|  45.4k|            } 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|  40.4k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 25.5k, False: 14.8k]
  ------------------
  373|  25.5k|                wState->state.opStack--;
  374|  25.5k|            }
  375|       |
  376|  40.4k|            src += payLength + MESSAGE_HEADER;
  377|  40.4k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  40.4k|            wState->state.spillLength = 0;
  379|  40.4k|            return false;
  380|  45.4k|        } else {
  381|  8.13k|            wState->state.spillLength = 0;
  382|  8.13k|            wState->state.wantsHead = false;
  383|  8.13k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  8.13k|            bool fin = isFin(src);
  385|  8.13k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  8.13k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  8.13k|                uint64_t mask;
  388|  8.13k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  8.13k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  8.13k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  8.13k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  8.13k|            }
  393|  8.13k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  8.13k|            return true;
  395|  8.13k|        }
  396|  53.5k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi6EEEvPcj:
  308|  45.4k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  45.4k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  45.4k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  45.4k|            uint64_t maskInt;
  312|  45.4k|            memcpy(&maskInt, mask, 8);
  313|  45.4k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  45.4k|        } else {
  315|  45.4k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  45.4k|            uint32_t maskInt;
  317|  45.4k|            memcpy(&maskInt, mask, 4);
  318|  45.4k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  45.4k|        }
  320|  45.4k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise4ILi6EEEvPcjj:
  297|  45.4k|    static inline void unmaskImprecise4(char *src, uint32_t mask, unsigned int length) {
  298|   148k|        for (unsigned int n = (length >> 2) + 1; n; n--) {
  ------------------
  |  Branch (298:50): [True: 102k, False: 45.4k]
  ------------------
  299|   102k|            uint32_t loaded;
  300|   102k|            memcpy(&loaded, src, 4);
  301|   102k|            loaded ^= mask;
  302|   102k|            memcpy(src - DESTINATION, &loaded, 4);
  303|   102k|            src += 4;
  304|   102k|        }
  305|  45.4k|    }
EpollHelloWorld.cpp:_ZN3uWS8protocolL11isValidUtf8EPhm:
  117|  21.9k|{
  118|  62.2k|    for (unsigned char *e = s + length; s != e; ) {
  ------------------
  |  Branch (118:41): [True: 59.8k, False: 2.36k]
  ------------------
  119|  59.8k|        if (s + 4 <= e) {
  ------------------
  |  Branch (119:13): [True: 44.4k, False: 15.4k]
  ------------------
  120|  44.4k|            uint32_t tmp;
  121|  44.4k|            memcpy(&tmp, s, 4);
  122|  44.4k|            if ((tmp & 0x80808080) == 0) {
  ------------------
  |  Branch (122:17): [True: 38.1k, False: 6.31k]
  ------------------
  123|  38.1k|                s += 4;
  124|  38.1k|                continue;
  125|  38.1k|            }
  126|  44.4k|        }
  127|       |
  128|  27.4k|        while (!(*s & 0x80)) {
  ------------------
  |  Branch (128:16): [True: 19.9k, False: 7.56k]
  ------------------
  129|  19.9k|            if (++s == e) {
  ------------------
  |  Branch (129:17): [True: 14.1k, False: 5.74k]
  ------------------
  130|  14.1k|                return true;
  131|  14.1k|            }
  132|  19.9k|        }
  133|       |
  134|  7.56k|        if ((s[0] & 0x60) == 0x40) {
  ------------------
  |  Branch (134:13): [True: 1.67k, False: 5.89k]
  ------------------
  135|  1.67k|            if (s + 1 >= e || (s[1] & 0xc0) != 0x80 || (s[0] & 0xfe) == 0xc0) {
  ------------------
  |  Branch (135:17): [True: 228, False: 1.44k]
  |  Branch (135:31): [True: 586, False: 860]
  |  Branch (135:56): [True: 194, False: 666]
  ------------------
  136|  1.00k|                return false;
  137|  1.00k|            }
  138|    666|            s += 2;
  139|  5.89k|        } else if ((s[0] & 0xf0) == 0xe0) {
  ------------------
  |  Branch (139:20): [True: 2.38k, False: 3.50k]
  ------------------
  140|  2.38k|            if (s + 2 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (140:17): [True: 245, False: 2.14k]
  |  Branch (140:31): [True: 732, False: 1.41k]
  |  Branch (140:56): [True: 204, False: 1.20k]
  ------------------
  141|  2.38k|                    (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || (s[0] == 0xed && (s[1] & 0xe0) == 0xa0)) {
  ------------------
  |  Branch (141:22): [True: 526, False: 682]
  |  Branch (141:38): [True: 322, False: 204]
  |  Branch (141:65): [True: 400, False: 486]
  |  Branch (141:81): [True: 194, False: 206]
  ------------------
  142|  1.69k|                return false;
  143|  1.69k|            }
  144|    692|            s += 3;
  145|  3.50k|        } else if ((s[0] & 0xf8) == 0xf0) {
  ------------------
  |  Branch (145:20): [True: 2.65k, False: 850]
  ------------------
  146|  2.65k|            if (s + 3 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (146:17): [True: 356, False: 2.30k]
  |  Branch (146:31): [True: 250, False: 2.05k]
  |  Branch (146:56): [True: 267, False: 1.78k]
  |  Branch (146:81): [True: 241, False: 1.54k]
  ------------------
  147|  2.65k|                    (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4) {
  ------------------
  |  Branch (147:22): [True: 516, False: 1.02k]
  |  Branch (147:38): [True: 321, False: 195]
  |  Branch (147:65): [True: 578, False: 643]
  |  Branch (147:81): [True: 217, False: 361]
  |  Branch (147:97): [True: 196, False: 808]
  ------------------
  148|  1.84k|                return false;
  149|  1.84k|            }
  150|    808|            s += 4;
  151|    850|        } else {
  152|    850|            return false;
  153|    850|        }
  154|  7.56k|    }
  155|  2.36k|    return true;
  156|  21.9k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL17parseClosePayloadEPcm:
  164|  5.06k|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|  5.06k|    CloseFrame cf = {1005, nullptr, 0};
  167|  5.06k|    if (length >= 2) {
  ------------------
  |  Branch (167:9): [True: 4.49k, False: 563]
  ------------------
  168|  4.49k|        memcpy(&cf.code, src, 2);
  169|  4.49k|        cf = {cond_byte_swap<uint16_t>(cf.code), src + 2, length - 2};
  170|  4.49k|        if (cf.code < 1000 || cf.code > 4999 || (cf.code > 1011 && cf.code < 4000) ||
  ------------------
  |  Branch (170:13): [True: 492, False: 4.00k]
  |  Branch (170:31): [True: 1.06k, False: 2.94k]
  |  Branch (170:50): [True: 1.62k, False: 1.32k]
  |  Branch (170:68): [True: 476, False: 1.14k]
  ------------------
  171|  4.49k|            (cf.code >= 1004 && cf.code <= 1006) || !isValidUtf8((unsigned char *) cf.message, cf.length)) {
  ------------------
  |  Branch (171:14): [True: 2.02k, False: 445]
  |  Branch (171:33): [True: 412, False: 1.61k]
  |  Branch (171:53): [True: 1.20k, False: 847]
  ------------------
  172|       |            /* Even though we got a WebSocket close frame, it in itself is abnormal */
  173|  3.65k|            return {1006, nullptr, 0};
  174|  3.65k|        }
  175|  4.49k|    }
  176|  1.41k|    return cf;
  177|  5.06k|}
EpollHelloWorld.cpp:_ZN3uWS8protocolL18formatClosePayloadEPctPKcm:
  179|  5.06k|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|  5.06k|    if (code && code != 1005 && code != 1006) {
  ------------------
  |  Branch (181:9): [True: 5.06k, False: 0]
  |  Branch (181:17): [True: 4.49k, False: 563]
  |  Branch (181:33): [True: 847, False: 3.65k]
  ------------------
  182|    847|        code = cond_byte_swap<uint16_t>(code);
  183|    847|        memcpy(dst, &code, 2);
  184|       |        /* It is invalid to pass nullptr to memcpy, even though length is 0 */
  185|    847|        if (message) {
  ------------------
  |  Branch (185:13): [True: 847, False: 0]
  ------------------
  186|    847|            memcpy(dst + 2, message, length);
  187|    847|        }
  188|    847|        return length + 2;
  189|    847|    }
  190|  4.21k|    return 0;
  191|  5.06k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi0EEEvPcmj:
  285|  11.5k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  82.2k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 70.6k, False: 11.5k]
  ------------------
  287|  70.6k|            uint64_t loaded;
  288|  70.6k|            memcpy(&loaded, src, 8);
  289|  70.6k|            loaded ^= mask;
  290|  70.6k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  70.6k|            src += 8;
  292|  70.6k|        }
  293|  11.5k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE10rotateMaskEjPc:
  322|  42.4k|    static inline void rotateMask(unsigned int offset, char *mask) {
  323|  42.4k|        char originalMask[4] = {mask[0], mask[1], mask[2], mask[3]};
  324|  42.4k|        mask[(0 + offset) % 4] = originalMask[0];
  325|  42.4k|        mask[(1 + offset) % 4] = originalMask[1];
  326|  42.4k|        mask[(2 + offset) % 4] = originalMask[2];
  327|  42.4k|        mask[(3 + offset) % 4] = originalMask[3];
  328|  42.4k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj8EtEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  8.35k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  8.35k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 7.31k, False: 1.03k]
  ------------------
  342|  7.31k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 194, False: 7.12k]
  |  Branch (342:48): [True: 1.45k, False: 5.66k]
  |  Branch (342:74): [True: 194, False: 1.26k]
  ------------------
  343|    388|                Impl::forceClose(wState, user);
  344|    388|                return true;
  345|    388|            }
  346|  6.92k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  6.92k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 194, False: 842]
  ------------------
  348|    194|            Impl::forceClose(wState, user);
  349|    194|            return true;
  350|    194|        }
  351|  7.77k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  7.77k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 277, False: 7.49k]
  ------------------
  354|    277|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    277|            return true;
  356|    277|        }
  357|       |
  358|  7.49k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 5.43k, False: 2.05k]
  ------------------
  359|  5.43k|            bool fin = isFin(src);
  360|  5.43k|            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|  5.43k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  5.43k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 1.10k, False: 4.33k]
  ------------------
  364|  1.10k|                    return true;
  365|  1.10k|                }
  366|  5.43k|            } 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|  4.33k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 3.15k, False: 1.17k]
  ------------------
  373|  3.15k|                wState->state.opStack--;
  374|  3.15k|            }
  375|       |
  376|  4.33k|            src += payLength + MESSAGE_HEADER;
  377|  4.33k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  4.33k|            wState->state.spillLength = 0;
  379|  4.33k|            return false;
  380|  5.43k|        } else {
  381|  2.05k|            wState->state.spillLength = 0;
  382|  2.05k|            wState->state.wantsHead = false;
  383|  2.05k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  2.05k|            bool fin = isFin(src);
  385|  2.05k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  2.05k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  2.05k|                uint64_t mask;
  388|  2.05k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  2.05k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  2.05k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  2.05k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  2.05k|            }
  393|  2.05k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  2.05k|            return true;
  395|  2.05k|        }
  396|  7.49k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi8EEEvPcj:
  308|  5.43k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  5.43k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  5.43k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  5.43k|            uint64_t maskInt;
  312|  5.43k|            memcpy(&maskInt, mask, 8);
  313|  5.43k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  5.43k|        } else {
  315|  5.43k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  5.43k|            uint32_t maskInt;
  317|  5.43k|            memcpy(&maskInt, mask, 4);
  318|  5.43k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  5.43k|        }
  320|  5.43k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi8EEEvPcmj:
  285|  5.43k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  22.1k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 16.7k, False: 5.43k]
  ------------------
  287|  16.7k|            uint64_t loaded;
  288|  16.7k|            memcpy(&loaded, src, 8);
  289|  16.7k|            loaded ^= mask;
  290|  16.7k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  16.7k|            src += 8;
  292|  16.7k|        }
  293|  5.43k|    }
_ZN3uWS8protocol8bit_castItEET_Pc:
   87|  8.35k|T bit_cast(char *c) {
   88|  8.35k|    T val;
   89|  8.35k|    memcpy(&val, c, sizeof(T));
   90|  8.35k|    return val;
   91|  8.35k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj14EmEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  4.83k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  4.83k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 3.76k, False: 1.07k]
  ------------------
  342|  3.76k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 194, False: 3.57k]
  |  Branch (342:48): [True: 852, False: 2.72k]
  |  Branch (342:74): [True: 203, False: 649]
  ------------------
  343|    397|                Impl::forceClose(wState, user);
  344|    397|                return true;
  345|    397|            }
  346|  3.37k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  3.37k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 194, False: 878]
  ------------------
  348|    194|            Impl::forceClose(wState, user);
  349|    194|            return true;
  350|    194|        }
  351|  4.24k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  4.24k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 557, False: 3.69k]
  ------------------
  354|    557|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    557|            return true;
  356|    557|        }
  357|       |
  358|  3.69k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 2.30k, False: 1.39k]
  ------------------
  359|  2.30k|            bool fin = isFin(src);
  360|  2.30k|            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|  2.30k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  2.30k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 604, False: 1.69k]
  ------------------
  364|    604|                    return true;
  365|    604|                }
  366|  2.30k|            } 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.69k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 820, False: 877]
  ------------------
  373|    820|                wState->state.opStack--;
  374|    820|            }
  375|       |
  376|  1.69k|            src += payLength + MESSAGE_HEADER;
  377|  1.69k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  1.69k|            wState->state.spillLength = 0;
  379|  1.69k|            return false;
  380|  2.30k|        } else {
  381|  1.39k|            wState->state.spillLength = 0;
  382|  1.39k|            wState->state.wantsHead = false;
  383|  1.39k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  1.39k|            bool fin = isFin(src);
  385|  1.39k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  1.39k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  1.39k|                uint64_t mask;
  388|  1.39k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  1.39k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  1.39k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  1.39k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  1.39k|            }
  393|  1.39k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  1.39k|            return true;
  395|  1.39k|        }
  396|  3.69k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi14EEEvPcj:
  308|  2.30k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  2.30k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  2.30k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  2.30k|            uint64_t maskInt;
  312|  2.30k|            memcpy(&maskInt, mask, 8);
  313|  2.30k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  2.30k|        } else {
  315|  2.30k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  2.30k|            uint32_t maskInt;
  317|  2.30k|            memcpy(&maskInt, mask, 4);
  318|  2.30k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  2.30k|        }
  320|  2.30k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi14EEEvPcmj:
  285|  2.30k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  12.2k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 9.96k, False: 2.30k]
  ------------------
  287|  9.96k|            uint64_t loaded;
  288|  9.96k|            memcpy(&loaded, src, 8);
  289|  9.96k|            loaded ^= mask;
  290|  9.96k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  9.96k|            src += 8;
  292|  9.96k|        }
  293|  2.30k|    }
_ZN3uWS8protocol8bit_castImEET_Pc:
   87|  4.83k|T bit_cast(char *c) {
   88|  4.83k|    T val;
   89|  4.83k|    memcpy(&val, c, sizeof(T));
   90|  4.83k|    return val;
   91|  4.83k|}
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE19consumeContinuationERPcRjPNS_14WebSocketStateILb1EEEPv:
  405|  39.0k|    static inline bool consumeContinuation(char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  406|  39.0k|        if (wState->remainingBytes <= length) {
  ------------------
  |  Branch (406:13): [True: 7.67k, False: 31.4k]
  ------------------
  407|  7.67k|            if (isServer) {
  ------------------
  |  Branch (407:17): [Folded - Ignored]
  ------------------
  408|  7.67k|                unsigned int n = wState->remainingBytes >> 2;
  409|  7.67k|                unmaskInplace(src, src + n * 4, wState->mask);
  410|  22.8k|                for (unsigned int i = 0, s = wState->remainingBytes % 4; i < s; i++) {
  ------------------
  |  Branch (410:74): [True: 15.2k, False: 7.67k]
  ------------------
  411|  15.2k|                    src[n * 4 + i] ^= wState->mask[i];
  412|  15.2k|                }
  413|  7.67k|            }
  414|       |
  415|  7.67k|            if (Impl::handleFragment(src, wState->remainingBytes, 0, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (415:17): [True: 2.49k, False: 5.18k]
  ------------------
  416|  2.49k|                return false;
  417|  2.49k|            }
  418|       |
  419|  5.18k|            if (wState->state.lastFin) {
  ------------------
  |  Branch (419:17): [True: 3.46k, False: 1.72k]
  ------------------
  420|  3.46k|                wState->state.opStack--;
  421|  3.46k|            }
  422|       |
  423|  5.18k|            src += wState->remainingBytes;
  424|  5.18k|            length -= wState->remainingBytes;
  425|  5.18k|            wState->state.wantsHead = true;
  426|  5.18k|            return true;
  427|  31.4k|        } else {
  428|  31.4k|            if (isServer) {
  ------------------
  |  Branch (428:17): [Folded - Ignored]
  ------------------
  429|       |                /* No need to unmask if mask is 0 */
  430|  31.4k|                uint32_t nullmask = 0;
  431|  31.4k|                if (memcmp(wState->mask, &nullmask, sizeof(uint32_t))) {
  ------------------
  |  Branch (431:21): [True: 30.8k, False: 547]
  ------------------
  432|  30.8k|                    if /*constexpr*/ (LIBUS_RECV_BUFFER_LENGTH == length) {
  ------------------
  |  |   22|  30.8k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  |  Branch (432:39): [True: 0, False: 30.8k]
  ------------------
  433|      0|                        unmaskAll(src, wState->mask);
  434|  30.8k|                    } else {
  435|       |                        // Slow path
  436|  30.8k|                        unmaskInplace(src, src + ((length >> 2) + 1) * 4, wState->mask);
  437|  30.8k|                    }
  438|  30.8k|                }
  439|  31.4k|            }
  440|       |
  441|  31.4k|            wState->remainingBytes -= length;
  442|  31.4k|            if (Impl::handleFragment(src, length, wState->remainingBytes, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (442:17): [True: 99, False: 31.3k]
  ------------------
  443|     99|                return false;
  444|     99|            }
  445|       |
  446|  31.3k|            if (isServer && length % 4) {
  ------------------
  |  Branch (446:17): [Folded - Ignored]
  |  Branch (446:29): [True: 30.8k, False: 454]
  ------------------
  447|  30.8k|                rotateMask(4 - (length % 4), wState->mask);
  448|  30.8k|            }
  449|  31.3k|            return false;
  450|  31.4k|        }
  451|  39.0k|    }
EpollHelloWorld.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13unmaskInplaceEPcS5_S5_:
  330|  38.5k|    static inline void unmaskInplace(char *data, char *stop, char *mask) {
  331|  1.12M|        while (data < stop) {
  ------------------
  |  Branch (331:16): [True: 1.08M, False: 38.5k]
  ------------------
  332|  1.08M|            *(data++) ^= mask[0];
  333|  1.08M|            *(data++) ^= mask[1];
  334|  1.08M|            *(data++) ^= mask[2];
  335|  1.08M|            *(data++) ^= mask[3];
  336|  1.08M|        }
  337|  38.5k|    }
_ZN3uWS14WebSocketStateILb1EE5StateC2Ev:
   70|  37.1k|        State() {
   71|  37.1k|            wantsHead = true;
   72|  37.1k|            spillLength = 0;
   73|  37.1k|            opStack = -1;
   74|  37.1k|            lastFin = true;
   75|  37.1k|        }

apple_no_sigpipe:
  259|  1.64M|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|  1.64M|    return fd;
  267|  1.64M|}
bsd_set_nonblocking:
  269|  1.64M|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|  1.64M|    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
  274|  1.64M|#endif
  275|  1.64M|    return fd;
  276|  1.64M|}
bsd_socket_nodelay:
  278|  1.63M|void bsd_socket_nodelay(LIBUS_SOCKET_DESCRIPTOR fd, int enabled) {
  279|  1.63M|    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &enabled, sizeof(enabled));
  280|  1.63M|}
bsd_socket_flush:
  282|    334|void bsd_socket_flush(LIBUS_SOCKET_DESCRIPTOR fd) {
  283|       |    // Linux TCP_CORK has the same underlying corking mechanism as with MSG_MORE
  284|    334|#ifdef TCP_CORK
  285|    334|    int enabled = 0;
  286|    334|    setsockopt(fd, IPPROTO_TCP, TCP_CORK, (void *) &enabled, sizeof(int));
  287|    334|#endif
  288|    334|}
bsd_create_socket:
  290|  11.7k|LIBUS_SOCKET_DESCRIPTOR bsd_create_socket(int domain, int type, int protocol) {
  291|       |    // returns INVALID_SOCKET on error
  292|  11.7k|    int flags = 0;
  293|  11.7k|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  294|  11.7k|    flags = SOCK_CLOEXEC | SOCK_NONBLOCK;
  295|  11.7k|#endif
  296|       |
  297|  11.7k|    LIBUS_SOCKET_DESCRIPTOR created_fd = socket(domain, type | flags, protocol);
  ------------------
  |  |   38|  11.7k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  298|       |
  299|  11.7k|    return bsd_set_nonblocking(apple_no_sigpipe(created_fd));
  300|  11.7k|}
bsd_close_socket:
  302|  1.64M|void bsd_close_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  303|       |#ifdef _WIN32
  304|       |    closesocket(fd);
  305|       |#else
  306|  1.64M|    close(fd);
  307|  1.64M|#endif
  308|  1.64M|}
bsd_shutdown_socket:
  310|  59.1k|void bsd_shutdown_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  311|       |#ifdef _WIN32
  312|       |    shutdown(fd, SD_SEND);
  313|       |#else
  314|  59.1k|    shutdown(fd, SHUT_WR);
  315|  59.1k|#endif
  316|  59.1k|}
bsd_shutdown_socket_read:
  318|    595|void bsd_shutdown_socket_read(LIBUS_SOCKET_DESCRIPTOR fd) {
  319|       |#ifdef _WIN32
  320|       |    shutdown(fd, SD_RECEIVE);
  321|       |#else
  322|    595|    shutdown(fd, SHUT_RD);
  323|    595|#endif
  324|    595|}
internal_finalize_bsd_addr:
  326|  1.67M|void internal_finalize_bsd_addr(struct bsd_addr_t *addr) {
  327|       |    // parse, so to speak, the address
  328|  1.67M|    if (addr->mem.ss_family == AF_INET6) {
  ------------------
  |  Branch (328:9): [True: 1.26M, False: 402k]
  ------------------
  329|  1.26M|        addr->ip = (char *) &((struct sockaddr_in6 *) addr)->sin6_addr;
  330|  1.26M|        addr->ip_length = sizeof(struct in6_addr);
  331|  1.26M|        addr->port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
  332|  1.26M|    } else if (addr->mem.ss_family == AF_INET) {
  ------------------
  |  Branch (332:16): [True: 402k, False: 0]
  ------------------
  333|   402k|        addr->ip = (char *) &((struct sockaddr_in *) addr)->sin_addr;
  334|   402k|        addr->ip_length = sizeof(struct in_addr);
  335|   402k|        addr->port = ntohs(((struct sockaddr_in *) addr)->sin_port);
  336|   402k|    } else {
  337|      0|        addr->ip_length = 0;
  338|      0|        addr->port = -1;
  339|      0|    }
  340|  1.67M|}
bsd_local_addr:
  342|  3.04k|int bsd_local_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  343|  3.04k|    addr->len = sizeof(addr->mem);
  344|  3.04k|    if (getsockname(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (344:9): [True: 3.04k, False: 0]
  ------------------
  345|  3.04k|        return -1;
  346|  3.04k|    }
  347|      0|    internal_finalize_bsd_addr(addr);
  348|      0|    return 0;
  349|  3.04k|}
bsd_remote_addr:
  351|  34.7k|int bsd_remote_addr(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  352|  34.7k|    addr->len = sizeof(addr->mem);
  353|  34.7k|    if (getpeername(fd, (struct sockaddr *) &addr->mem, &addr->len)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 34.7k]
  ------------------
  354|      0|        return -1;
  355|      0|    }
  356|  34.7k|    internal_finalize_bsd_addr(addr);
  357|  34.7k|    return 0;
  358|  34.7k|}
bsd_addr_get_ip:
  360|  1.67M|char *bsd_addr_get_ip(struct bsd_addr_t *addr) {
  361|  1.67M|    return addr->ip;
  362|  1.67M|}
bsd_addr_get_ip_length:
  364|  1.70M|int bsd_addr_get_ip_length(struct bsd_addr_t *addr) {
  365|  1.70M|    return addr->ip_length;
  366|  1.70M|}
bsd_accept_socket:
  373|  3.06M|LIBUS_SOCKET_DESCRIPTOR bsd_accept_socket(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  374|  3.06M|    LIBUS_SOCKET_DESCRIPTOR accepted_fd;
  ------------------
  |  |   38|  3.06M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  375|  3.06M|    addr->len = sizeof(addr->mem);
  376|       |
  377|  3.06M|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  378|       |    // Linux, FreeBSD
  379|  3.06M|    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.06M|    if (accepted_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  3.06M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (387:9): [True: 1.43M, False: 1.63M]
  ------------------
  388|  1.43M|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  1.43M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  389|  1.43M|    }
  390|       |
  391|  1.63M|    internal_finalize_bsd_addr(addr);
  392|       |
  393|  1.63M|    return bsd_set_nonblocking(apple_no_sigpipe(accepted_fd));
  394|  3.06M|}
bsd_recv:
  396|   219k|int bsd_recv(LIBUS_SOCKET_DESCRIPTOR fd, void *buf, int length, int flags) {
  397|   219k|    return recv(fd, buf, length, flags);
  398|   219k|}
bsd_send:
  426|   191k|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|   191k|#ifdef MSG_MORE
  435|       |
  436|       |    // for Linux we do not want signals
  437|   191k|    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|   191k|}
bsd_would_block:
  448|  2.59k|int bsd_would_block() {
  449|       |#ifdef _WIN32
  450|       |    return WSAGetLastError() == WSAEWOULDBLOCK;
  451|       |#else
  452|  2.59k|    return errno == EWOULDBLOCK;// || errno == EAGAIN;
  453|  2.59k|#endif
  454|  2.59k|}
bsd_create_listen_socket:
  458|  5.93k|LIBUS_SOCKET_DESCRIPTOR bsd_create_listen_socket(const char *host, int port, int options) {
  459|  5.93k|    struct addrinfo hints, *result;
  460|  5.93k|    memset(&hints, 0, sizeof(struct addrinfo));
  461|       |
  462|  5.93k|    hints.ai_flags = AI_PASSIVE;
  463|  5.93k|    hints.ai_family = AF_UNSPEC;
  464|  5.93k|    hints.ai_socktype = SOCK_STREAM;
  465|       |
  466|  5.93k|    char port_string[16];
  467|  5.93k|    snprintf(port_string, 16, "%d", port);
  468|       |
  469|  5.93k|    if (getaddrinfo(host, port_string, &hints, &result)) {
  ------------------
  |  Branch (469:9): [True: 0, False: 5.93k]
  ------------------
  470|      0|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      0|#define LIBUS_SOCKET_ERROR -1
  ------------------
  471|      0|    }
  472|       |
  473|  5.93k|    LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   38|  5.93k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
                  LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  474|  5.93k|    struct addrinfo *listenAddr;
  475|  11.8k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (475:39): [True: 5.93k, False: 5.93k]
  |  Branch (475:44): [True: 5.93k, False: 0]
  ------------------
  476|  5.93k|        if (a->ai_family == AF_INET6) {
  ------------------
  |  Branch (476:13): [True: 4.88k, False: 1.04k]
  ------------------
  477|  4.88k|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  478|  4.88k|            listenAddr = a;
  479|  4.88k|        }
  480|  5.93k|    }
  481|       |
  482|  6.98k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (482:39): [True: 5.93k, False: 1.04k]
  |  Branch (482:44): [True: 1.04k, False: 4.88k]
  ------------------
  483|  1.04k|        if (a->ai_family == AF_INET) {
  ------------------
  |  Branch (483:13): [True: 905, False: 141]
  ------------------
  484|    905|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  485|    905|            listenAddr = a;
  486|    905|        }
  487|  1.04k|    }
  488|       |
  489|  5.93k|    if (listenFd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (489:9): [True: 141, False: 5.79k]
  ------------------
  490|    141|        freeaddrinfo(result);
  491|    141|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|    141|#define LIBUS_SOCKET_ERROR -1
  ------------------
  492|    141|    }
  493|       |
  494|  5.79k|    if (port != 0) {
  ------------------
  |  Branch (494:9): [True: 5.79k, 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.79k|    #if /*defined(__linux) &&*/ defined(SO_REUSEPORT)
  506|  5.79k|        if (!(options & LIBUS_LISTEN_EXCLUSIVE_PORT)) {
  ------------------
  |  Branch (506:13): [True: 5.79k, False: 0]
  ------------------
  507|  5.79k|            int optval = 1;
  508|  5.79k|            setsockopt(listenFd, SOL_SOCKET, SO_REUSEPORT, (void *) &optval, sizeof(optval));
  509|  5.79k|        }
  510|  5.79k|    #endif
  511|  5.79k|        int enabled = 1;
  512|  5.79k|        setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &enabled, sizeof(enabled));
  513|  5.79k|#endif
  514|       |
  515|  5.79k|    }
  516|       |    
  517|  5.79k|#ifdef IPV6_V6ONLY
  518|  5.79k|    int disabled = 0;
  519|  5.79k|    setsockopt(listenFd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &disabled, sizeof(disabled));
  520|  5.79k|#endif
  521|       |
  522|  5.79k|    if (bind(listenFd, listenAddr->ai_addr, (socklen_t) listenAddr->ai_addrlen) || listen(listenFd, 512)) {
  ------------------
  |  Branch (522:9): [True: 0, False: 5.79k]
  |  Branch (522:84): [True: 11, False: 5.78k]
  ------------------
  523|     11|        bsd_close_socket(listenFd);
  524|     11|        freeaddrinfo(result);
  525|     11|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     11|#define LIBUS_SOCKET_ERROR -1
  ------------------
  526|     11|    }
  527|       |
  528|  5.78k|    freeaddrinfo(result);
  529|  5.78k|    return listenFd;
  530|  5.79k|}
bsd_create_connect_socket:
  694|  5.93k|LIBUS_SOCKET_DESCRIPTOR bsd_create_connect_socket(const char *host, int port, const char *source_host, int options) {
  695|  5.93k|    struct addrinfo hints, *result;
  696|  5.93k|    memset(&hints, 0, sizeof(struct addrinfo));
  697|  5.93k|    hints.ai_family = AF_UNSPEC;
  698|  5.93k|    hints.ai_socktype = SOCK_STREAM;
  699|       |
  700|  5.93k|    char port_string[16];
  701|  5.93k|    snprintf(port_string, 16, "%d", port);
  702|       |
  703|  5.93k|    if (getaddrinfo(host, port_string, &hints, &result) != 0) {
  ------------------
  |  Branch (703:9): [True: 20, False: 5.91k]
  ------------------
  704|     20|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     20|#define LIBUS_SOCKET_ERROR -1
  ------------------
  705|     20|    }
  706|       |
  707|  5.91k|    LIBUS_SOCKET_DESCRIPTOR fd = bsd_create_socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  ------------------
  |  |   38|  5.91k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  708|  5.91k|    if (fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.91k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (708:9): [True: 2.86k, False: 3.04k]
  ------------------
  709|  2.86k|        freeaddrinfo(result);
  710|  2.86k|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  2.86k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  711|  2.86k|    }
  712|       |
  713|  3.04k|    if (source_host) {
  ------------------
  |  Branch (713:9): [True: 3.04k, False: 0]
  ------------------
  714|  3.04k|        struct addrinfo *interface_result;
  715|  3.04k|        if (!getaddrinfo(source_host, NULL, NULL, &interface_result)) {
  ------------------
  |  Branch (715:13): [True: 3.04k, False: 4]
  ------------------
  716|  3.04k|            int ret = bind(fd, interface_result->ai_addr, (socklen_t) interface_result->ai_addrlen);
  717|  3.04k|            freeaddrinfo(interface_result);
  718|  3.04k|            if (ret == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  3.04k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (718:17): [True: 0, False: 3.04k]
  ------------------
  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|  3.04k|        }
  724|  3.04k|    }
  725|       |
  726|  3.04k|    connect(fd, result->ai_addr, (socklen_t) result->ai_addrlen);
  727|  3.04k|    freeaddrinfo(result);
  728|       |
  729|  3.04k|    return fd;
  730|  3.04k|}

default_is_low_prio_handler:
   25|   219k|int default_is_low_prio_handler(struct us_socket_t *s) {
   26|   219k|    return 0;
   27|   219k|}
us_socket_context_timestamp:
   31|  5.93k|unsigned short us_socket_context_timestamp(int ssl, struct us_socket_context_t *context) {
   32|  5.93k|    return context->timestamp;
   33|  5.93k|}
us_listen_socket_close:
   35|  5.78k|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.78k|    if (!us_socket_is_closed(0, &ls->s)) {
  ------------------
  |  Branch (37:9): [True: 5.78k, False: 0]
  ------------------
   38|  5.78k|        us_internal_socket_context_unlink_listen_socket(ls->s.context, ls);
   39|  5.78k|        us_poll_stop((struct us_poll_t *) &ls->s, ls->s.context->loop);
   40|  5.78k|        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.78k|        ls->s.next = ls->s.context->loop->data.closed_head;
   44|  5.78k|        ls->s.context->loop->data.closed_head = &ls->s;
   45|       |
   46|       |        /* Any socket with prev = context is marked as closed */
   47|  5.78k|        ls->s.prev = (struct us_socket_t *) ls->s.context;
   48|  5.78k|    }
   49|       |
   50|       |    /* We cannot immediately free a listen socket as we can be inside an accept loop */
   51|  5.78k|}
us_internal_socket_context_unlink_listen_socket:
   71|  5.78k|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.78k|    if (ls == (struct us_listen_socket_t *) context->iterator) {
  ------------------
  |  Branch (73:9): [True: 0, False: 5.78k]
  ------------------
   74|      0|        context->iterator = ls->s.next;
   75|      0|    }
   76|       |
   77|  5.78k|    if (ls->s.prev == ls->s.next) {
  ------------------
  |  Branch (77:9): [True: 5.78k, False: 0]
  ------------------
   78|  5.78k|        context->head_listen_sockets = 0;
   79|  5.78k|    } 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.78k|}
us_internal_socket_context_unlink_socket:
   91|  1.67M|void us_internal_socket_context_unlink_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
   92|       |    /* We have to properly update the iterator used to sweep sockets for timeouts */
   93|  1.67M|    if (s == context->iterator) {
  ------------------
  |  Branch (93:9): [True: 5.82k, False: 1.67M]
  ------------------
   94|  5.82k|        context->iterator = s->next;
   95|  5.82k|    }
   96|       |
   97|  1.67M|    if (s->prev == s->next) {
  ------------------
  |  Branch (97:9): [True: 184k, False: 1.49M]
  ------------------
   98|   184k|        context->head_sockets = 0;
   99|  1.49M|    } else {
  100|  1.49M|        if (s->prev) {
  ------------------
  |  Branch (100:13): [True: 837k, False: 655k]
  ------------------
  101|   837k|            s->prev->next = s->next;
  102|   837k|        } else {
  103|   655k|            context->head_sockets = s->next;
  104|   655k|        }
  105|  1.49M|        if (s->next) {
  ------------------
  |  Branch (105:13): [True: 1.48M, False: 11.5k]
  ------------------
  106|  1.48M|            s->next->prev = s->prev;
  107|  1.48M|        }
  108|  1.49M|    }
  109|  1.67M|}
us_internal_socket_context_link_listen_socket:
  112|  5.78k|void us_internal_socket_context_link_listen_socket(struct us_socket_context_t *context, struct us_listen_socket_t *ls) {
  113|  5.78k|    ls->s.context = context;
  114|  5.78k|    ls->s.next = (struct us_socket_t *) context->head_listen_sockets;
  115|  5.78k|    ls->s.prev = 0;
  116|  5.78k|    if (context->head_listen_sockets) {
  ------------------
  |  Branch (116:9): [True: 0, False: 5.78k]
  ------------------
  117|      0|        context->head_listen_sockets->s.prev = &ls->s;
  118|      0|    }
  119|  5.78k|    context->head_listen_sockets = ls;
  120|  5.78k|}
us_internal_socket_context_link_socket:
  123|  1.67M|void us_internal_socket_context_link_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
  124|  1.67M|    s->context = context;
  125|  1.67M|    s->next = context->head_sockets;
  126|  1.67M|    s->prev = 0;
  127|  1.67M|    if (context->head_sockets) {
  ------------------
  |  Branch (127:9): [True: 1.49M, False: 184k]
  ------------------
  128|  1.49M|        context->head_sockets->prev = s;
  129|  1.49M|    }
  130|  1.67M|    context->head_sockets = s;
  131|  1.67M|}
us_socket_context_loop:
  133|  2.17M|struct us_loop_t *us_socket_context_loop(int ssl, struct us_socket_context_t *context) {
  134|  2.17M|    return context->loop;
  135|  2.17M|}
us_socket_context_find_server_name_userdata:
  140|  5.93k|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|  5.93k|    return NULL;
  147|  5.93k|}
us_socket_context_remove_server_name:
  169|  5.93k|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|  5.93k|}
us_socket_context_on_server_name:
  182|  5.93k|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|  5.93k|}
us_socket_context_get_native_handle:
  192|  5.93k|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|  5.93k|    return 0;
  201|  5.93k|}
us_create_socket_context:
  204|  23.7k|struct us_socket_context_t *us_create_socket_context(int ssl, struct us_loop_t *loop, int context_ext_size, struct us_socket_context_options_t options) {
  205|       |#ifndef LIBUS_NO_SSL
  206|       |    if (ssl) {
  207|       |        /* This function will call us, again, with SSL = false and a bigger ext_size */
  208|       |        return (struct us_socket_context_t *) us_internal_create_ssl_socket_context(loop, context_ext_size, options);
  209|       |    }
  210|       |#endif
  211|       |
  212|       |    /* This path is taken once either way - always BEFORE whatever SSL may do LATER.
  213|       |     * context_ext_size will however be modified larger in case of SSL, to hold SSL extensions */
  214|       |
  215|  23.7k|    struct us_socket_context_t *context = malloc(sizeof(struct us_socket_context_t) + context_ext_size);
  216|  23.7k|    context->loop = loop;
  217|  23.7k|    context->head_sockets = 0;
  218|  23.7k|    context->head_listen_sockets = 0;
  219|  23.7k|    context->iterator = 0;
  220|  23.7k|    context->next = 0;
  221|  23.7k|    context->is_low_prio = default_is_low_prio_handler;
  222|       |
  223|       |    /* Begin at 0 */
  224|  23.7k|    context->timestamp = 0;
  225|  23.7k|    context->long_timestamp = 0;
  226|  23.7k|    context->global_tick = 0;
  227|       |
  228|  23.7k|    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|  23.7k|    return context;
  232|  23.7k|}
us_socket_context_free:
  234|  23.7k|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|  23.7k|    us_internal_loop_unlink(context->loop, context);
  247|  23.7k|    free(context);
  248|  23.7k|}
us_socket_context_listen:
  250|  5.93k|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|  5.93k|    LIBUS_SOCKET_DESCRIPTOR listen_socket_fd = bsd_create_listen_socket(host, port, options);
  ------------------
  |  |   38|  5.93k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  258|       |
  259|  5.93k|    if (listen_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (259:9): [True: 152, False: 5.78k]
  ------------------
  260|    152|        return 0;
  261|    152|    }
  262|       |
  263|  5.78k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_listen_socket_t));
  264|  5.78k|    us_poll_init(p, listen_socket_fd, POLL_TYPE_SEMI_SOCKET);
  265|  5.78k|    us_poll_start(p, context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  5.78k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  266|       |
  267|  5.78k|    struct us_listen_socket_t *ls = (struct us_listen_socket_t *) p;
  268|       |
  269|  5.78k|    ls->s.context = context;
  270|  5.78k|    ls->s.timeout = 255;
  271|  5.78k|    ls->s.long_timeout = 255;
  272|  5.78k|    ls->s.low_prio_state = 0;
  273|  5.78k|    ls->s.next = 0;
  274|  5.78k|    us_internal_socket_context_link_listen_socket(context, ls);
  275|       |
  276|  5.78k|    ls->socket_ext_size = socket_ext_size;
  277|       |
  278|  5.78k|    return ls;
  279|  5.93k|}
us_socket_context_connect:
  312|  5.93k|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|  5.93k|    LIBUS_SOCKET_DESCRIPTOR connect_socket_fd = bsd_create_connect_socket(host, port, source_host, options);
  ------------------
  |  |   38|  5.93k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  320|  5.93k|    if (connect_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.93k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (320:9): [True: 2.88k, False: 3.04k]
  ------------------
  321|  2.88k|        return 0;
  322|  2.88k|    }
  323|       |
  324|       |    /* Connect sockets are semi-sockets just like listen sockets */
  325|  3.04k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_socket_t) + socket_ext_size);
  326|  3.04k|    us_poll_init(p, connect_socket_fd, POLL_TYPE_SEMI_SOCKET);
  327|  3.04k|    us_poll_start(p, context->loop, LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  3.04k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  328|       |
  329|  3.04k|    struct us_socket_t *connect_socket = (struct us_socket_t *) p;
  330|       |
  331|       |    /* Link it into context so that timeout fires properly */
  332|  3.04k|    connect_socket->context = context;
  333|  3.04k|    connect_socket->timeout = 255;
  334|  3.04k|    connect_socket->long_timeout = 255;
  335|  3.04k|    connect_socket->low_prio_state = 0;
  336|  3.04k|    us_internal_socket_context_link_socket(context, connect_socket);
  337|       |
  338|  3.04k|    return connect_socket;
  339|  5.93k|}
us_create_child_socket_context:
  370|  11.8k|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|  11.8k|    struct us_socket_context_options_t options = {0};
  379|  11.8k|    return us_create_socket_context(ssl, context->loop, context_ext_size, options);
  380|  11.8k|}
us_socket_context_adopt_socket:
  383|  37.1k|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|  37.1k|    if (us_socket_is_closed(ssl, s)) {
  ------------------
  |  Branch (391:9): [True: 0, False: 37.1k]
  ------------------
  392|      0|        return s;
  393|      0|    }
  394|       |
  395|  37.1k|    if (s->low_prio_state != 1) {
  ------------------
  |  Branch (395:9): [True: 37.1k, False: 0]
  ------------------
  396|       |        /* This properly updates the iterator if in on_timeout */
  397|  37.1k|        us_internal_socket_context_unlink_socket(s->context, s);
  398|  37.1k|    }
  399|       |
  400|  37.1k|    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|  37.1k|    new_s->timeout = 255;
  402|  37.1k|    new_s->long_timeout = 255;
  403|       |
  404|  37.1k|    if (new_s->low_prio_state == 1) {
  ------------------
  |  Branch (404:9): [True: 0, False: 37.1k]
  ------------------
  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|  37.1k|    } else {
  411|  37.1k|        us_internal_socket_context_link_socket(context, new_s);
  412|  37.1k|    }
  413|       |
  414|  37.1k|    return new_s;
  415|  37.1k|}
us_socket_context_on_open:
  417|  11.8k|void us_socket_context_on_open(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_open)(struct us_socket_t *s, int is_client, char *ip, int ip_length)) {
  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|  11.8k|    context->on_open = on_open;
  426|  11.8k|}
us_socket_context_on_close:
  428|  23.7k|void us_socket_context_on_close(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_close)(struct us_socket_t *s, int code, void *reason)) {
  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|  23.7k|    context->on_close = on_close;
  437|  23.7k|}
us_socket_context_on_data:
  439|  23.7k|void us_socket_context_on_data(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_data)(struct us_socket_t *s, char *data, int length)) {
  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|  23.7k|    context->on_data = on_data;
  448|  23.7k|}
us_socket_context_on_writable:
  450|  23.7k|void us_socket_context_on_writable(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_writable)(struct us_socket_t *s)) {
  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|  23.7k|    context->on_writable = on_writable;
  459|  23.7k|}
us_socket_context_on_long_timeout:
  461|  11.8k|void us_socket_context_on_long_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_long_timeout)(struct us_socket_t *)) {
  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|  11.8k|    context->on_socket_long_timeout = on_long_timeout;
  470|  11.8k|}
us_socket_context_on_timeout:
  472|  17.8k|void us_socket_context_on_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_timeout)(struct us_socket_t *)) {
  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|  17.8k|    context->on_socket_timeout = on_timeout;
  481|  17.8k|}
us_socket_context_on_end:
  483|  23.7k|void us_socket_context_on_end(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_end)(struct us_socket_t *)) {
  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|  23.7k|    context->on_end = on_end;
  492|  23.7k|}
us_socket_context_on_connect_error:
  494|  5.93k|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|  5.93k|    context->on_connect_error = on_connect_error;
  503|  5.93k|}
us_socket_context_ext:
  505|  4.07M|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|  4.07M|    return context + 1;
  513|  4.07M|}

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

us_internal_loop_data_init:
   26|  5.93k|    void (*pre_cb)(struct us_loop_t *loop), void (*post_cb)(struct us_loop_t *loop)) {
   27|  5.93k|    loop->data.sweep_timer = us_create_timer(loop, 1, 0);
   28|  5.93k|    loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   22|  5.93k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
                  loop->data.recv_buf = malloc(LIBUS_RECV_BUFFER_LENGTH + LIBUS_RECV_BUFFER_PADDING * 2);
  ------------------
  |  |   26|  5.93k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
   29|  5.93k|    loop->data.ssl_data = 0;
   30|  5.93k|    loop->data.head = 0;
   31|  5.93k|    loop->data.iterator = 0;
   32|  5.93k|    loop->data.closed_head = 0;
   33|  5.93k|    loop->data.low_prio_head = 0;
   34|  5.93k|    loop->data.low_prio_budget = 0;
   35|       |
   36|  5.93k|    loop->data.pre_cb = pre_cb;
   37|  5.93k|    loop->data.post_cb = post_cb;
   38|  5.93k|    loop->data.iteration_nr = 0;
   39|       |
   40|  5.93k|    loop->data.wakeup_async = us_internal_create_async(loop, 1, 0);
   41|  5.93k|    us_internal_async_set(loop->data.wakeup_async, (void (*)(struct us_internal_async *)) wakeup_cb);
   42|  5.93k|}
us_internal_loop_data_free:
   44|  5.93k|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|  5.93k|    free(loop->data.recv_buf);
   50|       |
   51|  5.93k|    us_timer_close(loop->data.sweep_timer);
   52|  5.93k|    us_internal_async_close(loop->data.wakeup_async);
   53|  5.93k|}
us_wakeup_loop:
   55|  10.5k|void us_wakeup_loop(struct us_loop_t *loop) {
   56|  10.5k|    us_internal_async_wakeup(loop->data.wakeup_async);
   57|  10.5k|}
us_internal_loop_link:
   59|  23.7k|void us_internal_loop_link(struct us_loop_t *loop, struct us_socket_context_t *context) {
   60|       |    /* Insert this context as the head of loop */
   61|  23.7k|    context->next = loop->data.head;
   62|  23.7k|    context->prev = 0;
   63|  23.7k|    if (loop->data.head) {
  ------------------
  |  Branch (63:9): [True: 17.8k, False: 5.93k]
  ------------------
   64|  17.8k|        loop->data.head->prev = context;
   65|  17.8k|    }
   66|  23.7k|    loop->data.head = context;
   67|  23.7k|}
us_internal_loop_unlink:
   70|  23.7k|void us_internal_loop_unlink(struct us_loop_t *loop, struct us_socket_context_t *context) {
   71|  23.7k|    if (loop->data.head == context) {
  ------------------
  |  Branch (71:9): [True: 11.8k, False: 11.8k]
  ------------------
   72|  11.8k|        loop->data.head = context->next;
   73|  11.8k|        if (loop->data.head) {
  ------------------
  |  Branch (73:13): [True: 5.93k, False: 5.93k]
  ------------------
   74|  5.93k|            loop->data.head->prev = 0;
   75|  5.93k|        }
   76|  11.8k|    } else {
   77|  11.8k|        context->prev->next = context->next;
   78|  11.8k|        if (context->next) {
  ------------------
  |  Branch (78:13): [True: 0, False: 11.8k]
  ------------------
   79|      0|            context->next->prev = context->prev;
   80|      0|        }
   81|  11.8k|    }
   82|  23.7k|}
us_internal_timer_sweep:
   85|  1.48M|void us_internal_timer_sweep(struct us_loop_t *loop) {
   86|  1.48M|    struct us_internal_loop_data_t *loop_data = &loop->data;
   87|       |    /* For all socket contexts in this loop */
   88|  7.42M|    for (loop_data->iterator = loop_data->head; loop_data->iterator; loop_data->iterator = loop_data->iterator->next) {
  ------------------
  |  Branch (88:49): [True: 5.94M, False: 1.48M]
  ------------------
   89|       |
   90|  5.94M|        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|  5.94M|        context->global_tick++;
   94|  5.94M|        unsigned char short_ticks = context->timestamp = context->global_tick % 240;
   95|  5.94M|        unsigned char long_ticks = context->long_timestamp = (context->global_tick / 15) % 240;
   96|       |
   97|       |        /* Begin at head */
   98|  5.94M|        struct us_socket_t *s = context->head_sockets;
   99|  5.94M|        while (s) {
  ------------------
  |  Branch (99:16): [True: 141k, False: 5.80M]
  ------------------
  100|       |            /* Seek until end or timeout found (tightest loop) */
  101|   301k|            while (1) {
  ------------------
  |  Branch (101:20): [Folded - Ignored]
  ------------------
  102|       |                /* We only read from 1 random cache line here */
  103|   301k|                if (short_ticks == s->timeout || long_ticks == s->long_timeout) {
  ------------------
  |  Branch (103:21): [True: 7.76k, False: 293k]
  |  Branch (103:50): [True: 0, False: 293k]
  ------------------
  104|  7.76k|                    break;
  105|  7.76k|                }
  106|       |
  107|       |                /* Did we reach the end without a find? */
  108|   293k|                if ((s = s->next) == 0) {
  ------------------
  |  Branch (108:21): [True: 133k, False: 159k]
  ------------------
  109|   133k|                    goto next_context;
  110|   133k|                }
  111|   293k|            }
  112|       |
  113|       |            /* Here we have a timeout to emit (slow path) */
  114|  7.76k|            context->iterator = s;
  115|       |
  116|  7.76k|            if (short_ticks == s->timeout) {
  ------------------
  |  Branch (116:17): [True: 7.76k, False: 0]
  ------------------
  117|  7.76k|                s->timeout = 255;
  118|  7.76k|                context->on_socket_timeout(s);
  119|  7.76k|            }
  120|       |
  121|  7.76k|            if (context->iterator == s && long_ticks == s->long_timeout) {
  ------------------
  |  Branch (121:17): [True: 1.94k, False: 5.82k]
  |  Branch (121:43): [True: 0, False: 1.94k]
  ------------------
  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|  7.76k|            if (s == context->iterator) {
  ------------------
  |  Branch (127:17): [True: 1.94k, False: 5.82k]
  ------------------
  128|  1.94k|                s = s->next;
  129|  5.82k|            } else {
  130|       |                /* The iterator was changed by event handler */
  131|  5.82k|                s = context->iterator;
  132|  5.82k|            }
  133|  7.76k|        }
  134|       |        /* We always store a 0 to context->iterator here since we are no longer iterating this context */
  135|  5.94M|        next_context:
  136|  5.94M|        context->iterator = 0;
  137|  5.94M|    }
  138|  1.48M|}
us_internal_handle_low_priority_sockets:
  145|  1.74M|void us_internal_handle_low_priority_sockets(struct us_loop_t *loop) {
  146|  1.74M|    struct us_internal_loop_data_t *loop_data = &loop->data;
  147|  1.74M|    struct us_socket_t *s;
  148|       |
  149|  1.74M|    loop_data->low_prio_budget = MAX_LOW_PRIO_SOCKETS_PER_LOOP_ITERATION;
  150|       |
  151|  1.74M|    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.74M]
  |  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.74M|}
us_internal_free_closed_sockets:
  165|  1.74M|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.74M|    if (loop->data.closed_head) {
  ------------------
  |  Branch (167:9): [True: 189k, False: 1.55M]
  ------------------
  168|  1.83M|        for (struct us_socket_t *s = loop->data.closed_head; s; ) {
  ------------------
  |  Branch (168:62): [True: 1.64M, False: 189k]
  ------------------
  169|  1.64M|            struct us_socket_t *next = s->next;
  170|  1.64M|            us_poll_free((struct us_poll_t *) s, loop);
  171|  1.64M|            s = next;
  172|  1.64M|        }
  173|   189k|        loop->data.closed_head = 0;
  174|   189k|    }
  175|  1.74M|}
sweep_timer_cb:
  177|  1.48M|void sweep_timer_cb(struct us_internal_callback_t *cb) {
  178|  1.48M|    us_internal_timer_sweep(cb->loop);
  179|  1.48M|}
us_loop_iteration_number:
  181|  5.93k|long long us_loop_iteration_number(struct us_loop_t *loop) {
  182|  5.93k|    return loop->data.iteration_nr;
  183|  5.93k|}
us_internal_loop_pre:
  186|  1.74M|void us_internal_loop_pre(struct us_loop_t *loop) {
  187|  1.74M|    loop->data.iteration_nr++;
  188|  1.74M|    us_internal_handle_low_priority_sockets(loop);
  189|  1.74M|    loop->data.pre_cb(loop);
  190|  1.74M|}
us_internal_loop_post:
  192|  1.74M|void us_internal_loop_post(struct us_loop_t *loop) {
  193|  1.74M|    us_internal_free_closed_sockets(loop);
  194|  1.74M|    loop->data.post_cb(loop);
  195|  1.74M|}
us_internal_dispatch_ready_poll:
  197|  7.56M|void us_internal_dispatch_ready_poll(struct us_poll_t *p, int error, int events) {
  198|  7.56M|    switch (us_internal_poll_type(p)) {
  ------------------
  |  Branch (198:13): [True: 0, False: 7.56M]
  ------------------
  199|  4.36M|    case POLL_TYPE_CALLBACK: {
  ------------------
  |  Branch (199:5): [True: 4.36M, False: 3.19M]
  ------------------
  200|  4.36M|            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|  4.36M|            if (!cb->leave_poll_ready) {
  ------------------
  |  Branch (202:17): [True: 4.36M, False: 0]
  ------------------
  203|       |                /* Let's just have this macro to silence the CodeQL alert regarding empty function when using libuv */
  204|  4.36M|    #ifndef LIBUS_USE_LIBUV
  205|  4.36M|                us_internal_accept_poll_event(p);
  206|  4.36M|    #endif
  207|  4.36M|            }
  208|  4.36M|            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.43M, False: 2.93M]
  ------------------
  209|  4.36M|        }
  210|  4.36M|        break;
  211|  1.43M|    case POLL_TYPE_SEMI_SOCKET: {
  ------------------
  |  Branch (211:5): [True: 1.43M, False: 6.13M]
  ------------------
  212|       |            /* Both connect and listen sockets are semi-sockets
  213|       |             * but they poll for different events */
  214|  1.43M|            if (us_poll_events(p) == LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|  1.43M|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (214:17): [True: 3.01k, False: 1.43M]
  ------------------
  215|  3.01k|                struct us_socket_t *s = (struct us_socket_t *) p;
  216|       |
  217|       |                /* It is perfectly possible to come here with an error */
  218|  3.01k|                if (error) {
  ------------------
  |  Branch (218:21): [True: 2.67k, False: 334]
  ------------------
  219|       |                    /* Emit error, close without emitting on_close */
  220|  2.67k|                    s->context->on_connect_error(s, 0);
  221|  2.67k|                    us_socket_close_connecting(0, s);
  222|  2.67k|                } else {
  223|       |                    /* All sockets poll for readable */
  224|    334|                    us_poll_change(p, s->context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|    334|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  225|       |
  226|       |                    /* We always use nodelay */
  227|    334|                    bsd_socket_nodelay(us_poll_fd(p), 1);
  228|       |
  229|       |                    /* We are now a proper socket */
  230|    334|                    us_internal_poll_set_type(p, POLL_TYPE_SOCKET);
  231|       |
  232|       |                    /* If we used a connection timeout we have to reset it here */
  233|    334|                    us_socket_timeout(0, s, 0);
  234|       |
  235|    334|                    s->context->on_open(s, 1, 0, 0);
  236|    334|                }
  237|  1.43M|            } else {
  238|  1.43M|                struct us_listen_socket_t *listen_socket = (struct us_listen_socket_t *) p;
  239|  1.43M|                struct bsd_addr_t addr;
  240|       |
  241|  1.43M|                LIBUS_SOCKET_DESCRIPTOR client_fd = bsd_accept_socket(us_poll_fd(p), &addr);
  ------------------
  |  |   38|  1.43M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  242|  1.43M|                if (client_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  1.43M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (242:21): [True: 1.28M, False: 151k]
  ------------------
  243|       |                    /* Todo: start timer here */
  244|       |
  245|  1.28M|                } else {
  246|       |
  247|       |                    /* Todo: stop timer if any */
  248|       |
  249|  1.63M|                    do {
  250|  1.63M|                        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|  1.63M|                        us_poll_init(accepted_p, client_fd, POLL_TYPE_SOCKET);
  252|  1.63M|                        us_poll_start(accepted_p, listen_socket->s.context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  1.63M|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  253|       |
  254|  1.63M|                        struct us_socket_t *s = (struct us_socket_t *) accepted_p;
  255|       |
  256|  1.63M|                        s->context = listen_socket->s.context;
  257|  1.63M|                        s->timeout = 255;
  258|  1.63M|                        s->long_timeout = 255;
  259|  1.63M|                        s->low_prio_state = 0;
  260|       |
  261|       |                        /* We always use nodelay */
  262|  1.63M|                        bsd_socket_nodelay(client_fd, 1);
  263|       |
  264|  1.63M|                        us_internal_socket_context_link_socket(listen_socket->s.context, s);
  265|       |
  266|  1.63M|                        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|  1.63M|                        if (us_socket_is_closed(0, &listen_socket->s)) {
  ------------------
  |  Branch (269:29): [True: 0, False: 1.63M]
  ------------------
  270|      0|                            break;
  271|      0|                        }
  272|       |
  273|  1.63M|                    } while ((client_fd = bsd_accept_socket(us_poll_fd(p), &addr)) != LIBUS_SOCKET_ERROR);
  ------------------
  |  |   44|  1.63M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (273:30): [True: 1.48M, False: 151k]
  ------------------
  274|   151k|                }
  275|  1.43M|            }
  276|  1.43M|        }
  277|      0|        break;
  278|  1.17k|    case POLL_TYPE_SOCKET_SHUT_DOWN:
  ------------------
  |  Branch (278:5): [True: 1.17k, False: 7.56M]
  ------------------
  279|  1.76M|    case POLL_TYPE_SOCKET: {
  ------------------
  |  Branch (279:5): [True: 1.76M, False: 5.80M]
  ------------------
  280|       |            /* We should only use s, no p after this point */
  281|  1.76M|            struct us_socket_t *s = (struct us_socket_t *) p;
  282|       |
  283|       |            /* Such as epollerr epollhup */
  284|  1.76M|            if (error) {
  ------------------
  |  Branch (284:17): [True: 1.53M, False: 225k]
  ------------------
  285|       |                /* Todo: decide what code we give here */
  286|  1.53M|                s = us_socket_close(0, s, 0, NULL);
  287|  1.53M|                return;
  288|  1.53M|            }
  289|       |
  290|   225k|            if (events & LIBUS_SOCKET_WRITABLE) {
  ------------------
  |  |   28|   225k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  |  Branch (290:17): [True: 11.7k, False: 213k]
  ------------------
  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|  11.7k|                s->context->loop->data.last_write_failed = 0;
  294|       |
  295|  11.7k|                s = s->context->on_writable(s);
  296|       |
  297|  11.7k|                if (us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (297:21): [True: 318, False: 11.4k]
  ------------------
  298|    318|                    return;
  299|    318|                }
  300|       |
  301|       |                /* If we have no failed write or if we shut down, then stop polling for more writable */
  302|  11.4k|                if (!s->context->loop->data.last_write_failed || us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (302:21): [True: 2.43k, False: 8.96k]
  |  Branch (302:66): [True: 0, False: 8.96k]
  ------------------
  303|  2.43k|                    us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  2.43k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  304|  2.43k|                }
  305|  11.4k|            }
  306|       |
  307|   224k|            if (events & LIBUS_SOCKET_READABLE) {
  ------------------
  |  |   27|   224k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  |  Branch (307:17): [True: 219k, False: 5.91k]
  ------------------
  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|   219k|                if (s->context->is_low_prio(s)) {
  ------------------
  |  Branch (311:21): [True: 0, False: 219k]
  ------------------
  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|   219k|                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|   219k|#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|   219k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  335|   219k|                if (length > 0) {
  ------------------
  |  Branch (335:21): [True: 197k, False: 21.2k]
  ------------------
  336|   197k|                    s = s->context->on_data(s, s->context->loop->data.recv_buf + LIBUS_RECV_BUFFER_PADDING, length);
  ------------------
  |  |   26|   197k|#define LIBUS_RECV_BUFFER_PADDING 32
  ------------------
  337|   197k|                } else if (!length) {
  ------------------
  |  Branch (337:28): [True: 18.6k, False: 2.59k]
  ------------------
  338|  18.6k|                    if (us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (338:25): [True: 194, False: 18.4k]
  ------------------
  339|       |                        /* We got FIN back after sending it */
  340|       |                        /* Todo: We should give "CLEAN SHUTDOWN" as reason here */
  341|    194|                        s = us_socket_close(0, s, 0, NULL);
  342|  18.4k|                    } else {
  343|       |                        /* We got FIN, so stop polling for readable */
  344|  18.4k|                        us_poll_change(&s->p, us_socket_context(0, s)->loop, us_poll_events(&s->p) & LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|  18.4k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  345|  18.4k|                        s = s->context->on_end(s);
  346|  18.4k|                    }
  347|  18.6k|                } else if (length == LIBUS_SOCKET_ERROR && !bsd_would_block()) {
  ------------------
  |  |   44|  5.18k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (347:28): [True: 2.59k, False: 0]
  |  Branch (347:60): [True: 0, False: 2.59k]
  ------------------
  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|   219k|            }
  352|   224k|        }
  353|   224k|        break;
  354|  7.56M|    }
  355|  7.56M|}
us_loop_integrate:
  358|  5.93k|void us_loop_integrate(struct us_loop_t *loop) {
  359|  5.93k|    us_timer_set(loop->data.sweep_timer, (void (*)(struct us_timer_t *)) sweep_timer_cb, LIBUS_TIMEOUT_GRANULARITY * 1000, LIBUS_TIMEOUT_GRANULARITY * 1000);
  ------------------
  |  |   24|  5.93k|#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|  5.93k|#define LIBUS_TIMEOUT_GRANULARITY 4
  ------------------
  360|  5.93k|}
us_loop_ext:
  362|  7.15M|void *us_loop_ext(struct us_loop_t *loop) {
  363|  7.15M|    return loop + 1;
  364|  7.15M|}

us_socket_local_port:
   28|  3.04k|int us_socket_local_port(int ssl, struct us_socket_t *s) {
   29|  3.04k|    struct bsd_addr_t addr;
   30|  3.04k|    if (bsd_local_addr(us_poll_fd(&s->p), &addr)) {
  ------------------
  |  Branch (30:9): [True: 3.04k, False: 0]
  ------------------
   31|  3.04k|        return -1;
   32|  3.04k|    } else {
   33|      0|        return bsd_addr_get_port(&addr);
   34|      0|    }
   35|  3.04k|}
us_socket_shutdown_read:
   37|    595|void us_socket_shutdown_read(int ssl, struct us_socket_t *s) {
   38|       |    /* This syscall is idempotent so no extra check is needed */
   39|    595|    bsd_shutdown_socket_read(us_poll_fd((struct us_poll_t *) s));
   40|    595|}
us_socket_remote_address:
   42|  34.7k|void us_socket_remote_address(int ssl, struct us_socket_t *s, char *buf, int *length) {
   43|  34.7k|    struct bsd_addr_t addr;
   44|  34.7k|    if (bsd_remote_addr(us_poll_fd(&s->p), &addr) || *length < bsd_addr_get_ip_length(&addr)) {
  ------------------
  |  Branch (44:9): [True: 0, False: 34.7k]
  |  Branch (44:54): [True: 0, False: 34.7k]
  ------------------
   45|      0|        *length = 0;
   46|  34.7k|    } else {
   47|  34.7k|        *length = bsd_addr_get_ip_length(&addr);
   48|  34.7k|        memcpy(buf, bsd_addr_get_ip(&addr), *length);
   49|  34.7k|    }
   50|  34.7k|}
us_socket_context:
   52|  7.61M|struct us_socket_context_t *us_socket_context(int ssl, struct us_socket_t *s) {
   53|  7.61M|    return s->context;
   54|  7.61M|}
us_socket_timeout:
   56|  1.88M|void us_socket_timeout(int ssl, struct us_socket_t *s, unsigned int seconds) {
   57|  1.88M|    if (seconds) {
  ------------------
  |  Branch (57:9): [True: 1.82M, False: 56.6k]
  ------------------
   58|  1.82M|        s->timeout = ((unsigned int)s->context->timestamp + ((seconds + 3) >> 2)) % 240;
   59|  1.82M|    } else {
   60|  56.6k|        s->timeout = 255;
   61|  56.6k|    }
   62|  1.88M|}
us_socket_long_timeout:
   64|  37.1k|void us_socket_long_timeout(int ssl, struct us_socket_t *s, unsigned int minutes) {
   65|  37.1k|    if (minutes) {
  ------------------
  |  Branch (65:9): [True: 0, False: 37.1k]
  ------------------
   66|      0|        s->long_timeout = ((unsigned int)s->context->long_timestamp + minutes) % 240;
   67|  37.1k|    } else {
   68|  37.1k|        s->long_timeout = 255;
   69|  37.1k|    }
   70|  37.1k|}
us_socket_flush:
   72|    334|void us_socket_flush(int ssl, struct us_socket_t *s) {
   73|    334|    if (!us_socket_is_shut_down(0, s)) {
  ------------------
  |  Branch (73:9): [True: 334, False: 0]
  ------------------
   74|    334|        bsd_socket_flush(us_poll_fd((struct us_poll_t *) s));
   75|    334|    }
   76|    334|}
us_socket_is_closed:
   78|  4.99M|int us_socket_is_closed(int ssl, struct us_socket_t *s) {
   79|  4.99M|    return s->prev == (struct us_socket_t *) s->context;
   80|  4.99M|}
us_socket_is_established:
   82|  3.04k|int us_socket_is_established(int ssl, struct us_socket_t *s) {
   83|       |    /* Everything that is not POLL_TYPE_SEMI_SOCKET is established */
   84|  3.04k|    return us_internal_poll_type((struct us_poll_t *) s) != POLL_TYPE_SEMI_SOCKET;
   85|  3.04k|}
us_socket_close_connecting:
   88|  2.67k|struct us_socket_t *us_socket_close_connecting(int ssl, struct us_socket_t *s) {
   89|  2.67k|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (89:9): [True: 2.67k, False: 0]
  ------------------
   90|  2.67k|        us_internal_socket_context_unlink_socket(s->context, s);
   91|  2.67k|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
   92|  2.67k|        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.67k|        s->next = s->context->loop->data.closed_head;
   96|  2.67k|        s->context->loop->data.closed_head = s;
   97|       |
   98|       |        /* Any socket with prev = context is marked as closed */
   99|  2.67k|        s->prev = (struct us_socket_t *) s->context;
  100|       |
  101|       |        //return s->context->on_close(s, code, reason);
  102|  2.67k|    }
  103|  2.67k|    return s;
  104|  2.67k|}
us_socket_close:
  107|  1.63M|struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, void *reason) {
  108|  1.63M|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (108:9): [True: 1.63M, False: 0]
  ------------------
  109|  1.63M|        if (s->low_prio_state == 1) {
  ------------------
  |  Branch (109:13): [True: 0, False: 1.63M]
  ------------------
  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|  1.63M|        } else {
  120|  1.63M|            us_internal_socket_context_unlink_socket(s->context, s);
  121|  1.63M|        }
  122|  1.63M|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
  123|  1.63M|        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|  1.63M|        s->next = s->context->loop->data.closed_head;
  127|  1.63M|        s->context->loop->data.closed_head = s;
  128|       |
  129|       |        /* Any socket with prev = context is marked as closed */
  130|  1.63M|        s->prev = (struct us_socket_t *) s->context;
  131|       |
  132|  1.63M|        return s->context->on_close(s, code, reason);
  133|  1.63M|    }
  134|      0|    return s;
  135|  1.63M|}
us_socket_get_native_handle:
  139|  34.7k|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|  34.7k|    return (void *) (uintptr_t) us_poll_fd((struct us_poll_t *) s);
  147|  34.7k|}
us_socket_write:
  164|   191k|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|   191k|    if (us_socket_is_closed(ssl, s) || us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (171:9): [True: 0, False: 191k]
  |  Branch (171:40): [True: 0, False: 191k]
  ------------------
  172|      0|        return 0;
  173|      0|    }
  174|       |
  175|   191k|    int written = bsd_send(us_poll_fd(&s->p), data, length, msg_more);
  176|   191k|    if (written != length) {
  ------------------
  |  Branch (176:9): [True: 183k, False: 8.63k]
  ------------------
  177|   183k|        s->context->loop->data.last_write_failed = 1;
  178|   183k|        us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   27|   183k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                      us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|   183k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  179|   183k|    }
  180|       |
  181|   191k|    return written < 0 ? 0 : written;
  ------------------
  |  Branch (181:12): [True: 7.42k, False: 184k]
  ------------------
  182|   191k|}
us_socket_ext:
  184|  5.72M|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|  5.72M|    return s + 1;
  192|  5.72M|}
us_socket_is_shut_down:
  194|   439k|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|   439k|    return us_internal_poll_type(&s->p) == POLL_TYPE_SOCKET_SHUT_DOWN;
  202|   439k|}
us_socket_shutdown:
  204|  59.1k|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|  59.1k|    if (!us_socket_is_closed(ssl, s) && !us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (215:9): [True: 59.1k, False: 0]
  |  Branch (215:41): [True: 59.1k, False: 0]
  ------------------
  216|  59.1k|        us_internal_poll_set_type(&s->p, POLL_TYPE_SOCKET_SHUT_DOWN);
  217|  59.1k|        us_poll_change(&s->p, s->context->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  59.1k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  218|  59.1k|        bsd_shutdown_socket(us_poll_fd((struct us_poll_t *) s));
  219|  59.1k|    }
  220|  59.1k|}

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

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

