_ZN3uWS12TemplatedAppILb0EEC2ENS_20SocketContextOptionsE:
  217|  5.52k|    TemplatedApp(SocketContextOptions options = {}) {
  218|  5.52k|        httpContext = HttpContext<SSL>::create(Loop::get(), options);
  219|  5.52k|    }
_ZNK3uWS20SocketContextOptionscv27us_socket_context_options_tEv:
   71|  5.52k|        operator struct us_socket_context_options_t() const {
   72|  5.52k|            struct us_socket_context_options_t socket_context_options;
   73|  5.52k|            memcpy(&socket_context_options, this, sizeof(SocketContextOptions));
   74|  5.52k|            return socket_context_options;
   75|  5.52k|        }
_ZN3uWS12TemplatedAppILb0EED2Ev:
  177|  11.0k|    ~TemplatedApp() {
  178|       |        /* Let's just put everything here */
  179|  11.0k|        if (httpContext) {
  ------------------
  |  Branch (179:13): [True: 5.52k, False: 5.52k]
  ------------------
  180|  5.52k|            httpContext->free();
  181|       |
  182|       |            /* Free all our webSocketContexts in a type less way */
  183|  11.0k|            for (auto &webSocketContextDeleter : webSocketContextDeleters) {
  ------------------
  |  Branch (183:48): [True: 11.0k, False: 5.52k]
  ------------------
  184|  11.0k|                webSocketContextDeleter();
  185|  11.0k|            }
  186|  5.52k|        }
  187|       |
  188|       |        /* Delete TopicTree */
  189|  11.0k|        if (topicTree) {
  ------------------
  |  Branch (189:13): [True: 5.52k, False: 5.52k]
  ------------------
  190|  5.52k|            delete topicTree;
  191|       |
  192|       |            /* And unregister loop callbacks */
  193|       |            /* We must unregister any loop post handler here */
  194|  5.52k|            Loop::get()->removePostHandler(topicTree);
  195|  5.52k|            Loop::get()->removePreHandler(topicTree);
  196|  5.52k|        }
  197|  11.0k|    }
EpollEchoServer.cpp:_ZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EE:
  263|  11.0k|    TemplatedApp &&ws(std::string pattern, WebSocketBehavior<UserData> &&behavior) {
  264|       |        /* Don't compile if alignment rules cannot be satisfied */
  265|  11.0k|        static_assert(alignof(UserData) <= LIBUS_EXT_ALIGNMENT,
  266|  11.0k|        "µWebSockets cannot satisfy UserData alignment requirements. You need to recompile µSockets with LIBUS_EXT_ALIGNMENT adjusted accordingly.");
  267|       |
  268|  11.0k|        if (!httpContext) {
  ------------------
  |  Branch (268:13): [True: 0, False: 11.0k]
  ------------------
  269|      0|            return std::move(*this);
  270|      0|        }
  271|       |
  272|       |        /* Terminate on misleading idleTimeout values */
  273|  11.0k|        if (behavior.idleTimeout && behavior.idleTimeout < 8) {
  ------------------
  |  Branch (273:13): [True: 11.0k, False: 0]
  |  Branch (273:37): [True: 0, False: 11.0k]
  ------------------
  274|      0|            std::cerr << "Error: idleTimeout must be either 0 or greater than 8!" << std::endl;
  275|      0|            std::terminate();
  276|      0|        }
  277|       |
  278|       |        /* Maximum idleTimeout is 16 minutes */
  279|  11.0k|        if (behavior.idleTimeout > 240 * 4) {
  ------------------
  |  Branch (279:13): [True: 0, False: 11.0k]
  ------------------
  280|      0|            std::cerr << "Error: idleTimeout must not be greater than 960 seconds!" << std::endl;
  281|      0|            std::terminate();
  282|      0|        }
  283|       |
  284|       |        /* Maximum maxLifetime is 4 hours */
  285|  11.0k|        if (behavior.maxLifetime > 240) {
  ------------------
  |  Branch (285:13): [True: 0, False: 11.0k]
  ------------------
  286|      0|            std::cerr << "Error: maxLifetime must not be greater than 240 minutes!" << std::endl;
  287|      0|            std::terminate();
  288|      0|        }
  289|       |
  290|       |        /* If we don't have a TopicTree yet, create one now */
  291|  11.0k|        if (!topicTree) {
  ------------------
  |  Branch (291:13): [True: 5.52k, False: 5.52k]
  ------------------
  292|       |
  293|  5.52k|            bool needsUncork = false;
  294|  5.52k|            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.52k|                auto *ws = (WebSocket<SSL, true, int> *) s->user;
  300|       |
  301|       |                /* If this is the first message we try and cork */
  302|  5.52k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::FIRST) {
  303|  5.52k|                    if (ws->canCork() && !ws->isCorked()) {
  304|  5.52k|                        ((AsyncSocket<SSL> *)ws)->cork();
  305|  5.52k|                        needsUncork = true;
  306|  5.52k|                    }
  307|  5.52k|                }
  308|       |
  309|       |                /* If we ever overstep maxBackpresure, exit immediately */
  310|  5.52k|                if (WebSocket<SSL, true, int>::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) {
  311|  5.52k|                    if (needsUncork) {
  312|  5.52k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  313|  5.52k|                        needsUncork = false;
  314|  5.52k|                    }
  315|       |                    /* Stop draining */
  316|  5.52k|                    return true;
  317|  5.52k|                }
  318|       |
  319|       |                /* If this is the last message we uncork if we are corked */
  320|  5.52k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::LAST) {
  321|       |                    /* We should not uncork in all cases? */
  322|  5.52k|                    if (needsUncork) {
  323|  5.52k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  324|  5.52k|                    }
  325|  5.52k|                }
  326|       |
  327|       |                /* Success */
  328|  5.52k|                return false;
  329|  5.52k|            });
  330|       |
  331|       |            /* And hook it up with the loop */
  332|       |            /* We empty for both pre and post just to make sure */
  333|  5.52k|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  334|       |                /* Commit pub/sub batches every loop iteration */
  335|  5.52k|                topicTree->drain();
  336|  5.52k|            });
  337|       |
  338|  5.52k|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  339|       |                /* Commit pub/sub batches every loop iteration */
  340|  5.52k|                topicTree->drain();
  341|  5.52k|            });
  342|  5.52k|        }
  343|       |
  344|       |        /* Every route has its own websocket context with its own behavior and user data type */
  345|  11.0k|        auto *webSocketContext = WebSocketContext<SSL, true, UserData>::create(Loop::get(), (us_socket_context_t *) httpContext, topicTree);
  346|       |
  347|       |        /* We need to clear this later on */
  348|  11.0k|        webSocketContextDeleters.push_back([webSocketContext]() {
  349|  11.0k|            webSocketContext->free();
  350|  11.0k|        });
  351|       |
  352|       |        /* We also keep this list for easy closing */
  353|  11.0k|        webSocketContexts.push_back((void *)webSocketContext);
  354|       |
  355|       |        /* Quick fix to disable any compression if set */
  356|       |#ifdef UWS_NO_ZLIB
  357|       |        behavior.compression = DISABLED;
  358|       |#endif
  359|       |
  360|       |        /* If we are the first one to use compression, initialize it */
  361|  11.0k|        if (behavior.compression) {
  ------------------
  |  Branch (361:13): [True: 10.5k, False: 510]
  ------------------
  362|  10.5k|            LoopData *loopData = (LoopData *) us_loop_ext(us_socket_context_loop(SSL, webSocketContext->getSocketContext()));
  363|       |
  364|       |            /* Initialize loop's deflate inflate streams */
  365|  10.5k|            if (!loopData->zlibContext) {
  ------------------
  |  Branch (365:17): [True: 5.26k, False: 5.26k]
  ------------------
  366|  5.26k|                loopData->zlibContext = new ZlibContext;
  367|  5.26k|                loopData->inflationStream = new InflationStream(CompressOptions::DEDICATED_DECOMPRESSOR);
  368|  5.26k|                loopData->deflationStream = new DeflationStream(CompressOptions::DEDICATED_COMPRESSOR);
  369|  5.26k|            }
  370|  10.5k|        }
  371|       |
  372|       |        /* Copy all handlers */
  373|  11.0k|        webSocketContext->getExt()->openHandler = std::move(behavior.open);
  374|  11.0k|        webSocketContext->getExt()->messageHandler = std::move(behavior.message);
  375|  11.0k|        webSocketContext->getExt()->drainHandler = std::move(behavior.drain);
  376|  11.0k|        webSocketContext->getExt()->subscriptionHandler = std::move(behavior.subscription);
  377|  11.0k|        webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true, UserData> *ws, int code, std::string_view message) mutable {
  378|  11.0k|            if (closeHandler) {
  379|  11.0k|                closeHandler(ws, code, message);
  380|  11.0k|            }
  381|       |
  382|       |            /* Destruct user data after returning from close handler */
  383|  11.0k|            ((UserData *) ws->getUserData())->~UserData();
  384|  11.0k|        });
  385|  11.0k|        webSocketContext->getExt()->pingHandler = std::move(behavior.ping);
  386|  11.0k|        webSocketContext->getExt()->pongHandler = std::move(behavior.pong);
  387|       |
  388|       |        /* Copy settings */
  389|  11.0k|        webSocketContext->getExt()->maxPayloadLength = behavior.maxPayloadLength;
  390|  11.0k|        webSocketContext->getExt()->maxBackpressure = behavior.maxBackpressure;
  391|  11.0k|        webSocketContext->getExt()->closeOnBackpressureLimit = behavior.closeOnBackpressureLimit;
  392|  11.0k|        webSocketContext->getExt()->resetIdleTimeoutOnSend = behavior.resetIdleTimeoutOnSend;
  393|  11.0k|        webSocketContext->getExt()->sendPingsAutomatically = behavior.sendPingsAutomatically;
  394|  11.0k|        webSocketContext->getExt()->maxLifetime = behavior.maxLifetime;
  395|  11.0k|        webSocketContext->getExt()->compression = behavior.compression;
  396|       |
  397|       |        /* Calculate idleTimeoutCompnents */
  398|  11.0k|        webSocketContext->getExt()->calculateIdleTimeoutCompnents(behavior.idleTimeout);
  399|       |
  400|  11.0k|        httpContext->onHttp("GET", pattern, [webSocketContext, behavior = std::move(behavior)](auto *res, auto *req) mutable {
  401|       |
  402|       |            /* If we have this header set, it's a websocket */
  403|  11.0k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  404|  11.0k|            if (secWebSocketKey.length() == 24) {
  405|       |
  406|       |                /* Emit upgrade handler */
  407|  11.0k|                if (behavior.upgrade) {
  408|       |
  409|       |                    /* Nasty, ugly Safari 15 hack */
  410|  11.0k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  411|  11.0k|                        std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  412|  11.0k|                        memset((void *) secWebSocketExtensions.data(), ' ', secWebSocketExtensions.length());
  413|  11.0k|                    }
  414|       |
  415|  11.0k|                    behavior.upgrade(res, req, (struct us_socket_context_t *) webSocketContext);
  416|  11.0k|                } else {
  417|       |                    /* Default handler upgrades to WebSocket */
  418|  11.0k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  419|  11.0k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  420|       |
  421|       |                    /* Safari 15 hack */
  422|  11.0k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  423|  11.0k|                        secWebSocketExtensions = "";
  424|  11.0k|                    }
  425|       |
  426|  11.0k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  427|  11.0k|                }
  428|       |
  429|       |                /* We are going to get uncorked by the Http get return */
  430|       |
  431|       |                /* We do not need to check for any close or shutdown here as we immediately return from get handler */
  432|       |
  433|  11.0k|            } else {
  434|       |                /* Tell the router that we did not handle this request */
  435|  11.0k|                req->setYield(true);
  436|  11.0k|            }
  437|  11.0k|        }, true);
  438|  11.0k|        return std::move(*this);
  439|  11.0k|    }
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPNS_10SubscriberERNS_16TopicTreeMessageENS_9TopicTreeISI_NS_19TopicTreeBigMessageEE13IteratorFlagsEE_clESH_SJ_SN_:
  294|  23.3k|            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|  23.3k|                auto *ws = (WebSocket<SSL, true, int> *) s->user;
  300|       |
  301|       |                /* If this is the first message we try and cork */
  302|  23.3k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::FIRST) {
  ------------------
  |  Branch (302:21): [True: 4.16k, False: 19.1k]
  ------------------
  303|  4.16k|                    if (ws->canCork() && !ws->isCorked()) {
  ------------------
  |  Branch (303:25): [True: 2.14k, False: 2.02k]
  |  Branch (303:42): [True: 2.14k, False: 0]
  ------------------
  304|  2.14k|                        ((AsyncSocket<SSL> *)ws)->cork();
  305|  2.14k|                        needsUncork = true;
  306|  2.14k|                    }
  307|  4.16k|                }
  308|       |
  309|       |                /* If we ever overstep maxBackpresure, exit immediately */
  310|  23.3k|                if (WebSocket<SSL, true, int>::SendStatus::DROPPED == ws->send(message.message, (OpCode)message.opCode, message.compress)) {
  ------------------
  |  Branch (310:21): [True: 0, False: 23.3k]
  ------------------
  311|      0|                    if (needsUncork) {
  ------------------
  |  Branch (311:25): [True: 0, False: 0]
  ------------------
  312|      0|                        ((AsyncSocket<SSL> *)ws)->uncork();
  313|      0|                        needsUncork = false;
  314|      0|                    }
  315|       |                    /* Stop draining */
  316|      0|                    return true;
  317|      0|                }
  318|       |
  319|       |                /* If this is the last message we uncork if we are corked */
  320|  23.3k|                if (flags & TopicTree<TopicTreeMessage, TopicTreeBigMessage>::IteratorFlags::LAST) {
  ------------------
  |  Branch (320:21): [True: 4.16k, False: 19.1k]
  ------------------
  321|       |                    /* We should not uncork in all cases? */
  322|  4.16k|                    if (needsUncork) {
  ------------------
  |  Branch (322:25): [True: 3.09k, False: 1.07k]
  ------------------
  323|  3.09k|                        ((AsyncSocket<SSL> *)ws)->uncork();
  324|  3.09k|                    }
  325|  4.16k|                }
  326|       |
  327|       |                /* Success */
  328|  23.3k|                return false;
  329|  23.3k|            });
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE_clESH_:
  333|  2.40M|            Loop::get()->addPostHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  334|       |                /* Commit pub/sub batches every loop iteration */
  335|  2.40M|                topicTree->drain();
  336|  2.40M|            });
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlPNS_4LoopEE0_clESH_:
  338|  2.40M|            Loop::get()->addPreHandler(topicTree, [topicTree = topicTree](Loop */*loop*/) {
  339|       |                /* Commit pub/sub batches every loop iteration */
  340|  2.40M|                topicTree->drain();
  341|  2.40M|            });
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENKUlvE_clEv:
  348|  11.0k|        webSocketContextDeleters.push_back([webSocketContext]() {
  349|  11.0k|            webSocketContext->free();
  350|  11.0k|        });
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPNS_9WebSocketILb0ELb1ES3_EEiNS5_17basic_string_viewIcS8_EEE_clESI_iSK_:
  377|   108k|        webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true, UserData> *ws, int code, std::string_view message) mutable {
  378|   108k|            if (closeHandler) {
  ------------------
  |  Branch (378:17): [True: 108k, False: 0]
  ------------------
  379|   108k|                closeHandler(ws, code, message);
  380|   108k|            }
  381|       |
  382|       |            /* Destruct user data after returning from close handler */
  383|   108k|            ((UserData *) ws->getUserData())->~UserData();
  384|   108k|        });
EpollEchoServer.cpp:_ZZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS1_NSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEONS1_17WebSocketBehaviorIT_EEENUlPSD_PT0_E_clINS_12HttpResponseILb0EEENS_11HttpRequestEEEDaSG_SI_:
  400|   113k|        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|   113k|            std::string_view secWebSocketKey = req->getHeader("sec-websocket-key");
  404|   113k|            if (secWebSocketKey.length() == 24) {
  ------------------
  |  Branch (404:17): [True: 108k, False: 4.77k]
  ------------------
  405|       |
  406|       |                /* Emit upgrade handler */
  407|   108k|                if (behavior.upgrade) {
  ------------------
  |  Branch (407:21): [True: 0, False: 108k]
  ------------------
  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|   108k|                } else {
  417|       |                    /* Default handler upgrades to WebSocket */
  418|   108k|                    std::string_view secWebSocketProtocol = req->getHeader("sec-websocket-protocol");
  419|   108k|                    std::string_view secWebSocketExtensions = req->getHeader("sec-websocket-extensions");
  420|       |
  421|       |                    /* Safari 15 hack */
  422|   108k|                    if (hasBrokenCompression(req->getHeader("user-agent"))) {
  ------------------
  |  Branch (422:25): [True: 202, False: 108k]
  ------------------
  423|    202|                        secWebSocketExtensions = "";
  424|    202|                    }
  425|       |
  426|   108k|                    res->template upgrade<UserData>({}, secWebSocketKey, secWebSocketProtocol, secWebSocketExtensions, (struct us_socket_context_t *) webSocketContext);
  427|   108k|                }
  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|   108k|            } else {
  434|       |                /* Tell the router that we did not handle this request */
  435|  4.77k|                req->setYield(true);
  436|  4.77k|            }
  437|   113k|        }, true);
_ZN3uWS20hasBrokenCompressionENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   29|   108k|    inline bool hasBrokenCompression(std::string_view userAgent) {
   30|   108k|        size_t posStart = userAgent.find(" Version/15.");
   31|   108k|        if (posStart == std::string_view::npos) return false;
  ------------------
  |  Branch (31:13): [True: 100k, False: 7.65k]
  ------------------
   32|  7.65k|        posStart += 12;
   33|       |
   34|  7.65k|        size_t posEnd = userAgent.find(' ', posStart);
   35|  7.65k|        if (posEnd == std::string_view::npos) return false;
  ------------------
  |  Branch (35:13): [True: 407, False: 7.24k]
  ------------------
   36|       |
   37|  7.24k|        unsigned int minorVersion = 0;
   38|  7.24k|        auto result = std::from_chars(userAgent.data() + posStart, userAgent.data() + posEnd, minorVersion);
   39|  7.24k|        if (result.ec != std::errc()) return false;
  ------------------
  |  Branch (39:13): [True: 1.87k, False: 5.37k]
  ------------------
   40|  5.37k|        if (result.ptr != userAgent.data() + posEnd) return false; // do not accept trailing chars
  ------------------
  |  Branch (40:13): [True: 2.57k, False: 2.79k]
  ------------------
   41|  2.79k|        if (minorVersion > 3) return false; // we target just Safari 15.0 - 15.3
  ------------------
  |  Branch (41:13): [True: 1.94k, False: 853]
  ------------------
   42|       |
   43|    853|        if (userAgent.find(" Safari/", posEnd) == std::string_view::npos) return false;
  ------------------
  |  Branch (43:13): [True: 651, False: 202]
  ------------------
   44|       |
   45|    202|        return true;
   46|    853|    }
_ZN3uWS12TemplatedAppILb0EE6listenEiON5ofats13any_invocableIFvP18us_listen_socket_tEEE:
  547|  5.52k|    TemplatedApp &&listen(int port, MoveOnlyFunction<void(us_listen_socket_t *)> &&handler) {
  548|  5.52k|        handler(httpContext ? httpContext->listen(nullptr, port, 0) : nullptr);
  ------------------
  |  Branch (548:17): [True: 5.52k, False: 0]
  ------------------
  549|  5.52k|        return std::move(*this);
  550|  5.52k|    }
_ZN3uWS12TemplatedAppILb0EEC2EOS1_:
  202|  5.52k|    TemplatedApp(TemplatedApp &&other) {
  203|       |        /* Move HttpContext */
  204|  5.52k|        httpContext = other.httpContext;
  205|  5.52k|        other.httpContext = nullptr;
  206|       |
  207|       |        /* Move webSocketContextDeleters */
  208|  5.52k|        webSocketContextDeleters = std::move(other.webSocketContextDeleters);
  209|       |
  210|  5.52k|        webSocketContexts = std::move(other.webSocketContexts);
  211|       |
  212|       |        /* Move TopicTree */
  213|  5.52k|        topicTree = other.topicTree;
  214|  5.52k|        other.topicTree = nullptr;
  215|  5.52k|    }
_ZN3uWS12TemplatedAppILb0EE3runEv:
  570|  5.52k|    TemplatedApp &&run() {
  571|  5.52k|        uWS::run();
  572|  5.52k|        return std::move(*this);
  573|  5.52k|    }

_ZN3uWS11AsyncSocketILb0EE4corkEv:
  133|   429k|    void cork() {
  134|       |        /* Extra check for invalid corking of others */
  135|   429k|        if (getLoopData()->corkOffset && getLoopData()->corkedSocket != this) {
  ------------------
  |  Branch (135:13): [True: 0, False: 429k]
  |  Branch (135:42): [True: 0, False: 0]
  ------------------
  136|      0|            std::cerr << "Error: Cork buffer must not be acquired without checking canCork!" << std::endl;
  137|      0|            std::terminate();
  138|      0|        }
  139|       |
  140|       |        /* What if another socket is corked? */
  141|   429k|        getLoopData()->corkedSocket = this;
  142|   429k|    }
_ZN3uWS11AsyncSocketILb0EE11getLoopDataEv:
   85|  4.74M|    LoopData *getLoopData() {
   86|  4.74M|        return (LoopData *) us_loop_ext(us_socket_context_loop(SSL, us_socket_context(SSL, (us_socket_t *) this)));
   87|  4.74M|    }
_ZN3uWS11AsyncSocketILb0EE6uncorkEPKcib:
  332|   430k|    std::pair<int, bool> uncork(const char *src = nullptr, int length = 0, bool optionally = false) {
  333|   430k|        LoopData *loopData = getLoopData();
  334|       |
  335|   430k|        if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (335:13): [True: 429k, False: 953]
  ------------------
  336|   429k|            loopData->corkedSocket = nullptr;
  337|       |
  338|   429k|            if (loopData->corkOffset) {
  ------------------
  |  Branch (338:17): [True: 111k, False: 317k]
  ------------------
  339|       |                /* Corked data is already accounted for via its write call */
  340|   111k|                auto [written, failed] = write(loopData->corkBuffer, (int) loopData->corkOffset, false, length);
  341|   111k|                loopData->corkOffset = 0;
  342|       |
  343|   111k|                if (failed) {
  ------------------
  |  Branch (343:21): [True: 106k, False: 5.82k]
  ------------------
  344|       |                    /* We do not need to care for buffering here, write does that */
  345|   106k|                    return {0, true};
  346|   106k|                }
  347|   111k|            }
  348|       |
  349|       |            /* We should only return with new writes, not things written to cork already */
  350|   323k|            return write(src, length, optionally, 0);
  351|   429k|        } else {
  352|       |            /* We are not even corked! */
  353|    953|            return {0, false};
  354|    953|        }
  355|   430k|    }
_ZN3uWS11AsyncSocketILb0EE5writeEPKcibi:
  241|  3.15M|    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|  3.15M|        if (us_socket_is_closed(SSL, (us_socket_t *) this)) {
  ------------------
  |  Branch (243:13): [True: 261k, False: 2.89M]
  ------------------
  244|   261k|            return {length, false};
  245|   261k|        }
  246|       |
  247|  2.89M|        LoopData *loopData = getLoopData();
  248|  2.89M|        AsyncSocketData<SSL> *asyncSocketData = getAsyncSocketData();
  249|       |
  250|       |        /* We are limited if we have a per-socket buffer */
  251|  2.89M|        if (asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (251:13): [True: 126k, False: 2.76M]
  ------------------
  252|       |            /* Write off as much as we can */
  253|   126k|            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|   126k|            if ((unsigned int) written < asyncSocketData->buffer.length()) {
  ------------------
  |  Branch (256:17): [True: 121k, False: 5.03k]
  ------------------
  257|       |
  258|       |                /* Update buffering (todo: we can do better here if we keep track of what happens to this guy later on) */
  259|   121k|                asyncSocketData->buffer.erase((unsigned int) written);
  260|       |
  261|   121k|                if (optionally) {
  ------------------
  |  Branch (261:21): [True: 0, False: 121k]
  ------------------
  262|       |                    /* Thankfully we can exit early here */
  263|      0|                    return {0, true};
  264|   121k|                } else {
  265|       |                    /* This path is horrible and points towards erroneous usage */
  266|   121k|                    asyncSocketData->buffer.append(src, (unsigned int) length);
  267|       |
  268|   121k|                    return {length, true};
  269|   121k|                }
  270|   121k|            }
  271|       |
  272|       |            /* At this point we simply have no buffer and can continue as normal */
  273|  5.03k|            asyncSocketData->buffer.clear();
  274|  5.03k|        }
  275|       |
  276|  2.76M|        if (length) {
  ------------------
  |  Branch (276:13): [True: 2.73M, False: 38.9k]
  ------------------
  277|  2.73M|            if (loopData->corkedSocket == this) {
  ------------------
  |  Branch (277:17): [True: 2.61M, False: 112k]
  ------------------
  278|       |                /* We are corked */
  279|  2.61M|                if (LoopData::CORK_BUFFER_SIZE - loopData->corkOffset >= (unsigned int) length) {
  ------------------
  |  Branch (279:21): [True: 2.61M, False: 0]
  ------------------
  280|       |                    /* If the entire chunk fits in cork buffer */
  281|  2.61M|                    memcpy(loopData->corkBuffer + loopData->corkOffset, src, (unsigned int) length);
  282|  2.61M|                    loopData->corkOffset += (unsigned int) length;
  283|       |                    /* Fall through to default return */
  284|  2.61M|                } 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|  2.61M|            } else {
  300|       |                /* We are not corked */
  301|   112k|                int written = us_socket_write(SSL, (us_socket_t *) this, src, length, nextLength != 0);
  302|       |
  303|       |                /* Did we fail? */
  304|   112k|                if (written < length) {
  ------------------
  |  Branch (304:21): [True: 106k, False: 5.50k]
  ------------------
  305|       |                    /* If the write was optional then just bail out */
  306|   106k|                    if (optionally) {
  ------------------
  |  Branch (306:25): [True: 0, False: 106k]
  ------------------
  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|   106k|                    if (nextLength) {
  ------------------
  |  Branch (312:25): [True: 0, False: 106k]
  ------------------
  313|      0|                        asyncSocketData->buffer.reserve(asyncSocketData->buffer.length() + (size_t) (length - written + nextLength));
  314|      0|                    }
  315|       |
  316|       |                    /* Buffer this chunk */
  317|   106k|                    asyncSocketData->buffer.append(src + written, (size_t) (length - written));
  318|       |
  319|       |                    /* Return the failure */
  320|   106k|                    return {length, true};
  321|   106k|                }
  322|       |                /* Fall through to default return */
  323|   112k|            }
  324|  2.73M|        }
  325|       |
  326|       |        /* Default fall through return */
  327|  2.66M|        return {length, false};
  328|  2.76M|    }
_ZN3uWS11AsyncSocketILb0EE7timeoutEj:
   95|   191k|    void timeout(unsigned int seconds) {
   96|   191k|        us_socket_timeout(SSL, (us_socket_t *) this, seconds);
   97|   191k|    }
_ZN3uWS11AsyncSocketILb0EE17getBufferedAmountEv:
  198|   201k|    unsigned int getBufferedAmount() {
  199|       |        /* We return the actual amount of bytes in backbuffer, including pendingRemoval */
  200|   201k|        return (unsigned int) getAsyncSocketData()->buffer.totalLength();
  201|   201k|    }
_ZN3uWS11AsyncSocketILb0EE8shutdownEv:
  100|  2.45k|    void shutdown() {
  101|  2.45k|        us_socket_shutdown(SSL, (us_socket_t *) this);
  102|  2.45k|    }
_ZN3uWS11AsyncSocketILb0EE5closeEv:
  117|   126k|    us_socket_t *close() {
  118|   126k|        return us_socket_close(SSL, (us_socket_t *) this, 0, nullptr);
  119|   126k|    }
_ZN3uWS11AsyncSocketILb0EE18getAsyncSocketDataEv:
   90|  4.32M|    AsyncSocketData<SSL> *getAsyncSocketData() {
   91|  4.32M|        return (AsyncSocketData<SSL> *) us_socket_ext(SSL, (us_socket_t *) this);
   92|  4.32M|    }
_ZN3uWS11AsyncSocketILb0EE7canCorkEv:
  155|  5.75k|    bool canCork() {
  156|  5.75k|        return getLoopData()->corkedSocket == nullptr;
  157|  5.75k|    }
_ZN3uWS11AsyncSocketILb0EE8isCorkedEv:
  150|   287k|    bool isCorked() {
  151|   287k|        return getLoopData()->corkedSocket == this;
  152|   287k|    }
_ZN3uWS11AsyncSocketILb0EE13getSendBufferEm:
  160|  53.6k|    std::pair<char *, SendBufferAttribute> getSendBuffer(size_t size) {
  161|       |        /* First step is to determine if we already have backpressure or not */
  162|  53.6k|        LoopData *loopData = getLoopData();
  163|  53.6k|        BackPressure &backPressure = getAsyncSocketData()->buffer;
  164|  53.6k|        size_t existingBackpressure = backPressure.length();
  165|  53.6k|        if ((!existingBackpressure) && (isCorked() || canCork()) && (loopData->corkOffset + size < LoopData::CORK_BUFFER_SIZE)) {
  ------------------
  |  Branch (165:13): [True: 7.85k, False: 45.8k]
  |  Branch (165:41): [True: 6.26k, False: 1.59k]
  |  Branch (165:55): [True: 1.23k, False: 356]
  |  Branch (165:69): [True: 7.49k, False: 0]
  ------------------
  166|       |            /* Cork automatically if we can */
  167|  7.49k|            if (isCorked()) {
  ------------------
  |  Branch (167:17): [True: 6.26k, False: 1.23k]
  ------------------
  168|  6.26k|                char *sendBuffer = loopData->corkBuffer + loopData->corkOffset;
  169|  6.26k|                loopData->corkOffset += (unsigned int) size;
  170|  6.26k|                return {sendBuffer, SendBufferAttribute::NEEDS_NOTHING};
  171|  6.26k|            } else {
  172|  1.23k|                cork();
  173|  1.23k|                char *sendBuffer = loopData->corkBuffer + loopData->corkOffset;
  174|  1.23k|                loopData->corkOffset += (unsigned int) size;
  175|  1.23k|                return {sendBuffer, SendBufferAttribute::NEEDS_UNCORK};
  176|  1.23k|            }
  177|  46.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|  46.1k|            unsigned int ourCorkOffset = 0;
  182|  46.1k|            if (isCorked() && loopData->corkOffset) {
  ------------------
  |  Branch (182:17): [True: 31.7k, False: 14.4k]
  |  Branch (182:31): [True: 0, False: 31.7k]
  ------------------
  183|      0|                ourCorkOffset = loopData->corkOffset;
  184|      0|                loopData->corkOffset = 0;
  185|      0|            }
  186|       |
  187|       |            /* Fallback is to use the backpressure as buffer */
  188|  46.1k|            backPressure.resize(ourCorkOffset + existingBackpressure + size);
  189|       |
  190|       |            /* And copy corkbuffer in front */
  191|  46.1k|            memcpy((char *) backPressure.data() + existingBackpressure, loopData->corkBuffer, ourCorkOffset);
  192|       |
  193|  46.1k|            return {(char *) backPressure.data() + ourCorkOffset + existingBackpressure, SendBufferAttribute::NEEDS_DRAIN};
  194|  46.1k|        }
  195|  53.6k|    }
_ZN3uWS11AsyncSocketILb0EE13corkUncheckedEv:
  121|   108k|    void corkUnchecked() {
  122|       |        /* What if another socket is corked? */
  123|   108k|        getLoopData()->corkedSocket = this;
  124|   108k|    }

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

_ZN3uWS11BloomFilter5resetEv:
   75|   114k|    void reset() {
   76|   114k|        filter.reset();
   77|   114k|    }
_ZN3uWS11BloomFilter3addENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   64|   353k|    void add(std::string_view key) {
   65|   353k|        if (key.length() >= 2) {
  ------------------
  |  Branch (65:13): [True: 291k, False: 61.7k]
  ------------------
   66|   291k|            ScrambleArea s = getFeatures(key);
   67|   291k|            s.val = perfectHash(s.val);
   68|   291k|            filter[s.p[0]] = 1;
   69|   291k|            filter[s.p[1]] = 1;
   70|   291k|            filter[s.p[2]] = 1;
   71|   291k|            filter[s.p[3]] = 1;
   72|   291k|        }
   73|   353k|    }
_ZN3uWS11BloomFilter11getFeaturesENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   41|  1.29M|    ScrambleArea getFeatures(std::string_view key) {
   42|  1.29M|        ScrambleArea s;
   43|  1.29M|        s.p[0] = reinterpret_cast<const unsigned char&>(key[0]);
   44|  1.29M|        s.p[1] = reinterpret_cast<const unsigned char&>(key[key.length() - 1]);
   45|  1.29M|        s.p[2] = reinterpret_cast<const unsigned char&>(key[key.length() - 2]);
   46|  1.29M|        s.p[3] = reinterpret_cast<const unsigned char&>(key[key.length() >> 1]);
   47|  1.29M|        return s;
   48|  1.29M|    }
_ZN3uWS11BloomFilter11perfectHashEj:
   32|  1.29M|    static inline uint32_t perfectHash(uint32_t features) {
   33|  1.29M|        return features *= 1843993368;
   34|  1.29M|    }
_ZN3uWS11BloomFilter9mightHaveENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   51|  1.00M|    bool mightHave(std::string_view key) {
   52|  1.00M|        if (key.length() < 2) {
  ------------------
  |  Branch (52:13): [True: 0, False: 1.00M]
  ------------------
   53|      0|            return true;
   54|      0|        }
   55|       |    
   56|  1.00M|        ScrambleArea s = getFeatures(key);
   57|  1.00M|        s.val = perfectHash(s.val);
   58|  1.00M|        return filter[s.p[0]] &&
  ------------------
  |  Branch (58:16): [True: 457k, False: 548k]
  ------------------
   59|  1.00M|        filter[s.p[1]] &&
  ------------------
  |  Branch (59:9): [True: 252k, False: 205k]
  ------------------
   60|  1.00M|        filter[s.p[2]] &&
  ------------------
  |  Branch (60:9): [True: 250k, False: 1.19k]
  ------------------
   61|  1.00M|        filter[s.p[3]];
  ------------------
  |  Branch (61:9): [True: 243k, False: 7.47k]
  ------------------
   62|  1.00M|    }

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

_ZN3uWS10HttpParser17consumePostPaddedEPcjPvS2_ON5ofats13any_invocableIFS2_S2_PNS_11HttpRequestEEEEONS4_IFS2_S2_NSt3__117basic_string_viewIcNSA_11char_traitsIcEEEEbEEE:
  527|   370k|    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|   370k|        HttpRequest req;
  532|       |
  533|   370k|        if (remainingStreamingBytes) {
  ------------------
  |  Branch (533:13): [True: 0, False: 370k]
  ------------------
  534|       |
  535|       |            /* It's either chunked or with a content-length */
  536|      0|            if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (536:17): [True: 0, False: 0]
  ------------------
  537|      0|                std::string_view dataToConsume(data, length);
  538|      0|                for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (538:33): [True: 0, False: 0]
  ------------------
  539|      0|                    dataHandler(user, chunk, chunk.length() == 0);
  540|      0|                }
  541|      0|                if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (541:21): [True: 0, False: 0]
  ------------------
  542|      0|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  543|      0|                }
  544|      0|                data = (char *) dataToConsume.data();
  545|      0|                length = (unsigned int) dataToConsume.length();
  546|      0|            } else {
  547|       |                // this is exactly the same as below!
  548|       |                // todo: refactor this
  549|      0|                if (remainingStreamingBytes >= length) {
  ------------------
  |  Branch (549:21): [True: 0, False: 0]
  ------------------
  550|      0|                    void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == length);
  551|      0|                    remainingStreamingBytes -= length;
  552|      0|                    return {0, returnedUser};
  553|      0|                } else {
  554|      0|                    void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  555|       |
  556|      0|                    data += remainingStreamingBytes;
  557|      0|                    length -= remainingStreamingBytes;
  558|       |
  559|      0|                    remainingStreamingBytes = 0;
  560|       |
  561|      0|                    if (returnedUser != user) {
  ------------------
  |  Branch (561:25): [True: 0, False: 0]
  ------------------
  562|      0|                        return {0, returnedUser};
  563|      0|                    }
  564|      0|                }
  565|      0|            }
  566|       |
  567|   370k|        } else if (fallback.length()) {
  ------------------
  |  Branch (567:20): [True: 15.0k, False: 355k]
  ------------------
  568|  15.0k|            unsigned int had = (unsigned int) fallback.length();
  569|       |
  570|  15.0k|            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|  15.0k|            fallback.reserve(fallback.length() + maxCopyDistance + std::max<unsigned int>(MINIMUM_HTTP_POST_PADDING, sizeof(std::string)));
  574|  15.0k|            fallback.append(data, maxCopyDistance);
  575|       |
  576|       |            // break here on break
  577|  15.0k|            std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<true>(fallback.data(), (unsigned int) fallback.length(), user, reserved, &req, requestHandler, dataHandler);
  578|  15.0k|            if (consumed.second != user) {
  ------------------
  |  Branch (578:17): [True: 3.21k, False: 11.8k]
  ------------------
  579|  3.21k|                return consumed;
  580|  3.21k|            }
  581|       |
  582|  11.8k|            if (consumed.first) {
  ------------------
  |  Branch (582:17): [True: 0, False: 11.8k]
  ------------------
  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|      0|                fallback.clear();
  588|      0|                data += consumed.first - had;
  589|      0|                length -= consumed.first - had;
  590|       |
  591|      0|                if (remainingStreamingBytes) {
  ------------------
  |  Branch (591:21): [True: 0, False: 0]
  ------------------
  592|       |                    /* It's either chunked or with a content-length */
  593|      0|                    if (isParsingChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (593:25): [True: 0, False: 0]
  ------------------
  594|      0|                        std::string_view dataToConsume(data, length);
  595|      0|                        for (auto chunk : uWS::ChunkIterator(&dataToConsume, &remainingStreamingBytes)) {
  ------------------
  |  Branch (595:41): [True: 0, False: 0]
  ------------------
  596|      0|                            dataHandler(user, chunk, chunk.length() == 0);
  597|      0|                        }
  598|      0|                        if (isParsingInvalidChunkedEncoding(remainingStreamingBytes)) {
  ------------------
  |  Branch (598:29): [True: 0, False: 0]
  ------------------
  599|      0|                            return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  600|      0|                        }
  601|      0|                        data = (char *) dataToConsume.data();
  602|      0|                        length = (unsigned int) dataToConsume.length();
  603|      0|                    } else {
  604|       |                        // this is exactly the same as above!
  605|      0|                        if (remainingStreamingBytes >= (unsigned int) length) {
  ------------------
  |  Branch (605:29): [True: 0, False: 0]
  ------------------
  606|      0|                            void *returnedUser = dataHandler(user, std::string_view(data, length), remainingStreamingBytes == (unsigned int) length);
  607|      0|                            remainingStreamingBytes -= length;
  608|      0|                            return {0, returnedUser};
  609|      0|                        } else {
  610|      0|                            void *returnedUser = dataHandler(user, std::string_view(data, remainingStreamingBytes), true);
  611|       |
  612|      0|                            data += remainingStreamingBytes;
  613|      0|                            length -= remainingStreamingBytes;
  614|       |
  615|      0|                            remainingStreamingBytes = 0;
  616|       |
  617|      0|                            if (returnedUser != user) {
  ------------------
  |  Branch (617:33): [True: 0, False: 0]
  ------------------
  618|      0|                                return {0, returnedUser};
  619|      0|                            }
  620|      0|                        }
  621|      0|                    }
  622|      0|                }
  623|       |
  624|  11.8k|            } else {
  625|  11.8k|                if (fallback.length() == MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (625:21): [True: 196, False: 11.6k]
  ------------------
  626|    196|                    return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  627|    196|                }
  628|  11.6k|                return {0, user};
  629|  11.8k|            }
  630|  11.8k|        }
  631|       |
  632|   355k|        std::pair<unsigned int, void *> consumed = fenceAndConsumePostPadded<false>(data, length, user, reserved, &req, requestHandler, dataHandler);
  633|   355k|        if (consumed.second != user) {
  ------------------
  |  Branch (633:13): [True: 342k, False: 13.8k]
  ------------------
  634|   342k|            return consumed;
  635|   342k|        }
  636|       |
  637|  13.8k|        data += consumed.first;
  638|  13.8k|        length -= consumed.first;
  639|       |
  640|  13.8k|        if (length) {
  ------------------
  |  Branch (640:13): [True: 13.8k, False: 0]
  ------------------
  641|  13.8k|            if (length < MAX_FALLBACK_SIZE) {
  ------------------
  |  Branch (641:17): [True: 13.8k, False: 0]
  ------------------
  642|  13.8k|                fallback.append(data, length);
  643|  13.8k|            } else {
  644|      0|                return {HTTP_ERROR_431_REQUEST_HEADER_FIELDS_TOO_LARGE, FULLPTR};
  645|      0|            }
  646|  13.8k|        }
  647|       |
  648|       |        // added for now
  649|  13.8k|        return {0, user};
  650|  13.8k|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi1EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|  15.0k|    std::pair<unsigned int, void *> fenceAndConsumePostPadded(char *data, unsigned int length, void *user, void *reserved, HttpRequest *req, MoveOnlyFunction<void *(void *, HttpRequest *)> &requestHandler, MoveOnlyFunction<void *(void *, std::string_view, bool)> &dataHandler) {
  398|       |
  399|       |        /* How much data we CONSUMED (to throw away) */
  400|  15.0k|        unsigned int consumedTotal = 0;
  401|  15.0k|        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|  15.0k|        data[length] = '\r';
  406|  15.0k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|  15.0k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 15.0k, False: 0]
  |  Branch (408:47): [True: 3.21k, False: 11.8k]
  ------------------
  409|  3.21k|            data += consumed;
  410|  3.21k|            length -= consumed;
  411|  3.21k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|  3.21k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|  3.21k|            req->bf.reset();
  418|  12.9k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 9.70k, False: 3.21k]
  ------------------
  419|  9.70k|                req->bf.add(h->key);
  420|  9.70k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|  3.21k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 339, False: 2.87k]
  ------------------
  424|    339|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    339|            }
  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|  2.87k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|  2.87k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|  2.87k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 0, False: 2.87k]
  |  Branch (434:52): [True: 0, False: 0]
  ------------------
  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|      0|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|      0|            }
  440|       |
  441|       |            /* Parse query */
  442|  2.87k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|  2.87k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 340, False: 2.53k]
  ------------------
  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|  2.87k|            void *returnedUser = requestHandler(user, req);
  449|  2.87k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 2.87k, False: 0]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|  2.87k|                return {consumedTotal, returnedUser};
  452|  2.87k|            }
  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|      0|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 0, False: 0]
  ------------------
  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|      0|                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|      0|                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|      0|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 0, False: 0]
  ------------------
  494|      0|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|      0|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 0, False: 0]
  ------------------
  496|       |                    /* Parser error */
  497|      0|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|      0|                }
  499|       |
  500|      0|                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|      0|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|      0|                dataHandler(user, {}, true);
  512|      0|            }
  513|       |
  514|       |            /* Consume minimally should break as easrly as possible */
  515|      0|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (515:17): [Folded - Ignored]
  ------------------
  516|      0|                break;
  517|      0|            }
  518|      0|        }
  519|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  520|  11.8k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 0, False: 11.8k]
  ------------------
  521|      0|            return {err, FULLPTR};
  522|      0|        }
  523|  11.8k|        return {consumedTotal, user};
  524|  11.8k|    }
_ZN3uWS10HttpParser10getHeadersEPcS1_PNS_11HttpRequest6HeaderEPvRj:
  286|   370k|    static unsigned int getHeaders(char *postPaddedBuffer, char *end, struct HttpRequest::Header *headers, void *reserved, unsigned int &err) {
  287|   370k|        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|   370k|            (void) reserved;
  307|   370k|            (void) end;
  308|   370k|        #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|   370k|        if (!(postPaddedBuffer = consumeRequestLine(postPaddedBuffer, headers[0]))) {
  ------------------
  |  Branch (316:13): [True: 230k, False: 140k]
  ------------------
  317|       |            /* Error - invalid request line */
  318|       |            /* Assuming it is 505 HTTP Version Not Supported */
  319|   230k|            err = HTTP_ERROR_505_HTTP_VERSION_NOT_SUPPORTED;
  320|   230k|            return 0;
  321|   230k|        }
  322|   140k|        headers++;
  323|       |
  324|   444k|        for (unsigned int i = 1; i < HttpRequest::MAX_HEADERS - 1; i++) {
  ------------------
  |  Branch (324:34): [True: 444k, False: 194]
  ------------------
  325|       |            /* Lower case and consume the field name */
  326|   444k|            preliminaryKey = postPaddedBuffer;
  327|   444k|            postPaddedBuffer = (char *) consumeFieldName(postPaddedBuffer);
  328|   444k|            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|   444k|            if (postPaddedBuffer[0] != ':') {
  ------------------
  |  Branch (331:17): [True: 5.16k, False: 439k]
  ------------------
  332|       |                /* Error: invalid chars in field name */
  333|  5.16k|                return 0;
  334|  5.16k|            }
  335|   439k|            postPaddedBuffer++;
  336|       |
  337|   439k|            preliminaryValue = postPaddedBuffer;
  338|       |            /* The goal of this call is to find next "\r\n", or any invalid field value chars, fast */
  339|   441k|            while (true) {
  ------------------
  |  Branch (339:20): [Folded - Ignored]
  ------------------
  340|   441k|                postPaddedBuffer = (char *) tryConsumeFieldValue(postPaddedBuffer);
  341|       |                /* If this is not CR then we caught some stinky invalid char on the way */
  342|   441k|                if (postPaddedBuffer[0] != '\r') {
  ------------------
  |  Branch (342:21): [True: 5.61k, False: 436k]
  ------------------
  343|       |                    /* If TAB then keep searching */
  344|  5.61k|                    if (postPaddedBuffer[0] == '\t') {
  ------------------
  |  Branch (344:25): [True: 2.84k, False: 2.77k]
  ------------------
  345|  2.84k|                        postPaddedBuffer++;
  346|  2.84k|                        continue;
  347|  2.84k|                    }
  348|       |                    /* Error - invalid chars in field value */
  349|  2.77k|                    return 0;
  350|  5.61k|                }
  351|   436k|                break;
  352|   441k|            }
  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|   436k|            if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (355:17): [True: 419k, False: 16.5k]
  ------------------
  356|       |                /* Store this header, it is valid */
  357|   419k|                headers->value = std::string_view(preliminaryValue, (size_t) (postPaddedBuffer - preliminaryValue));
  358|   419k|                postPaddedBuffer += 2;
  359|       |
  360|       |                /* Trim trailing whitespace (SP, HTAB) */
  361|   519k|                while (headers->value.length() && headers->value.back() < 33) {
  ------------------
  |  Branch (361:24): [True: 481k, False: 37.7k]
  |  Branch (361:51): [True: 100k, False: 381k]
  ------------------
  362|   100k|                    headers->value.remove_suffix(1);
  363|   100k|                }
  364|       |
  365|       |                /* Trim initial whitespace (SP, HTAB) */
  366|   471k|                while (headers->value.length() && headers->value.front() < 33) {
  ------------------
  |  Branch (366:24): [True: 433k, False: 37.7k]
  |  Branch (366:51): [True: 51.4k, False: 381k]
  ------------------
  367|  51.4k|                    headers->value.remove_prefix(1);
  368|  51.4k|                }
  369|       |                
  370|   419k|                headers++;
  371|       |
  372|       |                /* We definitely have at least one header (or request line), so check if we are done */
  373|   419k|                if (*postPaddedBuffer == '\r') {
  ------------------
  |  Branch (373:21): [True: 115k, False: 304k]
  ------------------
  374|   115k|                    if (postPaddedBuffer[1] == '\n') {
  ------------------
  |  Branch (374:25): [True: 114k, False: 936]
  ------------------
  375|       |                        /* This cann take the very last header space */
  376|   114k|                        headers->key = std::string_view(nullptr, 0);
  377|   114k|                        return (unsigned int) ((postPaddedBuffer + 2) - start);
  378|   114k|                    } else {
  379|       |                        /* \r\n\r plus non-\n letter is malformed request, or simply out of search space */
  380|    936|                        return 0;
  381|    936|                    }
  382|   115k|                }
  383|   419k|            } else {
  384|       |                /* We are either out of search space or this is a malformed request */
  385|  16.5k|                return 0;
  386|  16.5k|            }
  387|   436k|        }
  388|       |        /* We ran out of header space, too large request */
  389|    194|        return 0;
  390|   140k|    }
_ZN3uWS10HttpParser18consumeRequestLineEPcRNS_11HttpRequest6HeaderE:
  242|   370k|    static inline char *consumeRequestLine(char *data, HttpRequest::Header &header) {
  243|       |        /* Scan until single SP, assume next is / (origin request) */
  244|   370k|        char *start = data;
  245|       |        /* This catches the post padded CR and fails */
  246|  1.84M|        while (data[0] > 32) data++;
  ------------------
  |  Branch (246:16): [True: 1.46M, False: 370k]
  ------------------
  247|   370k|        if (data[0] == 32 && data[1] == '/') {
  ------------------
  |  Branch (247:13): [True: 179k, False: 191k]
  |  Branch (247:30): [True: 147k, False: 31.0k]
  ------------------
  248|   147k|            header.key = {start, (size_t) (data - start)};
  249|   147k|            data++;
  250|       |            /* Scan for less than 33 (catches post padded CR and fails) */
  251|   147k|            start = data;
  252|   243k|            for (; true; data += 8) {
  ------------------
  |  Branch (252:20): [Folded - Ignored]
  ------------------
  253|   243k|                uint64_t word;
  254|   243k|                memcpy(&word, data, sizeof(uint64_t));
  255|   243k|                if (hasLess(word, 33)) {
  ------------------
  |  Branch (255:21): [True: 147k, False: 95.1k]
  ------------------
  256|   660k|                    while (*(unsigned char *)data > 32) data++;
  ------------------
  |  Branch (256:28): [True: 512k, False: 147k]
  ------------------
  257|       |                    /* Now we stand on space */
  258|   147k|                    header.value = {start, (size_t) (data - start)};
  259|       |                    /* Check that the following is http 1.1 */
  260|   147k|                    if (memcmp(" HTTP/1.1\r\n", data, 11) == 0) {
  ------------------
  |  Branch (260:25): [True: 140k, False: 7.76k]
  ------------------
  261|   140k|                        return data + 11;
  262|   140k|                    }
  263|  7.76k|                    return nullptr;
  264|   147k|                }
  265|   243k|            }
  266|   147k|        }
  267|   222k|        return nullptr;
  268|   370k|    }
_ZN3uWS10HttpParser7hasLessEmm:
  206|  2.09M|    static inline uint64_t hasLess(uint64_t x, uint64_t n) {
  207|  2.09M|        return (((x)-~0ULL/255*(n))&~(x)&~0ULL/255*128);
  208|  2.09M|    }
_ZN3uWS10HttpParser16consumeFieldNameEPc:
  226|   444k|    static inline void *consumeFieldName(char *p) {
  227|   781k|        for (; true; p += 8) {
  ------------------
  |  Branch (227:16): [Folded - Ignored]
  ------------------
  228|   781k|            uint64_t word;
  229|   781k|            memcpy(&word, p, sizeof(uint64_t));
  230|   781k|            if (notFieldNameWord(word)) {
  ------------------
  |  Branch (230:17): [True: 444k, False: 337k]
  ------------------
  231|  1.40M|                while (isFieldNameByte(*(unsigned char *)p)) {
  ------------------
  |  Branch (231:24): [True: 964k, False: 444k]
  ------------------
  232|   964k|                    *(p++) |= 0x20;
  233|   964k|                }
  234|   444k|                return (void *)p;
  235|   444k|            }
  236|   337k|            word |= 0x2020202020202020ull;
  237|   337k|            memcpy(p, &word, sizeof(uint64_t));
  238|   337k|        }
  239|   444k|    }
_ZN3uWS10HttpParser16notFieldNameWordEm:
  218|   781k|    static inline bool notFieldNameWord(uint64_t x) {
  219|   781k|        return hasLess(x, '-') |
  220|   781k|        hasBetween(x, '-', '0') |
  221|   781k|        hasBetween(x, '9', 'A') |
  222|   781k|        hasBetween(x, 'Z', 'a') |
  223|   781k|        hasMore(x, 'z');
  224|   781k|    }
_ZN3uWS10HttpParser10hasBetweenEmmm:
  214|  2.34M|    static inline uint64_t hasBetween(uint64_t x, uint64_t m, uint64_t n) {
  215|  2.34M|        return (( (~0ULL/255*(127+(n))-((x)&~0ULL/255*127)) &~(x)& (((x)&~0ULL/255*127)+~0ULL/255*(127-(m))) )&~0ULL/255*128);
  216|  2.34M|    }
_ZN3uWS10HttpParser7hasMoreEmm:
  210|   781k|    static inline uint64_t hasMore(uint64_t x, uint64_t n) {
  211|   781k|        return (( ((x)+~0ULL/255*(127-(n))) |(x))&~0ULL/255*128);
  212|   781k|    }
_ZN3uWS10HttpParser15isFieldNameByteEh:
  199|  1.40M|    static inline bool isFieldNameByte(unsigned char x) {
  200|  1.40M|        return (x == '-') |
  201|  1.40M|        ((x > '/') & (x < ':')) |
  202|  1.40M|        ((x > '@') & (x < '[')) |
  203|  1.40M|        ((x > 96) & (x < '{'));
  204|  1.40M|    }
_ZN3uWS10HttpParser20tryConsumeFieldValueEPc:
  274|   441k|    static inline void *tryConsumeFieldValue(char *p) {
  275|  1.06M|        for (; true; p += 8) {
  ------------------
  |  Branch (275:16): [Folded - Ignored]
  ------------------
  276|  1.06M|            uint64_t word;
  277|  1.06M|            memcpy(&word, p, sizeof(uint64_t));
  278|  1.06M|            if (hasLess(word, 32)) {
  ------------------
  |  Branch (278:17): [True: 441k, False: 627k]
  ------------------
  279|  1.56M|                while (*(unsigned char *)p > 31) p++;
  ------------------
  |  Branch (279:24): [True: 1.12M, False: 441k]
  ------------------
  280|   441k|                return (void *)p;
  281|   441k|            }
  282|  1.06M|        }
  283|   441k|    }
_ZN3uWS11HttpRequest9getHeaderENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
  103|  1.00M|    std::string_view getHeader(std::string_view lowerCasedHeader) {
  104|  1.00M|        if (bf.mightHave(lowerCasedHeader)) {
  ------------------
  |  Branch (104:13): [True: 243k, False: 763k]
  ------------------
  105|   602k|            for (Header *h = headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (105:39): [True: 600k, False: 2.25k]
  ------------------
  106|   600k|                if (h->key.length() == lowerCasedHeader.length() && !strncmp(h->key.data(), lowerCasedHeader.data(), lowerCasedHeader.length())) {
  ------------------
  |  Branch (106:21): [True: 243k, False: 356k]
  |  Branch (106:69): [True: 241k, False: 2.69k]
  ------------------
  107|   241k|                    return h->value;
  108|   241k|                }
  109|   600k|            }
  110|   243k|        }
  111|   765k|        return std::string_view(nullptr, 0);
  112|  1.00M|    }
_ZN3uWS10HttpParser25fenceAndConsumePostPaddedILi0EEENSt3__14pairIjPvEEPcjS4_S4_PNS_11HttpRequestERN5ofats13any_invocableIFS4_S4_S8_EEERNSA_IFS4_S4_NS2_17basic_string_viewIcNS2_11char_traitsIcEEEEbEEE:
  397|   355k|    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|   355k|        unsigned int consumedTotal = 0;
  401|   355k|        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|   355k|        data[length] = '\r';
  406|   355k|        data[length + 1] = 'a'; /* Anything that is not \n, to trigger "invalid request" */
  407|       |
  408|   355k|        for (unsigned int consumed; length && (consumed = getHeaders(data, data + length, req->headers, reserved, err)); ) {
  ------------------
  |  Branch (408:37): [True: 355k, False: 0]
  |  Branch (408:47): [True: 111k, False: 244k]
  ------------------
  409|   111k|            data += consumed;
  410|   111k|            length -= consumed;
  411|   111k|            consumedTotal += consumed;
  412|       |
  413|       |            /* Store HTTP version (ancient 1.0 or 1.1) */
  414|   111k|            req->ancientHttp = false;
  415|       |
  416|       |            /* Add all headers to bloom filter */
  417|   111k|            req->bf.reset();
  418|   455k|            for (HttpRequest::Header *h = req->headers; (++h)->key.length(); ) {
  ------------------
  |  Branch (418:57): [True: 343k, False: 111k]
  ------------------
  419|   343k|                req->bf.add(h->key);
  420|   343k|            }
  421|       |            
  422|       |            /* Break if no host header (but we can have empty string which is different from nullptr) */
  423|   111k|            if (!req->getHeader("host").data()) {
  ------------------
  |  Branch (423:17): [True: 579, False: 110k]
  ------------------
  424|    579|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  425|    579|            }
  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|   110k|            std::string_view transferEncodingString = req->getHeader("transfer-encoding");
  433|   110k|            std::string_view contentLengthString = req->getHeader("content-length");
  434|   110k|            if (transferEncodingString.length() && contentLengthString.length()) {
  ------------------
  |  Branch (434:17): [True: 0, False: 110k]
  |  Branch (434:52): [True: 0, False: 0]
  ------------------
  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|      0|                return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  439|      0|            }
  440|       |
  441|       |            /* Parse query */
  442|   110k|            const char *querySeparatorPtr = (const char *) memchr(req->headers->value.data(), '?', req->headers->value.length());
  443|   110k|            req->querySeparator = (unsigned int) ((querySeparatorPtr ? querySeparatorPtr : req->headers->value.data() + req->headers->value.length()) - req->headers->value.data());
  ------------------
  |  Branch (443:52): [True: 30.5k, False: 80.2k]
  ------------------
  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|   110k|            void *returnedUser = requestHandler(user, req);
  449|   110k|            if (returnedUser != user) {
  ------------------
  |  Branch (449:17): [True: 110k, False: 0]
  ------------------
  450|       |                /* We are upgraded to WebSocket or otherwise broken */
  451|   110k|                return {consumedTotal, returnedUser};
  452|   110k|            }
  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|      0|            if (transferEncodingString.length()) {
  ------------------
  |  Branch (463:17): [True: 0, False: 0]
  ------------------
  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|      0|                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|      0|                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|      0|            } else if (contentLengthString.length()) {
  ------------------
  |  Branch (493:24): [True: 0, False: 0]
  ------------------
  494|      0|                remainingStreamingBytes = toUnsignedInteger(contentLengthString);
  495|      0|                if (remainingStreamingBytes == UINT_MAX) {
  ------------------
  |  Branch (495:21): [True: 0, False: 0]
  ------------------
  496|       |                    /* Parser error */
  497|      0|                    return {HTTP_ERROR_400_BAD_REQUEST, FULLPTR};
  498|      0|                }
  499|       |
  500|      0|                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|      0|            } else {
  510|       |                /* If we came here without a body; emit an empty data chunk to signal no data */
  511|      0|                dataHandler(user, {}, true);
  512|      0|            }
  513|       |
  514|       |            /* Consume minimally should break as easrly as possible */
  515|      0|            if (CONSUME_MINIMALLY) {
  ------------------
  |  Branch (515:17): [Folded - Ignored]
  ------------------
  516|      0|                break;
  517|      0|            }
  518|      0|        }
  519|       |        /* Whenever we return FULLPTR, the interpretation of "consumed" should be the HttpError enum. */
  520|   244k|        if (err) {
  ------------------
  |  Branch (520:13): [True: 230k, False: 13.8k]
  ------------------
  521|   230k|            return {err, FULLPTR};
  522|   230k|        }
  523|  13.8k|        return {consumedTotal, user};
  524|   244k|    }
_ZN3uWS11HttpRequest9isAncientEv:
   60|   113k|    bool isAncient() {
   61|   113k|        return ancientHttp;
   62|   113k|    }
_ZN3uWS11HttpRequest22getCaseSensitiveMethodEv:
  123|   113k|    std::string_view getCaseSensitiveMethod() {
  124|   113k|        return std::string_view(headers->key.data(), headers->key.length());
  125|   113k|    }
_ZN3uWS11HttpRequest6getUrlEv:
  114|   113k|    std::string_view getUrl() {
  115|   113k|        return std::string_view(headers->value.data(), querySeparator);
  116|   113k|    }
_ZN3uWS11HttpRequest8setYieldEb:
   99|   117k|    void setYield(bool yield) {
  100|   117k|        didYield = yield;
  101|   117k|    }
_ZN3uWS11HttpRequest13setParametersENSt3__14pairIiPNS1_17basic_string_viewIcNS1_11char_traitsIcEEEEEE:
  154|   113k|    void setParameters(std::pair<int, std::string_view *> parameters) {
  155|   113k|        currentParameters = parameters;
  156|   113k|    }
_ZN3uWS11HttpRequest8getYieldEv:
   64|   113k|    bool getYield() {
   65|   113k|        return didYield;
   66|   113k|    }

_ZN3uWS12HttpResponseILb0EE19getHttpResponseDataEv:
   52|  1.08M|    HttpResponseData<SSL> *getHttpResponseData() {
   53|  1.08M|        return (HttpResponseData<SSL> *) Super::getAsyncSocketData();
   54|  1.08M|    }
_ZN3uWS12HttpResponseILb0EE13writeContinueEv:
  377|    194|    HttpResponse *writeContinue() {
  378|    194|        Super::write("HTTP/1.1 100 Continue\r\n\r\n", 25);
  379|    194|        return this;
  380|    194|    }
EpollEchoServer.cpp:_ZN3uWS12HttpResponseILb0EE7upgradeIZ4testvE13PerSocketDataEEvOT_NSt3__117basic_string_viewIcNS6_11char_traitsIcEEEESA_SA_P19us_socket_context_t:
  239|   108k|            struct us_socket_context_t *webSocketContext) {
  240|       |
  241|       |        /* Extract needed parameters from WebSocketContextData */
  242|   108k|        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|   108k|        char secWebSocketAccept[29] = {};
  246|   108k|        WebSocketHandshake::generate(secWebSocketKey.data(), secWebSocketAccept);
  247|       |
  248|   108k|        writeStatus("101 Switching Protocols")
  249|   108k|            ->writeHeader("Upgrade", "websocket")
  250|   108k|            ->writeHeader("Connection", "Upgrade")
  251|   108k|            ->writeHeader("Sec-WebSocket-Accept", secWebSocketAccept);
  252|       |
  253|       |        /* Select first subprotocol if present */
  254|   108k|        if (secWebSocketProtocol.length()) {
  ------------------
  |  Branch (254:13): [True: 520, False: 107k]
  ------------------
  255|    520|            writeHeader("Sec-WebSocket-Protocol", secWebSocketProtocol.substr(0, secWebSocketProtocol.find(',')));
  256|    520|        }
  257|       |
  258|       |        /* Negotiate compression */
  259|   108k|        bool perMessageDeflate = false;
  260|   108k|        CompressOptions compressOptions = CompressOptions::DISABLED;
  261|   108k|        if (secWebSocketExtensions.length() && webSocketContextData->compression != DISABLED) {
  ------------------
  |  Branch (261:13): [True: 8.36k, False: 99.9k]
  |  Branch (261:48): [True: 8.07k, False: 286]
  ------------------
  262|       |
  263|       |            /* Make sure to map SHARED_DECOMPRESSOR to windowBits = 0, not 1  */
  264|  8.07k|            int wantedInflationWindow = 0;
  265|  8.07k|            if ((webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) != CompressOptions::SHARED_DECOMPRESSOR) {
  ------------------
  |  Branch (265:17): [True: 8.07k, False: 0]
  ------------------
  266|  8.07k|                wantedInflationWindow = (webSocketContextData->compression & CompressOptions::_DECOMPRESSOR_MASK) >> 8;
  267|  8.07k|            }
  268|       |
  269|       |            /* Map from selected compressor (this automatically maps SHARED_COMPRESSOR to windowBits 0, not 1) */
  270|  8.07k|            int wantedCompressionWindow = (webSocketContextData->compression & CompressOptions::_COMPRESSOR_MASK) >> 4;
  271|       |
  272|  8.07k|            auto [negCompression, negCompressionWindow, negInflationWindow, negResponse] =
  273|  8.07k|            negotiateCompression(true, wantedCompressionWindow, wantedInflationWindow,
  274|  8.07k|                                        secWebSocketExtensions);
  275|       |
  276|  8.07k|            if (negCompression) {
  ------------------
  |  Branch (276:17): [True: 4.18k, False: 3.88k]
  ------------------
  277|  4.18k|                perMessageDeflate = true;
  278|       |
  279|       |                /* Map from negotiated windowBits to compressor and decompressor */
  280|  4.18k|                if (negCompressionWindow == 0) {
  ------------------
  |  Branch (280:21): [True: 2.21k, False: 1.97k]
  ------------------
  281|  2.21k|                    compressOptions = CompressOptions::SHARED_COMPRESSOR;
  282|  2.21k|                } else {
  283|  1.97k|                    compressOptions = (CompressOptions) ((uint32_t) (negCompressionWindow << 4)
  284|  1.97k|                                                        | (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|  1.97k|                    if (webSocketContextData->compression & DEDICATED_COMPRESSOR_3KB) {
  ------------------
  |  Branch (288:25): [True: 1.97k, False: 0]
  ------------------
  289|  1.97k|                        compressOptions = DEDICATED_COMPRESSOR_3KB;
  290|  1.97k|                    }
  291|  1.97k|                }
  292|       |
  293|       |                /* Here we modify the above compression with negotiated decompressor */
  294|  4.18k|                if (negInflationWindow == 0) {
  ------------------
  |  Branch (294:21): [True: 4.18k, False: 0]
  ------------------
  295|  4.18k|                    compressOptions = CompressOptions(compressOptions | CompressOptions::SHARED_DECOMPRESSOR);
  296|  4.18k|                } else {
  297|      0|                    compressOptions = CompressOptions(compressOptions | (negInflationWindow << 8));
  298|      0|                }
  299|       |
  300|  4.18k|                writeHeader("Sec-WebSocket-Extensions", negResponse);
  301|  4.18k|            }
  302|  8.07k|        }
  303|       |
  304|   108k|        internalEnd({nullptr, 0}, 0, false, false);
  305|       |
  306|       |        /* Grab the httpContext from res */
  307|   108k|        HttpContext<SSL> *httpContext = (HttpContext<SSL> *) us_socket_context(SSL, (struct us_socket_t *) this);
  308|       |
  309|       |        /* Move any backpressure out of HttpResponse */
  310|   108k|        BackPressure backpressure(std::move(((AsyncSocketData<SSL> *) getHttpResponseData())->buffer));
  311|       |
  312|       |        /* Destroy HttpResponseData */
  313|   108k|        getHttpResponseData()->~HttpResponseData();
  314|       |
  315|       |        /* Before we adopt and potentially change socket, check if we are corked */
  316|   108k|        bool wasCorked = Super::isCorked();
  317|       |
  318|       |        /* Adopting a socket invalidates it, do not rely on it directly to carry any data */
  319|   108k|        WebSocket<SSL, true, UserData> *webSocket = (WebSocket<SSL, true, UserData> *) us_socket_context_adopt_socket(SSL,
  320|   108k|                    (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|   108k|        if (wasCorked) {
  ------------------
  |  Branch (323:13): [True: 108k, False: 0]
  ------------------
  324|   108k|            webSocket->AsyncSocket<SSL>::corkUnchecked();
  325|   108k|        }
  326|       |
  327|       |        /* Initialize websocket with any moved backpressure intact */
  328|   108k|        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|   108k|        HttpContextData<SSL> *httpContextData = httpContext->getSocketContextData();
  332|   108k|        if (httpContextData->isParsingHttp) {
  ------------------
  |  Branch (332:13): [True: 108k, False: 0]
  ------------------
  333|       |            /* We need to tell the Http parser that we changed socket */
  334|   108k|            httpContextData->upgradedWebSocket = webSocket;
  335|   108k|        }
  336|       |
  337|       |        /* Arm maxLifetime timeout */
  338|   108k|        us_socket_long_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->maxLifetime);
  339|       |
  340|       |        /* Arm idleTimeout */
  341|   108k|        us_socket_timeout(SSL, (us_socket_t *) webSocket, webSocketContextData->idleTimeoutComponents.first);
  342|       |
  343|       |        /* Move construct the UserData right before calling open handler */
  344|   108k|        new (webSocket->getUserData()) UserData(std::move(userData));
  345|       |
  346|       |        /* Emit open event and start the timeout */
  347|   108k|        if (webSocketContextData->openHandler) {
  ------------------
  |  Branch (347:13): [True: 108k, False: 0]
  ------------------
  348|   108k|            webSocketContextData->openHandler(webSocket);
  349|   108k|        }
  350|   108k|    }
_ZN3uWS12HttpResponseILb0EE11writeStatusENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
  383|   762k|    HttpResponse *writeStatus(std::string_view status) {
  384|   762k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  385|       |
  386|       |        /* Do not allow writing more than one status */
  387|   762k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_STATUS_CALLED) {
  ------------------
  |  Branch (387:13): [True: 654k, False: 108k]
  ------------------
  388|   654k|            return this;
  389|   654k|        }
  390|       |
  391|       |        /* Update status */
  392|   108k|        httpResponseData->state |= HttpResponseData<SSL>::HTTP_STATUS_CALLED;
  393|       |
  394|   108k|        Super::write("HTTP/1.1 ", 9);
  395|   108k|        Super::write(status.data(), (int) status.length());
  396|   108k|        Super::write("\r\n", 2);
  397|   108k|        return this;
  398|   762k|    }
_ZN3uWS12HttpResponseILb0EE11writeHeaderENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEES6_:
  401|   546k|    HttpResponse *writeHeader(std::string_view key, std::string_view value) {
  402|   546k|        writeStatus(HTTP_200_OK);
  403|       |
  404|   546k|        Super::write(key.data(), (int) key.length());
  405|   546k|        Super::write(": ", 2);
  406|   546k|        Super::write(value.data(), (int) value.length());
  407|   546k|        Super::write("\r\n", 2);
  408|   546k|        return this;
  409|   546k|    }
_ZN3uWS12HttpResponseILb0EE11internalEndENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEmbbb:
   92|   108k|    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|   108k|        writeStatus(HTTP_200_OK);
   95|       |
   96|       |        /* If no total size given then assume this chunk is everything */
   97|   108k|        if (!totalSize) {
  ------------------
  |  Branch (97:13): [True: 108k, False: 0]
  ------------------
   98|   108k|            totalSize = data.length();
   99|   108k|        }
  100|       |
  101|   108k|        HttpResponseData<SSL> *httpResponseData = getHttpResponseData();
  102|       |
  103|       |        /* In some cases, such as when refusing huge data we want to close the connection when drained */
  104|   108k|        if (closeConnection) {
  ------------------
  |  Branch (104:13): [True: 0, False: 108k]
  ------------------
  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|   108k|        if (httpResponseData->state & HttpResponseData<SSL>::HTTP_WRITE_CALLED) {
  ------------------
  |  Branch (118:13): [True: 0, False: 108k]
  ------------------
  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|      0|            if (data.length()) {
  ------------------
  |  Branch (123:17): [True: 0, False: 0]
  ------------------
  124|      0|                Super::write("\r\n", 2);
  125|      0|                writeUnsignedHex((unsigned int) data.length());
  126|      0|                Super::write("\r\n", 2);
  127|       |
  128|       |                /* Ignoring optional for now */
  129|      0|                Super::write(data.data(), (int) data.length());
  130|      0|            }
  131|       |
  132|       |            /* Terminating 0 chunk */
  133|      0|            Super::write("\r\n0\r\n\r\n", 7);
  134|       |
  135|      0|            httpResponseData->markDone();
  136|       |
  137|       |            /* We need to check if we should close this socket here now */
  138|      0|            if (!Super::isCorked()) {
  ------------------
  |  Branch (138:17): [True: 0, False: 0]
  ------------------
  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|      0|            Super::timeout(HTTP_TIMEOUT_S);
  154|      0|            return true;
  155|   108k|        } else {
  156|       |            /* Write content-length on first call */
  157|   108k|            if (!(httpResponseData->state & HttpResponseData<SSL>::HTTP_END_CALLED)) {
  ------------------
  |  Branch (157:17): [True: 108k, False: 0]
  ------------------
  158|       |                /* Write mark, this propagates to WebSockets too */
  159|   108k|                writeMark();
  160|       |
  161|       |                /* WebSocket upgrades does not allow content-length */
  162|   108k|                if (allowContentLength) {
  ------------------
  |  Branch (162:21): [True: 0, False: 108k]
  ------------------
  163|       |                    /* Even zero is a valid content-length */
  164|      0|                    Super::write("Content-Length: ", 16);
  165|      0|                    writeUnsigned64(totalSize);
  166|      0|                    Super::write("\r\n\r\n", 4);
  167|   108k|                } else {
  168|   108k|                    Super::write("\r\n", 2);
  169|   108k|                }
  170|       |
  171|       |                /* Mark end called */
  172|   108k|                httpResponseData->state |= HttpResponseData<SSL>::HTTP_END_CALLED;
  173|   108k|            }
  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|   108k|            size_t written = 0;
  180|   108k|            bool failed = false;
  181|   108k|            while (written < data.length() && !failed) {
  ------------------
  |  Branch (181:20): [True: 0, False: 108k]
  |  Branch (181:47): [True: 0, False: 0]
  ------------------
  182|       |                /* uSockets only deals with int sizes, so pass chunks of max signed int size */
  183|      0|                auto writtenFailed = Super::write(data.data() + written, (int) std::min<size_t>(data.length() - written, INT_MAX), optional);
  184|       |
  185|      0|                written += (size_t) writtenFailed.first;
  186|      0|                failed = writtenFailed.second;
  187|      0|            }
  188|       |
  189|   108k|            httpResponseData->offset += written;
  190|       |
  191|       |            /* Success is when we wrote the entire thing without any failures */
  192|   108k|            bool success = written == data.length() && !failed;
  ------------------
  |  Branch (192:28): [True: 108k, False: 0]
  |  Branch (192:56): [True: 108k, False: 0]
  ------------------
  193|       |
  194|       |            /* If we are now at the end, start a timeout. Also start a timeout if we failed. */
  195|   108k|            if (!success || httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (195:17): [True: 0, False: 108k]
  |  Branch (195:29): [True: 108k, False: 0]
  ------------------
  196|   108k|                Super::timeout(HTTP_TIMEOUT_S);
  197|   108k|            }
  198|       |
  199|       |            /* Remove onAborted function if we reach the end */
  200|   108k|            if (httpResponseData->offset == totalSize) {
  ------------------
  |  Branch (200:17): [True: 108k, False: 0]
  ------------------
  201|   108k|                httpResponseData->markDone();
  202|       |
  203|       |                /* We need to check if we should close this socket here now */
  204|   108k|                if (!Super::isCorked()) {
  ------------------
  |  Branch (204:21): [True: 0, False: 108k]
  ------------------
  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|   108k|            }
  217|       |
  218|   108k|            return success;
  219|   108k|        }
  220|   108k|    }
_ZN3uWS12HttpResponseILb0EE9writeMarkEv:
   77|   108k|    void writeMark() {
   78|       |        /* Date is always written */
   79|   108k|        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|   108k|#ifndef UWS_HTTPRESPONSE_NO_WRITEMARK
   83|   108k|        if (!Super::getLoopData()->noMark) {
  ------------------
  |  Branch (83:13): [True: 108k, False: 0]
  ------------------
   84|       |            /* We only expose major version */
   85|   108k|            writeHeader("uWebSockets", "20");
   86|   108k|        }
   87|   108k|#endif
   88|   108k|    }

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

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

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

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

_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EDn:
  187|  11.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EDn:
  187|  22.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEED2Ev:
  206|  5.52k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE7destroyEv:
  239|  5.52k|  void destroy() noexcept {
  240|  5.52k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 5.52k, False: 0]
  ------------------
  241|  5.52k|      handle_(action::destroy, &storage_, nullptr);
  242|  5.52k|      handle_ = nullptr;
  243|  5.52k|    }
  244|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|  77.3k|  ~any_invocable_impl() { destroy(); }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|  77.3k|  void destroy() noexcept {
  240|  77.3k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 22.0k, False: 55.2k]
  ------------------
  241|  22.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  22.0k|      handle_ = nullptr;
  243|  22.0k|    }
  244|  77.3k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEED2Ev:
  206|  55.2k|  ~any_invocable_impl() { destroy(); }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE7destroyEv:
  239|  55.2k|  void destroy() noexcept {
  240|  55.2k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 55.2k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  55.2k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEED2Ev:
  206|   110k|  ~any_invocable_impl() { destroy(); }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE7destroyEv:
  239|   110k|  void destroy() noexcept {
  240|   110k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 22.0k, False: 88.3k]
  ------------------
  241|  22.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  22.0k|      handle_ = nullptr;
  243|  22.0k|    }
  244|   110k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEED2Ev:
  206|   110k|  ~any_invocable_impl() { destroy(); }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE7destroyEv:
  239|   110k|  void destroy() noexcept {
  240|   110k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 22.0k, False: 88.3k]
  ------------------
  241|  22.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  22.0k|      handle_ = nullptr;
  243|  22.0k|    }
  244|   110k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEED2Ev:
  206|  55.2k|  ~any_invocable_impl() { destroy(); }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE7destroyEv:
  239|  55.2k|  void destroy() noexcept {
  240|  55.2k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.0k, False: 44.1k]
  ------------------
  241|  11.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.0k|      handle_ = nullptr;
  243|  11.0k|    }
  244|  55.2k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEED2Ev:
  206|  33.1k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEE7destroyEv:
  239|  33.1k|  void destroy() noexcept {
  240|  33.1k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 33.1k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  33.1k|  }
_ZN5ofats13any_invocableIFvvEEclEv:
  345|  14.7k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  14.7k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  14.7k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4callEv:
  246|  14.7k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  14.7k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  14.7k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEED2Ev:
  206|  1.65M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE7destroyEv:
  239|  1.65M|  void destroy() noexcept {
  240|  1.65M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 15.2k, False: 1.63M]
  ------------------
  241|  15.2k|      handle_(action::destroy, &storage_, nullptr);
  242|  15.2k|      handle_ = nullptr;
  243|  15.2k|    }
  244|  1.65M|  }
_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEclES3_:
  345|  4.81M|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  4.81M|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  4.81M|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE4callES4_:
  246|  4.81M|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  4.81M|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  4.81M|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEED2Ev:
  206|  22.0k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE7destroyEv:
  239|  22.0k|  void destroy() noexcept {
  240|  22.0k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.0k, False: 11.0k]
  ------------------
  241|  11.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.0k|      handle_ = nullptr;
  243|  11.0k|    }
  244|  22.0k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEEC2Ev:
  186|  5.52k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEED2Ev:
  206|  27.6k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE7destroyEv:
  239|  27.6k|  void destroy() noexcept {
  240|  27.6k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.0k, False: 16.5k]
  ------------------
  241|  11.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.0k|      handle_ = nullptr;
  243|  11.0k|    }
  244|  27.6k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEED2Ev:
  206|  5.52k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPKcEE7destroyEv:
  239|  5.52k|  void destroy() noexcept {
  240|  5.52k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 5.52k]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  5.52k|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2Ev:
  186|  1.50M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2Ev:
  186|  1.52M|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2Ev:
  186|  1.50M|  any_invocable_impl() noexcept = default;
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJEEcvbEv:
  228|  1.39M|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEED2Ev:
  206|  1.50M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJNSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEE7destroyEv:
  239|  1.50M|  void destroy() noexcept {
  240|  1.50M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 1.50M]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  1.50M|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEED2Ev:
  206|  1.61M|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE7destroyEv:
  239|  1.61M|  void destroy() noexcept {
  240|  1.61M|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 0, False: 1.61M]
  ------------------
  241|      0|      handle_(action::destroy, &storage_, nullptr);
  242|      0|      handle_ = nullptr;
  243|      0|    }
  244|  1.61M|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEclES1_S4_:
  345|   113k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|   113k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|   113k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE4callES2_S5_:
  246|   113k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|   113k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|   113k|  }
_ZN5ofats13any_invocableIFPvS1_PN3uWS11HttpRequestEEEC2IZZNS2_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS1_S4_E_vEEOT_:
  303|   370k|    any_invocable(F&& f) {                                                     \
  304|   370k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   370k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEEC2Ev:
  186|   370k|  any_invocable_impl() noexcept = default;
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE6createIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_JSE_EEEvDpOT0_:
  232|   370k|  void create(Args&&... args) {
  233|   370k|    using hdl = handler<F>;
  234|   370k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   370k|    handle_ = &hdl::handle;
  236|   370k|    call_ = &hdl::call;
  237|   370k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|   370k|    static void create(storage& s, Args&&... args) {
  119|   370k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   370k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE12handler_baseINS6_13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESC_SD_iEUlS2_S5_E_EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|   370k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   370k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 370k]
  ------------------
  105|   370k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 370k, False: 0]
  ------------------
  106|   370k|          Derived::destroy(*current);
  107|   370k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 370k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   370k|      }
  112|   370k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E7destroyERNS0_7storageE:
  122|   370k|    static void destroy(storage& s) noexcept {
  123|   370k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   370k|      value.~T();
  125|   370k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_PN3uWS11HttpRequestEEE13small_handlerIZZNS3_11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESB_SC_iEUlS2_S5_E_E4callERNS0_7storageES2_S5_:
  132|   113k|    static R call(storage& s, ArgTypes... args) {
  133|   113k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|   113k|                         std::forward<ArgTypes>(args)...);
  135|   113k|    }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEclES7_:
  345|   113k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|   113k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|   113k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE4callES8_:
  246|   113k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|   113k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|   113k|  }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEED2Ev:
  206|   370k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_PN3uWS11HttpRequestEEE7destroyEv:
  239|   370k|  void destroy() noexcept {
  240|   370k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 370k, False: 0]
  ------------------
  241|   370k|      handle_(action::destroy, &storage_, nullptr);
  242|   370k|      handle_ = nullptr;
  243|   370k|    }
  244|   370k|  }
_ZN5ofats13any_invocableIFPvS1_NSt3__117basic_string_viewIcNS2_11char_traitsIcEEEEbEEC2IZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS1_S6_bE_vEEOT_:
  303|   370k|    any_invocable(F&& f) {                                                     \
  304|   370k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|   370k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEEC2Ev:
  186|   370k|  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|   370k|  void create(Args&&... args) {
  233|   370k|    using hdl = handler<F>;
  234|   370k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|   370k|    handle_ = &hdl::handle;
  236|   370k|    call_ = &hdl::call;
  237|   370k|  }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  118|   370k|    static void create(storage& s, Args&&... args) {
  119|   370k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|   370k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE12handler_baseINS8_13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESF_SG_iEUlS2_S7_bE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  103|   370k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|   370k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 370k]
  ------------------
  105|   370k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 370k, False: 0]
  ------------------
  106|   370k|          Derived::destroy(*current);
  107|   370k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 370k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|   370k|      }
  112|   370k|    }
_ZN5ofats10any_detail14handler_traitsIPvJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE13small_handlerIZZN3uWS11HttpContextILb0EE4initEvENKUlP11us_socket_tPciE_clESE_SF_iEUlS2_S7_bE_E7destroyERNS0_7storageE:
  122|   370k|    static void destroy(storage& s) noexcept {
  123|   370k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|   370k|      value.~T();
  125|   370k|    }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEED2Ev:
  206|   370k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIPvLb0EJS2_NSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEbEE7destroyEv:
  239|   370k|  void destroy() noexcept {
  240|   370k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 370k, False: 0]
  ------------------
  241|   370k|      handle_(action::destroy, &storage_, nullptr);
  242|   370k|      handle_ = nullptr;
  243|   370k|    }
  244|   370k|  }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEE4swapERS2_:
  208|   108k|  void swap(any_invocable_impl& rhs) noexcept {
  209|   108k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 108k]
  ------------------
  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|   108k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 108k]
  ------------------
  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|   108k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2EOS5_:
  188|  11.0k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  11.0k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.0k, False: 0]
  ------------------
  190|  11.0k|      handle_ = rhs.handle_;
  191|  11.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.0k|      call_ = rhs.call_;
  193|  11.0k|      rhs.handle_ = nullptr;
  194|  11.0k|    }
  195|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E_vEEOSK_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEEC2Ev:
  186|  11.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_JSN_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  11.0k|    static void create(storage& s, Args&&... args) {
  119|  11.0k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  11.0k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  11.0k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 11.0k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 5.52k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  5.52k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 5.52k, False: 5.52k]
  ------------------
  109|  5.52k|          Derived::move(*current, *other);
  110|  5.52k|          break;
  111|  11.0k|      }
  112|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E7destroyERNS0_7storageE:
  122|  11.0k|    static void destroy(storage& s) noexcept {
  123|  11.0k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  11.0k|      value.~T();
  125|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4moveERNS0_7storageESQ_:
  127|  5.52k|    static void move(storage& dst, storage& src) noexcept {
  128|  5.52k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  5.52k|      destroy(src);
  130|  5.52k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E_E4callERNS0_7storageES4_:
  132|  2.40M|    static R call(storage& s, ArgTypes... args) {
  133|  2.40M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  2.40M|                         std::forward<ArgTypes>(args)...);
  135|  2.40M|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS4LoopEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS3_E0_vEEOSK_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS4LoopEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_JSN_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E6createIJSN_EEEvRNS0_7storageEDpOT_:
  118|  11.0k|    static void create(storage& s, Args&&... args) {
  119|  11.0k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE12handler_baseINS5_13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS9_NSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEEONS9_17WebSocketBehaviorIT_EEEUlS4_E0_EEE6handleENS0_6actionEPNS0_7storageEST_:
  103|  11.0k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  11.0k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 11.0k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 5.52k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  5.52k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 5.52k, False: 5.52k]
  ------------------
  109|  5.52k|          Derived::move(*current, *other);
  110|  5.52k|          break;
  111|  11.0k|      }
  112|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E7destroyERNS0_7storageE:
  122|  11.0k|    static void destroy(storage& s) noexcept {
  123|  11.0k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  11.0k|      value.~T();
  125|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4moveERNS0_7storageESQ_:
  127|  5.52k|    static void move(storage& dst, storage& src) noexcept {
  128|  5.52k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  5.52k|      destroy(src);
  130|  5.52k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS4LoopEEE13small_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS8_NSt3__112basic_stringIcNSC_11char_traitsIcEENSC_9allocatorIcEEEEONS8_17WebSocketBehaviorIT_EEEUlS4_E0_E4callERNS0_7storageES4_:
  132|  2.40M|    static R call(storage& s, ArgTypes... args) {
  133|  2.40M|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  2.40M|                         std::forward<ArgTypes>(args)...);
  135|  2.40M|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EDn:
  187|  22.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EDn:
  187|  11.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  11.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EDn:
  187|  22.0k|  any_invocable_impl(std::nullptr_t) noexcept {}
EpollEchoServer.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEcvbEv:
  228|   147k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollEchoServer.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|   216k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_iSA_:
  345|   216k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|   216k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|   216k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_iSB_:
  246|   216k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|   216k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|   216k|  }
EpollEchoServer.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEcvbEv:
  228|  44.7k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEclES5_SA_SB_:
  345|  44.7k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  44.7k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  44.7k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4callES6_SB_SC_:
  246|  44.7k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  44.7k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  44.7k|  }
EpollEchoServer.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEcvbEv:
  228|  10.6k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEclES5_SA_:
  345|  10.6k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  10.6k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  10.6k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4callES6_SB_:
  246|  10.6k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  10.6k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  10.6k|  }
EpollEchoServer.cpp:_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEcvbEv:
  228|   128k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEclES5_:
  345|   128k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|   128k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|   128k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4callES6_:
  246|   128k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|   128k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|   128k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EOS2_:
  188|  23.3k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  23.3k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 23.3k, False: 0]
  ------------------
  190|  23.3k|      handle_ = rhs.handle_;
  191|  23.3k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  23.3k|      call_ = rhs.call_;
  193|  23.3k|      rhs.handle_ = nullptr;
  194|  23.3k|    }
  195|  23.3k|  }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvvEEC2IZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_vEEOSI_:
  303|  11.0k|    any_invocable(F&& f) {                                                     \
  304|  11.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.0k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_JSL_EEEvDpOT0_:
  232|  11.0k|  void create(Args&&... args) {
  233|  11.0k|    using hdl = handler<F>;
  234|  11.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.0k|    handle_ = &hdl::handle;
  236|  11.0k|    call_ = &hdl::call;
  237|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E6createIJSL_EEEvRNS0_7storageEDpOT_:
  118|  27.6k|    static void create(storage& s, Args&&... args) {
  119|  27.6k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  27.6k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS7_NSt3__112basic_stringIcNSB_11char_traitsIcEENSB_9allocatorIcEEEEONS7_17WebSocketBehaviorIT_EEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESR_:
  103|  27.6k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  27.6k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 27.6k]
  ------------------
  105|  11.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.0k, False: 16.5k]
  ------------------
  106|  11.0k|          Derived::destroy(*current);
  107|  11.0k|          break;
  108|  16.5k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 16.5k, False: 11.0k]
  ------------------
  109|  16.5k|          Derived::move(*current, *other);
  110|  16.5k|          break;
  111|  27.6k|      }
  112|  27.6k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E7destroyERNS0_7storageE:
  122|  27.6k|    static void destroy(storage& s) noexcept {
  123|  27.6k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  27.6k|      value.~T();
  125|  27.6k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4moveERNS0_7storageESO_:
  127|  16.5k|    static void move(storage& dst, storage& src) noexcept {
  128|  16.5k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  16.5k|      destroy(src);
  130|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13small_handlerIZN3uWS12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOS6_NSt3__112basic_stringIcNSA_11char_traitsIcEENSA_9allocatorIcEEEEONS6_17WebSocketBehaviorIT_EEEUlvE_E4callERNS0_7storageE:
  132|  11.0k|    static R call(storage& s, ArgTypes... args) {
  133|  11.0k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  11.0k|                         std::forward<ArgTypes>(args)...);
  135|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEaSEOS7_:
  197|  22.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  22.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  22.0k|    return *this;
  200|  22.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2EOS7_:
  188|  66.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  66.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 22.0k, False: 44.1k]
  ------------------
  190|  22.0k|      handle_ = rhs.handle_;
  191|  22.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  22.0k|      call_ = rhs.call_;
  193|  22.0k|      rhs.handle_ = nullptr;
  194|  22.0k|    }
  195|  66.2k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE4swapERS7_:
  208|  44.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  44.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 22.0k, False: 22.0k]
  ------------------
  210|  22.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 22.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  22.0k|      } else {
  218|  22.0k|        rhs.swap(*this);
  219|  22.0k|      }
  220|  22.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 22.0k, False: 0]
  ------------------
  221|  22.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  22.0k|      handle_ = rhs.handle_;
  223|  22.0k|      call_ = rhs.call_;
  224|  22.0k|      rhs.handle_ = nullptr;
  225|  22.0k|    }
  226|  44.1k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEaSEOSD_:
  197|  11.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  11.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  11.0k|    return *this;
  200|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2EOSD_:
  188|  33.1k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  33.1k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 11.0k, False: 22.0k]
  ------------------
  190|  11.0k|      handle_ = rhs.handle_;
  191|  11.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  11.0k|      call_ = rhs.call_;
  193|  11.0k|      rhs.handle_ = nullptr;
  194|  11.0k|    }
  195|  33.1k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE4swapERSD_:
  208|  22.0k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  22.0k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 11.0k, False: 11.0k]
  ------------------
  210|  11.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 11.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  11.0k|      } else {
  218|  11.0k|        rhs.swap(*this);
  219|  11.0k|      }
  220|  11.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 11.0k, False: 0]
  ------------------
  221|  11.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  11.0k|      handle_ = rhs.handle_;
  223|  11.0k|      call_ = rhs.call_;
  224|  11.0k|      rhs.handle_ = nullptr;
  225|  11.0k|    }
  226|  22.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEaSEOSC_:
  197|  11.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  11.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  11.0k|    return *this;
  200|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEEC2EOSC_:
  188|  33.1k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  33.1k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 33.1k]
  ------------------
  190|      0|      handle_ = rhs.handle_;
  191|      0|      handle_(action::move, &storage_, &rhs.storage_);
  192|      0|      call_ = rhs.call_;
  193|      0|      rhs.handle_ = nullptr;
  194|      0|    }
  195|  33.1k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEiiEE4swapERSC_:
  208|  11.0k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  11.0k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 11.0k]
  ------------------
  210|      0|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 0]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|      0|      } else {
  218|      0|        rhs.swap(*this);
  219|      0|      }
  220|  11.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 11.0k]
  ------------------
  221|      0|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|      0|      handle_ = rhs.handle_;
  223|      0|      call_ = rhs.call_;
  224|      0|      rhs.handle_ = nullptr;
  225|      0|    }
  226|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  44.1k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  44.1k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 22.0k, False: 22.0k]
  ------------------
  190|  22.0k|      handle_ = rhs.handle_;
  191|  22.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  22.0k|      call_ = rhs.call_;
  193|  22.0k|      rhs.handle_ = nullptr;
  194|  22.0k|    }
  195|  44.1k|  }
EpollEchoServer.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.0k|    operator=(F&& f) {                                                         \
  336|  11.0k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|  11.0k|      return *this;                                                            \
  338|  11.0k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZNS1_12TemplatedAppILb0EE2wsIS3_EEOSF_NS6_12basic_stringIcS9_NS6_9allocatorIcEEEEONSF_17WebSocketBehaviorIT_EEEUlS5_iSA_E_vEEOSN_:
  303|  11.0k|    any_invocable(F&& f) {                                                     \
  304|  11.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.0k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  22.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.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.0k|  void create(Args&&... args) {
  233|  11.0k|    using hdl = handler<F>;
  234|  11.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.0k|    handle_ = &hdl::handle;
  236|  11.0k|    call_ = &hdl::call;
  237|  11.0k|  }
EpollEchoServer.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.0k|    static void create(storage& s, Args&&... args) {
  142|  11.0k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  11.0k|    }
EpollEchoServer.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|  22.0k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  22.0k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 22.0k]
  ------------------
  105|  11.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.0k, False: 11.0k]
  ------------------
  106|  11.0k|          Derived::destroy(*current);
  107|  11.0k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 11.0k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  22.0k|      }
  112|  22.0k|    }
EpollEchoServer.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.0k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollEchoServer.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.0k|    static void move(storage& dst, storage& src) noexcept {
  148|  11.0k|      dst.ptr_ = src.ptr_;
  149|  11.0k|    }
EpollEchoServer.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|   108k|    static R call(storage& s, ArgTypes... args) {
  152|   108k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|   108k|                         std::forward<ArgTypes>(args)...);
  154|   108k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  22.0k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  22.0k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 11.0k, False: 11.0k]
  ------------------
  210|  11.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 11.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  11.0k|      } else {
  218|  11.0k|        rhs.swap(*this);
  219|  11.0k|      }
  220|  11.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 11.0k, False: 0]
  ------------------
  221|  11.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  11.0k|      handle_ = rhs.handle_;
  223|  11.0k|      call_ = rhs.call_;
  224|  11.0k|      rhs.handle_ = nullptr;
  225|  11.0k|    }
  226|  22.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEaSEOSC_:
  197|  22.0k|  any_invocable_impl& operator=(any_invocable_impl&& rhs) noexcept {
  198|  22.0k|    any_invocable_impl{std::move(rhs)}.swap(*this);
  199|  22.0k|    return *this;
  200|  22.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2EOSC_:
  188|  66.2k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  66.2k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 22.0k, False: 44.1k]
  ------------------
  190|  22.0k|      handle_ = rhs.handle_;
  191|  22.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  22.0k|      call_ = rhs.call_;
  193|  22.0k|      rhs.handle_ = nullptr;
  194|  22.0k|    }
  195|  66.2k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE4swapERSC_:
  208|  44.1k|  void swap(any_invocable_impl& rhs) noexcept {
  209|  44.1k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 22.0k, False: 22.0k]
  ------------------
  210|  22.0k|      if (rhs.handle_) {
  ------------------
  |  Branch (210:11): [True: 0, False: 22.0k]
  ------------------
  211|      0|        storage tmp;
  212|      0|        handle_(action::move, &tmp, &storage_);
  213|      0|        rhs.handle_(action::move, &storage_, &rhs.storage_);
  214|      0|        handle_(action::move, &rhs.storage_, &tmp);
  215|      0|        std::swap(handle_, rhs.handle_);
  216|      0|        std::swap(call_, rhs.call_);
  217|  22.0k|      } else {
  218|  22.0k|        rhs.swap(*this);
  219|  22.0k|      }
  220|  22.0k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 22.0k, False: 0]
  ------------------
  221|  22.0k|      rhs.handle_(action::move, &storage_, &rhs.storage_);
  222|  22.0k|      handle_ = rhs.handle_;
  223|  22.0k|      call_ = rhs.call_;
  224|  22.0k|      rhs.handle_ = nullptr;
  225|  22.0k|    }
  226|  44.1k|  }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEcvbEv:
  228|  11.0k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2EOS9_:
  188|  16.5k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  16.5k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 16.5k, False: 0]
  ------------------
  190|  16.5k|      handle_ = rhs.handle_;
  191|  16.5k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  16.5k|      call_ = rhs.call_;
  193|  16.5k|      rhs.handle_ = nullptr;
  194|  16.5k|    }
  195|  16.5k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2EOS8_:
  188|  22.0k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  22.0k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 22.0k, False: 0]
  ------------------
  190|  22.0k|      handle_ = rhs.handle_;
  191|  22.0k|      handle_(action::move, &storage_, &rhs.storage_);
  192|  22.0k|      call_ = rhs.call_;
  193|  22.0k|      rhs.handle_ = nullptr;
  194|  22.0k|    }
  195|  22.0k|  }
_ZN5ofats13any_invocableIFbPN3uWS10HttpRouterINS1_15HttpContextDataILb0EE10RouterDataEEEEEC2IZNS1_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS0_IFvPNS1_12HttpResponseILb0EEEPNS1_11HttpRequestEEEEbEUlPT_E_vEEOSS_:
  303|  11.0k|    any_invocable(F&& f) {                                                     \
  304|  11.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.0k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEEC2Ev:
  186|  11.0k|  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|  11.0k|  void create(Args&&... args) {
  233|  11.0k|    using hdl = handler<F>;
  234|  11.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.0k|    handle_ = &hdl::handle;
  236|  11.0k|    call_ = &hdl::call;
  237|  11.0k|  }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E6createIJSV_EEEvRNS0_7storageEDpOT_:
  141|  11.0k|    static void create(storage& s, Args&&... args) {
  142|  11.0k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  11.0k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE12handler_baseINS9_13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSE_11char_traitsIcEENSE_9allocatorIcEEEESK_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_EEE6handleENS0_6actionEPNS0_7storageES11_:
  103|  27.6k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  27.6k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 27.6k]
  ------------------
  105|  11.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.0k, False: 16.5k]
  ------------------
  106|  11.0k|          Derived::destroy(*current);
  107|  11.0k|          break;
  108|  16.5k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 16.5k, False: 11.0k]
  ------------------
  109|  16.5k|          Derived::move(*current, *other);
  110|  16.5k|          break;
  111|  27.6k|      }
  112|  27.6k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E7destroyERNS0_7storageE:
  145|  11.0k|    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|  16.5k|    static void move(storage& dst, storage& src) noexcept {
  148|  16.5k|      dst.ptr_ = src.ptr_;
  149|  16.5k|    }
_ZN5ofats10any_detail14handler_traitsIbJPN3uWS10HttpRouterINS2_15HttpContextDataILb0EE10RouterDataEEEEE13large_handlerIZNS2_11HttpContextILb0EE6onHttpENSt3__112basic_stringIcNSD_11char_traitsIcEENSD_9allocatorIcEEEESJ_ONS_13any_invocableIFvPNS2_12HttpResponseILb0EEEPNS2_11HttpRequestEEEEbEUlPT_E_E4callERNS0_7storageES8_:
  151|   113k|    static R call(storage& s, ArgTypes... args) {
  152|   113k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|   113k|                         std::forward<ArgTypes>(args)...);
  154|   113k|    }
_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEclES4_S6_:
  345|   113k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|   113k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|   113k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE4callES5_S7_:
  246|   113k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|   113k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|   113k|  }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEC2EOSA_:
  188|  22.0k|  any_invocable_impl(any_invocable_impl&& rhs) noexcept {
  189|  22.0k|    if (rhs.handle_) {
  ------------------
  |  Branch (189:9): [True: 0, False: 22.0k]
  ------------------
  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|  22.0k|  }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS12HttpResponseILb0EEEPNS1_11HttpRequestEEEC2IZNS1_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_vEEOSN_:
  303|  11.0k|    any_invocable(F&& f) {                                                     \
  304|  11.0k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  11.0k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEEC2Ev:
  186|  11.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE6createIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_JST_EEEvDpOT0_:
  232|  11.0k|  void create(Args&&... args) {
  233|  11.0k|    using hdl = handler<F>;
  234|  11.0k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  11.0k|    handle_ = &hdl::handle;
  236|  11.0k|    call_ = &hdl::call;
  237|  11.0k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E6createIJST_EEEvRNS0_7storageEDpOT_:
  141|  11.0k|    static void create(storage& s, Args&&... args) {
  142|  11.0k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE12handler_baseINS8_13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSC_NSt3__112basic_stringIcNSG_11char_traitsIcEENSG_9allocatorIcEEEEONSC_17WebSocketBehaviorIT_EEEUlPSO_PT0_E_EEE6handleENS0_6actionEPNS0_7storageESZ_:
  103|  33.1k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  33.1k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 33.1k]
  ------------------
  105|  11.0k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 11.0k, False: 22.0k]
  ------------------
  106|  11.0k|          Derived::destroy(*current);
  107|  11.0k|          break;
  108|  22.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 22.0k, False: 11.0k]
  ------------------
  109|  22.0k|          Derived::move(*current, *other);
  110|  22.0k|          break;
  111|  33.1k|      }
  112|  33.1k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E7destroyERNS0_7storageE:
  145|  11.0k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4moveERNS0_7storageESW_:
  147|  22.0k|    static void move(storage& dst, storage& src) noexcept {
  148|  22.0k|      dst.ptr_ = src.ptr_;
  149|  22.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE13large_handlerIZNS2_12TemplatedAppILb0EE2wsIZ4testvE13PerSocketDataEEOSB_NSt3__112basic_stringIcNSF_11char_traitsIcEENSF_9allocatorIcEEEEONSB_17WebSocketBehaviorIT_EEEUlPSN_PT0_E_E4callERNS0_7storageES5_S7_:
  151|   113k|    static R call(storage& s, ArgTypes... args) {
  152|   113k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|   113k|                         std::forward<ArgTypes>(args)...);
  154|   113k|    }
_ZNK5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEP19us_socket_context_tEEcvbEv:
  228|   108k|  explicit operator bool() const noexcept { return handle_ != nullptr; }
_ZN5ofats13any_invocableIFvvEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|   108k|    operator=(F&& f) {                                                         \
  336|   108k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|   108k|      return *this;                                                            \
  338|   108k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEEC2EDn:
  187|   108k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE4swapERS2_:
  208|   108k|  void swap(any_invocable_impl& rhs) noexcept {
  209|   108k|    if (handle_) {
  ------------------
  |  Branch (209:9): [True: 0, False: 108k]
  ------------------
  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|   108k|    } else if (rhs.handle_) {
  ------------------
  |  Branch (220:16): [True: 0, False: 108k]
  ------------------
  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|   108k|  }
_ZN5ofats13any_invocableIFbmEEaSIDnDnEENSt3__19enable_ifIXaantsr3stdE9is_same_vIT0_S2_Esr3stdE23is_move_constructible_vIS6_EERS2_E4typeEOT_:
  335|   108k|    operator=(F&& f) {                                                         \
  336|   108k|      any_invocable{std::forward<F>(f)}.swap(*this);                           \
  337|   108k|      return *this;                                                            \
  338|   108k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIbLb0EJmEEC2EDn:
  187|   108k|  any_invocable_impl(std::nullptr_t) noexcept {}
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEED2Ev:
  206|  33.1k|  ~any_invocable_impl() { destroy(); }
_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS12HttpResponseILb0EEEPNS2_11HttpRequestEEE7destroyEv:
  239|  33.1k|  void destroy() noexcept {
  240|  33.1k|    if (handle_) {
  ------------------
  |  Branch (240:9): [True: 11.0k, False: 22.0k]
  ------------------
  241|  11.0k|      handle_(action::destroy, &storage_, nullptr);
  242|  11.0k|      handle_ = nullptr;
  243|  11.0k|    }
  244|  33.1k|  }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_0vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2Ev:
  186|  22.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_0JS9_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_0E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_0EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_0E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_0E4moveERNS0_7storageESC_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_0E4callERNS0_7storageES6_:
  132|  73.5k|    static R call(storage& s, ArgTypes... args) {
  133|  73.5k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  73.5k|                         std::forward<ArgTypes>(args)...);
  135|  73.5k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEC2IZ4testvE3$_1vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEEC2Ev:
  186|  11.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE6createIZ4testvE3$_1JSF_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_1E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE12handler_baseINSD_13small_handlerIZ4testvE3$_1EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_1E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_1E4moveERNS0_7storageESI_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_1E4callERNS0_7storageES6_SB_SC_:
  132|  31.1k|    static R call(storage& s, ArgTypes... args) {
  133|  31.1k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  31.1k|                         std::forward<ArgTypes>(args)...);
  135|  31.1k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_2vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_2JS9_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_2E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_2EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_2E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_2E4moveERNS0_7storageESC_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_2E4callERNS0_7storageES6_:
  132|  11.5k|    static R call(storage& s, ArgTypes... args) {
  133|  11.5k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  11.5k|                         std::forward<ArgTypes>(args)...);
  135|  11.5k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_3vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEEC2Ev:
  186|  22.0k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_3JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_3E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_3EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_3E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_3E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_3E4callERNS0_7storageES6_SB_:
  132|  4.96k|    static R call(storage& s, ArgTypes... args) {
  133|  4.96k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  4.96k|                         std::forward<ArgTypes>(args)...);
  135|  4.96k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_4vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_4JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_4E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_4EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_4E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_4E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_4E4callERNS0_7storageES6_SB_:
  132|    380|    static R call(storage& s, ArgTypes... args) {
  133|    380|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|    380|                         std::forward<ArgTypes>(args)...);
  135|    380|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_5vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_5JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_5E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_5EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_5E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_5E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_5E4callERNS0_7storageES6_iSB_:
  132|  73.5k|    static R call(storage& s, ArgTypes... args) {
  133|  73.5k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  73.5k|                         std::forward<ArgTypes>(args)...);
  135|  73.5k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_6vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_6JS9_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_6E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_6EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_6E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_6E4moveERNS0_7storageESC_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_6E4callERNS0_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|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEENS1_6OpCodeEEEC2IZ4testvE3$_7vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE6createIZ4testvE3$_7JSF_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_7E6createIJSF_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE12handler_baseINSD_13small_handlerIZ4testvE3$_7EEE6handleENS0_6actionEPNS0_7storageESL_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_7E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_7E4moveERNS0_7storageESI_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS2_6OpCodeEEE13small_handlerIZ4testvE3$_7E4callERNS0_7storageES6_SB_SC_:
  132|  13.6k|    static R call(storage& s, ArgTypes... args) {
  133|  13.6k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  13.6k|                         std::forward<ArgTypes>(args)...);
  135|  13.6k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEC2IZ4testvE3$_8vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE6createIZ4testvE3$_8JS9_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_8E6createIJS9_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE12handler_baseINS7_13small_handlerIZ4testvE3$_8EEE6handleENS0_6actionEPNS0_7storageESF_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_8E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_8E4moveERNS0_7storageESC_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEE13small_handlerIZ4testvE3$_8E4callERNS0_7storageES6_:
  132|  8.91k|    static R call(storage& s, ArgTypes... args) {
  133|  8.91k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  8.91k|                         std::forward<ArgTypes>(args)...);
  135|  8.91k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE3$_9vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE3$_9JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_9E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE3$_9EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_9E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_9E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE3$_9E4callERNS0_7storageES6_SB_:
  132|  4.18k|    static R call(storage& s, ArgTypes... args) {
  133|  4.18k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  4.18k|                         std::forward<ArgTypes>(args)...);
  135|  4.18k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvvEEC2IZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_vEEOSA_:
  303|  4.18k|    any_invocable(F&& f) {                                                     \
  304|  4.18k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  4.18k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJEE6createIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_JSH_EEEvDpOT0_:
  232|  4.18k|  void create(Args&&... args) {
  233|  4.18k|    using hdl = handler<F>;
  234|  4.18k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  4.18k|    handle_ = &hdl::handle;
  236|  4.18k|    call_ = &hdl::call;
  237|  4.18k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E6createIJSH_EEEvRNS0_7storageEDpOT_:
  141|  4.18k|    static void create(storage& s, Args&&... args) {
  142|  4.18k|      s.ptr_ = new T(std::forward<Args>(args)...);
  143|  4.18k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE12handler_baseINS2_13large_handlerIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSD_11char_traitsIcEEEEEUlvE_EEE6handleENS0_6actionEPNS0_7storageESN_:
  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|  4.18k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 4.18k, False: 6.76k]
  ------------------
  106|  4.18k|          Derived::destroy(*current);
  107|  4.18k|          break;
  108|  6.76k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 6.76k, False: 4.18k]
  ------------------
  109|  6.76k|          Derived::move(*current, *other);
  110|  6.76k|          break;
  111|  10.9k|      }
  112|  10.9k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E7destroyERNS0_7storageE:
  145|  4.18k|    static void destroy(storage& s) noexcept { delete static_cast<T*>(s.ptr_); }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4moveERNS0_7storageESK_:
  147|  6.76k|    static void move(storage& dst, storage& src) noexcept {
  148|  6.76k|      dst.ptr_ = src.ptr_;
  149|  6.76k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJEE13large_handlerIZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNSC_11char_traitsIcEEEEEUlvE_E4callERNS0_7storageE:
  151|  3.70k|    static R call(storage& s, ArgTypes... args) {
  152|  3.70k|      return std::invoke(*static_cast<T*>(s.ptr_),
  153|  3.70k|                         std::forward<ArgTypes>(args)...);
  154|  3.70k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE4$_10vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE4$_10JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_10E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE4$_10EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_10E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_10E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEENSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_10E4callERNS0_7storageES6_SB_:
  132|  1.08k|    static R call(storage& s, ArgTypes... args) {
  133|  1.08k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  1.08k|                         std::forward<ArgTypes>(args)...);
  135|  1.08k|    }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEEEC2IZ4testvE4$_11vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE6createIZ4testvE4$_11JSE_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_11E6createIJSE_EEEvRNS0_7storageEDpOT_:
  118|  16.5k|    static void create(storage& s, Args&&... args) {
  119|  16.5k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE12handler_baseINSC_13small_handlerIZ4testvE4$_11EEE6handleENS0_6actionEPNS0_7storageESK_:
  103|  16.5k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  16.5k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 16.5k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 11.0k]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|  11.0k|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 11.0k, False: 5.52k]
  ------------------
  109|  11.0k|          Derived::move(*current, *other);
  110|  11.0k|          break;
  111|  16.5k|      }
  112|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_11E7destroyERNS0_7storageE:
  122|  16.5k|    static void destroy(storage& s) noexcept {
  123|  16.5k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  16.5k|      value.~T();
  125|  16.5k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_11E4moveERNS0_7storageESH_:
  127|  11.0k|    static void move(storage& dst, storage& src) noexcept {
  128|  11.0k|      create(dst, std::move(*static_cast<T*>(static_cast<void*>(&src.buf_))));
  129|  11.0k|      destroy(src);
  130|  11.0k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJPN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEiNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEEE13small_handlerIZ4testvE4$_11E4callERNS0_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.52k|    R operator()(ArgTypes... args) cv ref noexcept(noex) {                     \
  346|  5.52k|      return base_type::call(std::forward<ArgTypes>(args)...);                 \
  347|  5.52k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE4callES3_:
  246|  5.52k|  R call(ArgTypes... args) noexcept(is_noexcept) {
  247|  5.52k|    return call_(storage_, std::forward<ArgTypes>(args)...);
  248|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats13any_invocableIFvP18us_listen_socket_tEEC2IZ4testvE4$_12vEEOT_:
  303|  5.52k|    any_invocable(F&& f) {                                                     \
  304|  5.52k|      base_type::template create<std::decay_t<F>>(std::forward<F>(f));         \
  305|  5.52k|    }                                                                          \
_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEEC2Ev:
  186|  5.52k|  any_invocable_impl() noexcept = default;
EpollEchoServer.cpp:_ZN5ofats10any_detail18any_invocable_implIvLb0EJP18us_listen_socket_tEE6createIZ4testvE4$_12JS6_EEEvDpOT0_:
  232|  5.52k|  void create(Args&&... args) {
  233|  5.52k|    using hdl = handler<F>;
  234|  5.52k|    hdl::create(storage_, std::forward<Args>(args)...);
  235|  5.52k|    handle_ = &hdl::handle;
  236|  5.52k|    call_ = &hdl::call;
  237|  5.52k|  }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE4$_12E6createIJS6_EEEvRNS0_7storageEDpOT_:
  118|  5.52k|    static void create(storage& s, Args&&... args) {
  119|  5.52k|      new (static_cast<void*>(&s.buf_)) T(std::forward<Args>(args)...);
  120|  5.52k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE12handler_baseINS4_13small_handlerIZ4testvE4$_12EEE6handleENS0_6actionEPNS0_7storageESC_:
  103|  5.52k|    static void handle(action act, storage* current, storage* other = nullptr) {
  104|  5.52k|      switch (act) {
  ------------------
  |  Branch (104:15): [True: 0, False: 5.52k]
  ------------------
  105|  5.52k|        case (action::destroy):
  ------------------
  |  Branch (105:9): [True: 5.52k, False: 0]
  ------------------
  106|  5.52k|          Derived::destroy(*current);
  107|  5.52k|          break;
  108|      0|        case (action::move):
  ------------------
  |  Branch (108:9): [True: 0, False: 5.52k]
  ------------------
  109|      0|          Derived::move(*current, *other);
  110|      0|          break;
  111|  5.52k|      }
  112|  5.52k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE4$_12E7destroyERNS0_7storageE:
  122|  5.52k|    static void destroy(storage& s) noexcept {
  123|  5.52k|      T& value = *static_cast<T*>(static_cast<void*>(&s.buf_));
  124|  5.52k|      value.~T();
  125|  5.52k|    }
EpollEchoServer.cpp:_ZN5ofats10any_detail14handler_traitsIvJP18us_listen_socket_tEE13small_handlerIZ4testvE4$_12E4callERNS0_7storageES3_:
  132|  5.52k|    static R call(storage& s, ArgTypes... args) {
  133|  5.52k|      return std::invoke(*static_cast<T*>(static_cast<void*>(&s.buf_)),
  134|  5.52k|                         std::forward<ArgTypes>(args)...);
  135|  5.52k|    }

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

_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE5drainEPNS_10SubscriberE:
  249|  29.1k|    void drain(Subscriber *s) {
  250|       |        /* The list is undefined and cannot be touched unless needsDrainage(). */
  251|  29.1k|        if (s->needsDrainage()) {
  ------------------
  |  Branch (251:13): [True: 2.02k, False: 27.1k]
  ------------------
  252|       |            /* This function differs from drainImpl by properly unlinking
  253|       |            * the subscriber from drainableSubscribers. drainImpl does not. */
  254|  2.02k|            unlinkDrainableSubscriber(s);
  255|       |
  256|       |            /* This one always resets needsDrainage before it calls any cb's.
  257|       |             * Otherwise we would stackoverflow when sending after publish but before drain. */
  258|  2.02k|            drainImpl(s);
  259|       |            
  260|       |            /* If we drained last subscriber, also clear outgoingMessages */
  261|  2.02k|            if (!drainableSubscribers) {
  ------------------
  |  Branch (261:17): [True: 578, False: 1.44k]
  ------------------
  262|    578|                outgoingMessages.clear();
  263|    578|            }
  264|  2.02k|        }
  265|  29.1k|    }
_ZN3uWS10Subscriber13needsDrainageEv:
   73|   102k|    bool needsDrainage() {
   74|   102k|        return numMessageIndices;
   75|   102k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE25unlinkDrainableSubscriberEPNS_10SubscriberE:
  132|  5.35k|    void unlinkDrainableSubscriber(Subscriber *s) {
  133|  5.35k|        if (s->prev) {
  ------------------
  |  Branch (133:13): [True: 1.66k, False: 3.68k]
  ------------------
  134|  1.66k|            s->prev->next = s->next;
  135|  1.66k|        }
  136|  5.35k|        if (s->next) {
  ------------------
  |  Branch (136:13): [True: 1.98k, False: 3.37k]
  ------------------
  137|  1.98k|            s->next->prev = s->prev;
  138|  1.98k|        }
  139|       |        /* If we are the head, then we also need to reset the head */
  140|  5.35k|        if (drainableSubscribers == s) {
  ------------------
  |  Branch (140:13): [True: 3.68k, False: 1.66k]
  ------------------
  141|  3.68k|            drainableSubscribers = s->next;
  142|  3.68k|        }
  143|  5.35k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE9drainImplEPNS_10SubscriberE:
  113|  4.16k|    void drainImpl(Subscriber *s) {
  114|       |        /* Before we call cb we need to make sure this subscriber will not report needsDrainage()
  115|       |         * since WebSocket::send will call drain from within the cb in that case.*/
  116|  4.16k|        int numMessageIndices = s->numMessageIndices;
  117|  4.16k|        s->numMessageIndices = 0;
  118|       |
  119|       |        /* Then we emit cb */
  120|  27.4k|        for (int i = 0; i < numMessageIndices; i++) {
  ------------------
  |  Branch (120:25): [True: 23.3k, False: 4.16k]
  ------------------
  121|  23.3k|            T &outgoingMessage = outgoingMessages[s->messageIndices[i]];
  122|       |
  123|  23.3k|            int flags = (i == numMessageIndices - 1) ? LAST : 0;
  ------------------
  |  Branch (123:25): [True: 4.16k, False: 19.1k]
  ------------------
  124|       |
  125|       |            /* Returning true will stop drainage short (such as when backpressure is too high) */
  126|  23.3k|            if (cb(s, outgoingMessage, (IteratorFlags)(flags | (i == 0 ? FIRST : 0)))) {
  ------------------
  |  Branch (126:17): [True: 0, False: 23.3k]
  |  Branch (126:65): [True: 4.16k, False: 19.1k]
  ------------------
  127|      0|                break;
  128|      0|            }
  129|  23.3k|        }
  130|  4.16k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEEC2ENSt3__18functionIFbPNS_10SubscriberERS1_NS3_13IteratorFlagsEEEE:
  147|  5.52k|    TopicTree(std::function<bool(Subscriber *, T &, IteratorFlags)> cb) : cb(cb) {
  148|       |
  149|  5.52k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE5drainEv:
  268|  4.81M|    void drain() {
  269|  4.81M|        if (drainableSubscribers) {
  ------------------
  |  Branch (269:13): [True: 1.32k, False: 4.81M]
  ------------------
  270|       |            /* Drain one socket a time */
  271|  3.46k|            for (Subscriber *s = drainableSubscribers; s; s = s->next) {
  ------------------
  |  Branch (271:56): [True: 2.14k, False: 1.32k]
  ------------------
  272|       |                /* Instead of unlinking every single subscriber, we just leave the list undefined
  273|       |                 * and reset drainableSubscribers ptr below. */
  274|  2.14k|                drainImpl(s);
  275|  2.14k|            }
  276|       |            /* Drain always clears drainableSubscribers and outgoingMessages */
  277|  1.32k|            drainableSubscribers = nullptr;
  278|  1.32k|            outgoingMessages.clear();
  279|  1.32k|        }
  280|  4.81M|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE14freeSubscriberEPNS_10SubscriberE:
  222|   108k|    void freeSubscriber(Subscriber *s) {
  223|       |
  224|       |        /* I guess we call this one even if we are not subscribers */
  225|   108k|        if (!s) {
  ------------------
  |  Branch (225:13): [True: 34.7k, False: 73.5k]
  ------------------
  226|  34.7k|            return;
  227|  34.7k|        }
  228|       |
  229|       |        /* For all topics, unsubscribe */
  230|  73.5k|        for (Topic *topicPtr : s->topics) {
  ------------------
  |  Branch (230:30): [True: 73.5k, False: 73.5k]
  ------------------
  231|       |            /* If we are the last subscriber, simply remove the whole topic */
  232|  73.5k|            if (topicPtr->size() == 1) {
  ------------------
  |  Branch (232:17): [True: 20.6k, False: 52.8k]
  ------------------
  233|  20.6k|                topics.erase(topicPtr->name);
  234|  52.8k|            } else {
  235|       |                /* Otherwise just remove us */
  236|  52.8k|                topicPtr->erase(s);
  237|  52.8k|            }
  238|  73.5k|        }
  239|       |
  240|       |        /* We also need to unlink us */
  241|  73.5k|        if (s->needsDrainage()) {
  ------------------
  |  Branch (241:13): [True: 3.32k, False: 70.2k]
  ------------------
  242|  3.32k|            unlinkDrainableSubscriber(s);
  243|  3.32k|        }
  244|       |
  245|  73.5k|        delete s;
  246|  73.5k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE16createSubscriberEv:
  217|  73.5k|    Subscriber *createSubscriber() {
  218|  73.5k|        return new Subscriber();
  219|  73.5k|    }
_ZN3uWS10SubscriberC2Ev:
   53|  73.5k|    Subscriber() = default;
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE9subscribeEPNS_10SubscriberENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  161|  73.5k|    Topic *subscribe(Subscriber *s, std::string_view topic) {
  162|       |        /* Notify user that they are doing something wrong here */
  163|  73.5k|        checkIteratingSubscriber(s);
  164|       |
  165|       |        /* Lookup or create new topic */
  166|  73.5k|        Topic *topicPtr = lookupTopic(topic);
  167|  73.5k|        if (!topicPtr) {
  ------------------
  |  Branch (167:13): [True: 20.6k, False: 52.8k]
  ------------------
  168|  20.6k|            Topic *newTopic = new Topic(topic);
  169|  20.6k|            topics.insert({std::string_view(newTopic->name.data(), newTopic->name.length()), std::unique_ptr<Topic>(newTopic)});
  170|  20.6k|            topicPtr = newTopic;
  171|  20.6k|        }
  172|       |
  173|       |        /* Insert us in topic, insert topic in us */
  174|  73.5k|        auto [it, inserted] = s->topics.insert(topicPtr);
  175|  73.5k|        if (!inserted) {
  ------------------
  |  Branch (175:13): [True: 0, False: 73.5k]
  ------------------
  176|      0|            return nullptr;
  177|      0|        }
  178|  73.5k|        topicPtr->insert(s);
  179|       |
  180|       |        /* Success */
  181|  73.5k|        return topicPtr;
  182|  73.5k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE24checkIteratingSubscriberEPNS_10SubscriberE:
  104|  74.2k|    void checkIteratingSubscriber(Subscriber *s) {
  105|       |        /* Notify user that they are doing something wrong here */
  106|  74.2k|        if (iteratingSubscriber == s) {
  ------------------
  |  Branch (106:13): [True: 0, False: 74.2k]
  ------------------
  107|      0|            std::cerr << "Error: WebSocket must not subscribe or unsubscribe to topics while iterating its topics!" << std::endl;
  108|      0|            std::terminate();
  109|      0|        }
  110|  74.2k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE11lookupTopicENSt3__117basic_string_viewIcNS4_11char_traitsIcEEEE:
  152|  74.2k|    Topic *lookupTopic(std::string_view topic) {
  153|  74.2k|        auto it = topics.find(topic);
  154|  74.2k|        if (it == topics.end()) {
  ------------------
  |  Branch (154:13): [True: 21.4k, False: 52.8k]
  ------------------
  155|  21.4k|            return nullptr;
  156|  21.4k|        }
  157|  52.8k|        return it->second.get();
  158|  74.2k|    }
_ZN3uWS5TopicC2ENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   40|  20.6k|    Topic(std::string_view topic) : name(topic) {
   41|       |
   42|  20.6k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE7publishEPNS_10SubscriberENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEEOS1_:
  304|  30.5k|    bool publish(Subscriber *sender, std::string_view topic, T &&message) {
  305|       |        /* Do we even have this topic? */
  306|  30.5k|        auto it = topics.find(topic);
  307|  30.5k|        if (it == topics.end()) {
  ------------------
  |  Branch (307:13): [True: 17.5k, False: 13.0k]
  ------------------
  308|  17.5k|            return false;
  309|  17.5k|        }
  310|       |
  311|       |        /* If we have more than 65k messages we need to drain every socket. */
  312|  13.0k|        if (outgoingMessages.size() == UINT16_MAX) {
  ------------------
  |  Branch (312:13): [True: 0, False: 13.0k]
  ------------------
  313|       |            /* If there is a socket that is currently corked, this will be ugly as all sockets will drain
  314|       |             * to their own backpressure */
  315|      0|            drain();
  316|      0|        }
  317|       |
  318|       |        /* If nobody references this message, don't buffer it */
  319|  13.0k|        bool referencedMessage = false;
  320|       |
  321|       |        /* For all subscribers in topic */
  322|  47.1k|        for (Subscriber *s : *it->second) {
  ------------------
  |  Branch (322:28): [True: 47.1k, False: 13.0k]
  ------------------
  323|       |
  324|       |            /* If we are sender then ignore us */
  325|  47.1k|            if (sender != s) {
  ------------------
  |  Branch (325:17): [True: 34.1k, False: 13.0k]
  ------------------
  326|       |
  327|       |                /* At least one subscriber wants this message */
  328|  34.1k|                referencedMessage = true;
  329|       |
  330|       |                /* If we already have too many outgoing messages on this subscriber, drain it now */
  331|  34.1k|                if (s->numMessageIndices == 32) {
  ------------------
  |  Branch (331:21): [True: 389, False: 33.7k]
  ------------------
  332|       |                    /* This one does not need to check needsDrainage here but still does. */
  333|    389|                    drain(s);
  334|    389|                }
  335|       |
  336|       |                /* Finally we can continue */
  337|  34.1k|                s->messageIndices[s->numMessageIndices++] = (uint16_t)outgoingMessages.size();
  338|       |                /* First message adds subscriber to list of drainable subscribers */
  339|  34.1k|                if (s->numMessageIndices == 1) {
  ------------------
  |  Branch (339:21): [True: 7.49k, False: 26.6k]
  ------------------
  340|       |                    /* Insert us in the head of drainable subscribers */
  341|  7.49k|                    s->next = drainableSubscribers;
  342|  7.49k|                    s->prev = nullptr;
  343|  7.49k|                    if (s->next) {
  ------------------
  |  Branch (343:25): [True: 3.73k, False: 3.76k]
  ------------------
  344|  3.73k|                        s->next->prev = s;
  345|  3.73k|                    }
  346|  7.49k|                    drainableSubscribers = s;
  347|  7.49k|                }
  348|  34.1k|            }
  349|  47.1k|        }
  350|       |
  351|       |        /* Push this message and return with success */
  352|  13.0k|        if (referencedMessage) {
  ------------------
  |  Branch (352:13): [True: 11.7k, False: 1.31k]
  ------------------
  353|  11.7k|            outgoingMessages.emplace_back(message);
  354|  11.7k|        }
  355|       |
  356|       |        /* Success if someone wants it */
  357|  13.0k|        return referencedMessage;
  358|  30.5k|    }
_ZN3uWS9TopicTreeINS_16TopicTreeMessageENS_19TopicTreeBigMessageEE11unsubscribeEPNS_10SubscriberENSt3__117basic_string_viewIcNS6_11char_traitsIcEEEE:
  185|    723|    std::tuple<bool, bool, int> unsubscribe(Subscriber *s, std::string_view topic) {
  186|       |        /* Notify user that they are doing something wrong here */
  187|    723|        checkIteratingSubscriber(s);
  188|       |
  189|       |        /* Lookup topic */
  190|    723|        Topic *topicPtr = lookupTopic(topic);
  191|    723|        if (!topicPtr) {
  ------------------
  |  Branch (191:13): [True: 723, False: 0]
  ------------------
  192|       |            /* If the topic doesn't exist we are assumed to still be subscribers of something */
  193|    723|            return {false, false, -1};
  194|    723|        }
  195|       |
  196|       |        /* Erase from our list first */
  197|      0|        if (s->topics.erase(topicPtr) == 0) {
  ------------------
  |  Branch (197:13): [True: 0, False: 0]
  ------------------
  198|      0|            return {false, false, -1};
  199|      0|        }
  200|       |
  201|       |        /* Remove us from topic */
  202|      0|        topicPtr->erase(s);
  203|       |
  204|      0|        int newCount = topicPtr->size();
  205|       |
  206|       |        /* If there is no subscriber to this topic, remove it */
  207|      0|        if (!topicPtr->size()) {
  ------------------
  |  Branch (207:13): [True: 0, False: 0]
  ------------------
  208|       |            /* Unique_ptr deletes the topic */
  209|      0|            topics.erase(topic);
  210|      0|        }
  211|       |
  212|       |        /* If we don't hold any topics we are to be freed altogether */
  213|      0|        return {true, s->topics.size() == 0, newCount};
  214|      0|    }

_ZN3uWS9WebSocketILb0ELb1EiE4sendENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEENS_6OpCodeEbb:
   92|  23.3k|    SendStatus send(std::string_view message, OpCode opCode = OpCode::BINARY, bool compress = false, bool fin = true) {
   93|  23.3k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
   94|  23.3k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
   95|  23.3k|        );
   96|       |
   97|       |        /* Skip sending and report success if we are over the limit of maxBackpressure */
   98|  23.3k|        if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
  ------------------
  |  Branch (98:13): [True: 23.3k, False: 0]
  |  Branch (98:54): [True: 0, False: 23.3k]
  ------------------
   99|       |            /* Also defer a close if we should */
  100|      0|            if (webSocketContextData->closeOnBackpressureLimit) {
  ------------------
  |  Branch (100:17): [True: 0, False: 0]
  ------------------
  101|      0|                us_socket_shutdown_read(SSL, (us_socket_t *) this);
  102|      0|            }
  103|      0|            return DROPPED;
  104|      0|        }
  105|       |
  106|       |        /* If we are subscribers and have messages to drain we need to drain them here to stay synced */
  107|  23.3k|        WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  108|       |
  109|       |        /* Special path for long sends of non-compressed, non-SSL messages */
  110|  23.3k|        if (message.length() >= 16 * 1024 && !compress && !SSL && !webSocketData->subscriber && getBufferedAmount() == 0 && Super::getLoopData()->corkOffset == 0) {
  ------------------
  |  Branch (110:13): [True: 0, False: 23.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|  23.3k|        } else {
  129|       |
  130|  23.3k|            if (webSocketData->subscriber) {
  ------------------
  |  Branch (130:17): [True: 23.3k, False: 0]
  ------------------
  131|       |                /* This will call back into us, send. */
  132|  23.3k|                webSocketContextData->topicTree->drain(webSocketData->subscriber);
  133|  23.3k|            }
  134|       |
  135|       |            /* Transform the message to compressed domain if requested */
  136|  23.3k|            if (compress) {
  ------------------
  |  Branch (136:17): [True: 23.3k, False: 0]
  ------------------
  137|  23.3k|                WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  138|       |
  139|       |                /* Check and correct the compress hint. It is never valid to compress 0 bytes */
  140|  23.3k|                if (message.length() && opCode < 3 && webSocketData->compressionStatus == WebSocketData::ENABLED) {
  ------------------
  |  Branch (140:21): [True: 23.3k, False: 0]
  |  Branch (140:41): [True: 23.3k, False: 0]
  |  Branch (140:55): [True: 602, False: 22.7k]
  ------------------
  141|    602|                    LoopData *loopData = Super::getLoopData();
  142|       |                    /* Compress using either shared or dedicated deflationStream */
  143|    602|                    if (webSocketData->deflationStream) {
  ------------------
  |  Branch (143:25): [True: 336, False: 266]
  ------------------
  144|    336|                        message = webSocketData->deflationStream->deflate(loopData->zlibContext, message, false);
  145|    336|                    } else {
  146|    266|                        message = loopData->deflationStream->deflate(loopData->zlibContext, message, true);
  147|    266|                    }
  148|  22.7k|                } else {
  149|  22.7k|                    compress = false;
  150|  22.7k|                }
  151|  23.3k|            }
  152|       |
  153|       |            /* Get size, allocate size, write if needed */
  154|  23.3k|            size_t messageFrameSize = protocol::messageFrameSize(message.length());
  155|  23.3k|            auto [sendBuffer, sendBufferAttribute] = Super::getSendBuffer(messageFrameSize);
  156|  23.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|  23.3k|            if (sendBufferAttribute == SendBufferAttribute::NEEDS_DRAIN) {
  ------------------
  |  Branch (159:17): [True: 20.4k, False: 2.92k]
  ------------------
  160|       |                /* This is a drain */
  161|  20.4k|                auto[written, failed] = Super::write(nullptr, 0);
  162|  20.4k|                if (failed) {
  ------------------
  |  Branch (162:21): [True: 19.6k, False: 727]
  ------------------
  163|       |                    /* Return false for failure, skipping to reset the timeout below */
  164|  19.6k|                    return BACKPRESSURE;
  165|  19.6k|                }
  166|  20.4k|            } else if (sendBufferAttribute == SendBufferAttribute::NEEDS_UNCORK) {
  ------------------
  |  Branch (166:24): [True: 0, False: 2.92k]
  ------------------
  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|  23.3k|        }
  175|       |
  176|       |        /* Every successful send resets the timeout */
  177|  3.65k|        if (webSocketContextData->resetIdleTimeoutOnSend) {
  ------------------
  |  Branch (177:13): [True: 0, False: 3.65k]
  ------------------
  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.65k|        return SUCCESS;
  185|  23.3k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE3endEiNSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  189|  7.49k|    void end(int code = 0, std::string_view message = {}) {
  190|       |        /* Check if we already called this one */
  191|  7.49k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  192|  7.49k|        if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (192:13): [True: 0, False: 7.49k]
  ------------------
  193|      0|            return;
  194|      0|        }
  195|       |
  196|       |        /* We postpone any FIN sending to either drainage or uncorking */
  197|  7.49k|        webSocketData->isShuttingDown = true;
  198|       |
  199|       |        /* Format and send the close frame */
  200|  7.49k|        static const int MAX_CLOSE_PAYLOAD = 123;
  201|  7.49k|        size_t length = std::min<size_t>(MAX_CLOSE_PAYLOAD, message.length());
  202|  7.49k|        char closePayload[MAX_CLOSE_PAYLOAD + 2];
  203|  7.49k|        size_t closePayloadLength = protocol::formatClosePayload(closePayload, (uint16_t) code, message.data(), length);
  204|  7.49k|        bool ok = send(std::string_view(closePayload, closePayloadLength), OpCode::CLOSE);
  205|       |
  206|       |        /* FIN if we are ok and not corked */
  207|  7.49k|        if (!this->isCorked()) {
  ------------------
  |  Branch (207:13): [True: 1.15k, False: 6.33k]
  ------------------
  208|  1.15k|            if (ok) {
  ------------------
  |  Branch (208:17): [True: 793, False: 360]
  ------------------
  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|    793|                this->shutdown();
  212|    793|            }
  213|  1.15k|        }
  214|       |
  215|  7.49k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  216|  7.49k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  217|  7.49k|        );
  218|       |
  219|       |        /* Set shorter timeout (use ping-timeout) to avoid long hanging sockets after end() on broken connections */
  220|  7.49k|        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|  7.49k|        if (webSocketData->subscriber && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (223:13): [True: 494, False: 6.99k]
  |  Branch (223:42): [True: 0, False: 494]
  ------------------
  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|  7.49k|        webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  231|  7.49k|        webSocketData->subscriber = nullptr;
  232|       |
  233|       |        /* Emit close event */
  234|  7.49k|        if (webSocketContextData->closeHandler) {
  ------------------
  |  Branch (234:13): [True: 7.49k, False: 0]
  ------------------
  235|  7.49k|            webSocketContextData->closeHandler(this, code, message);
  236|  7.49k|        }
  237|  7.49k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4sendENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEENS_6OpCodeEbb:
   92|  30.3k|    SendStatus send(std::string_view message, OpCode opCode = OpCode::BINARY, bool compress = false, bool fin = true) {
   93|  30.3k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
   94|  30.3k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
   95|  30.3k|        );
   96|       |
   97|       |        /* Skip sending and report success if we are over the limit of maxBackpressure */
   98|  30.3k|        if (webSocketContextData->maxBackpressure && webSocketContextData->maxBackpressure < getBufferedAmount()) {
  ------------------
  |  Branch (98:13): [True: 30.3k, False: 0]
  |  Branch (98:54): [True: 0, False: 30.3k]
  ------------------
   99|       |            /* Also defer a close if we should */
  100|      0|            if (webSocketContextData->closeOnBackpressureLimit) {
  ------------------
  |  Branch (100:17): [True: 0, False: 0]
  ------------------
  101|      0|                us_socket_shutdown_read(SSL, (us_socket_t *) this);
  102|      0|            }
  103|      0|            return DROPPED;
  104|      0|        }
  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: 5.46k, False: 24.8k]
  ------------------
  131|       |                /* This will call back into us, send. */
  132|  5.46k|                webSocketContextData->topicTree->drain(webSocketData->subscriber);
  133|  5.46k|            }
  134|       |
  135|       |            /* Transform the message to compressed domain if requested */
  136|  30.3k|            if (compress) {
  ------------------
  |  Branch (136:17): [True: 12.7k, False: 17.5k]
  ------------------
  137|  12.7k|                WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
  138|       |
  139|       |                /* Check and correct the compress hint. It is never valid to compress 0 bytes */
  140|  12.7k|                if (message.length() && opCode < 3 && webSocketData->compressionStatus == WebSocketData::ENABLED) {
  ------------------
  |  Branch (140:21): [True: 10.0k, False: 2.77k]
  |  Branch (140:41): [True: 10.0k, False: 0]
  |  Branch (140:55): [True: 5.88k, False: 4.12k]
  ------------------
  141|  5.88k|                    LoopData *loopData = Super::getLoopData();
  142|       |                    /* Compress using either shared or dedicated deflationStream */
  143|  5.88k|                    if (webSocketData->deflationStream) {
  ------------------
  |  Branch (143:25): [True: 3.09k, False: 2.78k]
  ------------------
  144|  3.09k|                        message = webSocketData->deflationStream->deflate(loopData->zlibContext, message, false);
  145|  3.09k|                    } else {
  146|  2.78k|                        message = loopData->deflationStream->deflate(loopData->zlibContext, message, true);
  147|  2.78k|                    }
  148|  6.90k|                } else {
  149|  6.90k|                    compress = false;
  150|  6.90k|                }
  151|  12.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: 25.7k, False: 4.57k]
  ------------------
  160|       |                /* This is a drain */
  161|  25.7k|                auto[written, failed] = Super::write(nullptr, 0);
  162|  25.7k|                if (failed) {
  ------------------
  |  Branch (162:21): [True: 23.4k, False: 2.30k]
  ------------------
  163|       |                    /* Return false for failure, skipping to reset the timeout below */
  164|  23.4k|                    return BACKPRESSURE;
  165|  23.4k|                }
  166|  25.7k|            } else if (sendBufferAttribute == SendBufferAttribute::NEEDS_UNCORK) {
  ------------------
  |  Branch (166:24): [True: 1.23k, False: 3.34k]
  ------------------
  167|       |                /* Uncork if we came here uncorked */
  168|  1.23k|                auto [written, failed] = Super::uncork();
  169|  1.23k|                if (failed) {
  ------------------
  |  Branch (169:21): [True: 649, False: 587]
  ------------------
  170|    649|                    return BACKPRESSURE;
  171|    649|                }
  172|  1.23k|            }
  173|       |
  174|  30.3k|        }
  175|       |
  176|       |        /* Every successful send resets the timeout */
  177|  6.23k|        if (webSocketContextData->resetIdleTimeoutOnSend) {
  ------------------
  |  Branch (177:13): [True: 0, False: 6.23k]
  ------------------
  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|  6.23k|        return SUCCESS;
  185|  30.3k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE11getUserDataEv:
   44|   290k|    USERDATA *getUserData() {
   45|   290k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
   46|       |        /* We just have it overallocated by sizeof type */
   47|   290k|        return (USERDATA *) (webSocketData + 1);
   48|   290k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE4initEbNS_15CompressOptionsEONS_12BackPressureE:
   37|   108k|    void *init(bool perMessageDeflate, CompressOptions compressOptions, BackPressure &&backpressure) {
   38|   108k|        new (us_socket_ext(SSL, (us_socket_t *) this)) WebSocketData(perMessageDeflate, compressOptions, std::move(backpressure));
   39|   108k|        return this;
   40|   108k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE9subscribeENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEb:
  255|  73.5k|    bool subscribe(std::string_view topic, bool = false) {
  256|  73.5k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  257|  73.5k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  258|  73.5k|        );
  259|       |
  260|       |        /* Make us a subscriber if we aren't yet */
  261|  73.5k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  262|  73.5k|        if (!webSocketData->subscriber) {
  ------------------
  |  Branch (262:13): [True: 73.5k, False: 0]
  ------------------
  263|  73.5k|            webSocketData->subscriber = webSocketContextData->topicTree->createSubscriber();
  264|  73.5k|            webSocketData->subscriber->user = this;
  265|  73.5k|        }
  266|       |
  267|       |        /* Cannot return numSubscribers as this is only for this particular websocket context */
  268|  73.5k|        Topic *topicOrNull = webSocketContextData->topicTree->subscribe(webSocketData->subscriber, topic);
  269|  73.5k|        if (topicOrNull && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (269:13): [True: 73.5k, False: 0]
  |  Branch (269:28): [True: 0, False: 73.5k]
  ------------------
  270|       |            /* Emit this socket, the topic, new count, old count */
  271|      0|            webSocketContextData->subscriptionHandler(this, topic, (int) topicOrNull->size(), (int) topicOrNull->size() - 1);
  272|      0|        }
  273|       |
  274|       |        /* Subscribe always succeeds */
  275|  73.5k|        return true;
  276|  73.5k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE5closeEv:
   58|  74.1k|    us_socket_t *close() {
   59|  74.1k|        if (us_socket_is_closed(SSL, (us_socket_t *) this)) {
  ------------------
  |  Branch (59:13): [True: 73.0k, False: 1.07k]
  ------------------
   60|  73.0k|            return nullptr;
   61|  73.0k|        }
   62|  1.07k|        WebSocketData *webSocketData = (WebSocketData *) Super::getAsyncSocketData();
   63|  1.07k|        if (webSocketData->isShuttingDown) {
  ------------------
  |  Branch (63:13): [True: 494, False: 583]
  ------------------
   64|    494|            return nullptr;
   65|    494|        }
   66|       |
   67|    583|        return us_socket_close(SSL, (us_socket_t *) this, 0, nullptr);
   68|  1.07k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE7publishENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEES7_NS_6OpCodeEb:
  349|  30.5k|    bool publish(std::string_view topic, std::string_view message, OpCode opCode = OpCode::TEXT, bool compress = false) {
  350|  30.5k|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  351|  30.5k|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  352|  30.5k|        );
  353|       |
  354|       |        /* We cannot be a subscriber of this topic if we are not a subscriber of anything */
  355|  30.5k|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  356|  30.5k|        if (!webSocketData->subscriber) {
  ------------------
  |  Branch (356:13): [True: 0, False: 30.5k]
  ------------------
  357|       |            /* Failure, but still do return the number of subscribers */
  358|      0|            return false;
  359|      0|        }
  360|       |
  361|       |        /* Publish as sender, does not receive its own messages even if subscribed to relevant topics */
  362|  30.5k|        if (message.length() >= LoopData::CORK_BUFFER_SIZE) {
  ------------------
  |  Branch (362:13): [True: 0, False: 30.5k]
  ------------------
  363|      0|            return webSocketContextData->topicTree->publishBig(webSocketData->subscriber, topic, {message, opCode, compress}, [](Subscriber *s, TopicTreeBigMessage &message) {
  364|      0|                auto *ws = (WebSocket<SSL, true, int> *) s->user;
  365|       |
  366|      0|                ws->send(message.message, (OpCode)message.opCode, message.compress);
  367|      0|            });
  368|  30.5k|        } else {
  369|  30.5k|            return webSocketContextData->topicTree->publish(webSocketData->subscriber, topic, {std::string(message), opCode, compress});
  370|  30.5k|        }
  371|  30.5k|    }
EpollEchoServer.cpp:_ZN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataE11unsubscribeENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEEb:
  279|    723|    bool unsubscribe(std::string_view topic, bool = false) {
  280|    723|        WebSocketContextData<SSL, USERDATA> *webSocketContextData = (WebSocketContextData<SSL, USERDATA> *) us_socket_context_ext(SSL,
  281|    723|            (us_socket_context_t *) us_socket_context(SSL, (us_socket_t *) this)
  282|    723|        );
  283|       |
  284|    723|        WebSocketData *webSocketData = (WebSocketData *) us_socket_ext(SSL, (us_socket_t *) this);
  285|       |        
  286|    723|        if (!webSocketData->subscriber) { return false; }
  ------------------
  |  Branch (286:13): [True: 0, False: 723]
  ------------------
  287|       |
  288|       |        /* Cannot return numSubscribers as this is only for this particular websocket context */
  289|    723|        auto [ok, last, newCount] = webSocketContextData->topicTree->unsubscribe(webSocketData->subscriber, topic);
  290|       |        /* Emit subscription event if last */
  291|    723|        if (ok && webSocketContextData->subscriptionHandler) {
  ------------------
  |  Branch (291:13): [True: 0, False: 723]
  |  Branch (291:19): [True: 0, False: 0]
  ------------------
  292|      0|            webSocketContextData->subscriptionHandler(this, topic, newCount, newCount + 1);
  293|      0|        }
  294|       |
  295|       |        /* Free us as subscribers if we unsubscribed from our last topic */
  296|    723|        if (ok && last) {
  ------------------
  |  Branch (296:13): [True: 0, False: 723]
  |  Branch (296:19): [True: 0, False: 0]
  ------------------
  297|      0|            webSocketContextData->topicTree->freeSubscriber(webSocketData->subscriber);
  298|      0|            webSocketData->subscriber = nullptr;
  299|      0|        }
  300|       |
  301|    723|        return ok;
  302|    723|    }

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

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

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

EpollEchoServer.cpp:_ZN3uWSL20negotiateCompressionEbiiNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  144|  8.07k|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|  8.07k|    if (!wantCompression) {
  ------------------
  |  Branch (147:9): [True: 0, False: 8.07k]
  ------------------
  148|      0|        return {false, 0, 0, ""};
  149|      0|    }
  150|       |
  151|  8.07k|    ExtensionsParser ep(offer.data(), offer.length());
  152|       |
  153|  8.07k|    static thread_local std::string response;
  154|  8.07k|    response = "";
  155|       |
  156|  8.07k|    int compressionWindow = wantedCompressionWindow;
  157|  8.07k|    int inflationWindow = wantedInflationWindow;
  158|  8.07k|    bool compression = false;
  159|       |
  160|  8.07k|    if (ep.xWebKitDeflateFrame) {
  ------------------
  |  Branch (160:9): [True: 2.06k, False: 6.00k]
  ------------------
  161|       |        /* We now have compression */
  162|  2.06k|        compression = true;
  163|  2.06k|        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|  2.06k|        if (ep.noContextTakeover) {
  ------------------
  |  Branch (167:13): [True: 395, False: 1.67k]
  ------------------
  168|       |            /* We must fail here right now (fix pub/sub) */
  169|    395|#ifndef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  170|    395|            if (wantedCompressionWindow != 0) {
  ------------------
  |  Branch (170:17): [True: 201, False: 194]
  ------------------
  171|    201|                return {false, 0, 0, ""};
  172|    201|            }
  173|    194|#endif
  174|       |
  175|    194|            compressionWindow = 0;
  176|    194|        }
  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|  1.86k|        if (ep.maxWindowBits && ep.maxWindowBits < compressionWindow) {
  ------------------
  |  Branch (180:13): [True: 1.34k, False: 517]
  |  Branch (180:33): [True: 825, False: 523]
  ------------------
  181|    825|            compressionWindow = ep.maxWindowBits;
  182|    825|#ifndef UWS_ALLOW_8_WINDOW_BITS
  183|       |            /* We cannot really deny this, so we have to disable compression in this case */
  184|    825|            if (compressionWindow == 8) {
  ------------------
  |  Branch (184:17): [True: 594, False: 231]
  ------------------
  185|    594|                return {false, 0, 0, ""};
  186|    594|            }
  187|    825|#endif
  188|    825|        }
  189|       |
  190|       |        /* We decide our own inflation sliding window (and their compression sliding window) */
  191|  1.27k|        if (wantedInflationWindow < 15) {
  ------------------
  |  Branch (191:13): [True: 1.27k, False: 0]
  ------------------
  192|  1.27k|            if (!wantedInflationWindow) {
  ------------------
  |  Branch (192:17): [True: 1.27k, False: 0]
  ------------------
  193|  1.27k|                response += "; no_context_takeover";
  194|  1.27k|            } else {
  195|      0|                response += "; max_window_bits=" + std::to_string(wantedInflationWindow);
  196|      0|            }
  197|  1.27k|        }
  198|  6.00k|    } else if (ep.perMessageDeflate) {
  ------------------
  |  Branch (198:16): [True: 3.17k, False: 2.83k]
  ------------------
  199|       |        /* We now have compression */
  200|  3.17k|        compression = true;
  201|  3.17k|        response = "permessage-deflate";
  202|       |
  203|  3.17k|        if (ep.clientNoContextTakeover) {
  ------------------
  |  Branch (203:13): [True: 194, False: 2.97k]
  ------------------
  204|    194|            inflationWindow = 0;
  205|  2.97k|        } else if (ep.clientMaxWindowBits && ep.clientMaxWindowBits != 1) {
  ------------------
  |  Branch (205:20): [True: 440, False: 2.53k]
  |  Branch (205:46): [True: 220, False: 220]
  ------------------
  206|    220|            inflationWindow = std::min<int>(ep.clientMaxWindowBits, inflationWindow);
  207|    220|        }
  208|       |
  209|       |        /* Whatever we have now, write */
  210|  3.17k|        if (inflationWindow < 15) {
  ------------------
  |  Branch (210:13): [True: 3.17k, False: 0]
  ------------------
  211|  3.17k|            if (!inflationWindow || !ep.clientMaxWindowBits) {
  ------------------
  |  Branch (211:17): [True: 3.17k, False: 0]
  |  Branch (211:37): [True: 0, False: 0]
  ------------------
  212|  3.17k|                response += "; client_no_context_takeover";
  213|  3.17k|                inflationWindow = 0;
  214|  3.17k|            } else {
  215|      0|                response += "; client_max_window_bits=" + std::to_string(inflationWindow);
  216|      0|            }
  217|  3.17k|        }
  218|       |
  219|       |        /* This block basically lets the client lower it */
  220|  3.17k|        if (ep.serverNoContextTakeover) {
  ------------------
  |  Branch (220:13): [True: 230, False: 2.94k]
  ------------------
  221|       |        /* This is an important (temporary) fix since we haven't allowed
  222|       |         * these two modes to mix, and pub/sub will not handle this case (yet) */
  223|       |#ifdef UWS_ALLOW_SHARED_AND_DEDICATED_COMPRESSOR_MIX
  224|       |            compressionWindow = 0;
  225|       |#endif
  226|  2.94k|        } else if (ep.serverMaxWindowBits) {
  ------------------
  |  Branch (226:20): [True: 451, False: 2.49k]
  ------------------
  227|    451|            compressionWindow = std::min<int>(ep.serverMaxWindowBits, compressionWindow);
  228|    451|#ifndef UWS_ALLOW_8_WINDOW_BITS
  229|       |            /* Zlib cannot do windowBits=8, memLevel=1 so we raise it up to 9 minimum */
  230|    451|            if (compressionWindow == 8) {
  ------------------
  |  Branch (230:17): [True: 208, False: 243]
  ------------------
  231|    208|                compressionWindow = 9;
  232|    208|            }
  233|    451|#endif
  234|    451|        }
  235|       |
  236|       |        /* Whatever we have now, write */
  237|  3.17k|        if (compressionWindow < 15) {
  ------------------
  |  Branch (237:13): [True: 2.58k, False: 586]
  ------------------
  238|  2.58k|            if (!compressionWindow) {
  ------------------
  |  Branch (238:17): [True: 1.44k, False: 1.13k]
  ------------------
  239|  1.44k|                response += "; server_no_context_takeover";
  240|  1.44k|            } else {
  241|  1.13k|                response += "; server_max_window_bits=" + std::to_string(compressionWindow);
  242|  1.13k|            }
  243|  2.58k|        }
  244|  3.17k|    }
  245|       |
  246|       |    /* A final sanity check (this check does not actually catch too high values!) */
  247|  7.28k|    if ((compressionWindow && compressionWindow < 8) || compressionWindow > 15 || (inflationWindow && inflationWindow < 8) || inflationWindow > 15) {
  ------------------
  |  Branch (247:10): [True: 4.04k, False: 3.23k]
  |  Branch (247:31): [True: 254, False: 3.79k]
  |  Branch (247:57): [True: 0, False: 7.02k]
  |  Branch (247:84): [True: 0, False: 7.02k]
  |  Branch (247:103): [True: 0, False: 0]
  |  Branch (247:127): [True: 0, False: 7.02k]
  ------------------
  248|    254|        return {false, 0, 0, ""};
  249|    254|    }
  250|       |
  251|  7.02k|    return {compression, compressionWindow, inflationWindow, response};
  252|  7.28k|}
_ZN3uWS16ExtensionsParserC2EPKcm:
   93|  8.07k|    ExtensionsParser(const char *data, size_t length) {
   94|  8.07k|        const char *stop = data + length;
   95|  8.07k|        int token = 1;
   96|       |
   97|       |        /* Ignore anything before permessage-deflate or x-webkit-deflate-frame */
   98|  19.7k|        for (; token && token != TOK_PERMESSAGE_DEFLATE && token != TOK_X_WEBKIT_DEFLATE_FRAME; token = getToken(data, stop));
  ------------------
  |  Branch (98:16): [True: 16.8k, False: 2.83k]
  |  Branch (98:25): [True: 13.6k, False: 3.17k]
  |  Branch (98:60): [True: 11.6k, False: 2.06k]
  ------------------
   99|       |
  100|       |        /* What protocol are we going to use? */
  101|  8.07k|        perMessageDeflate = (token == TOK_PERMESSAGE_DEFLATE);
  102|  8.07k|        xWebKitDeflateFrame = (token == TOK_X_WEBKIT_DEFLATE_FRAME);
  103|       |
  104|  31.7k|        while ((token = getToken(data, stop))) {
  ------------------
  |  Branch (104:16): [True: 24.2k, False: 7.47k]
  ------------------
  105|  24.2k|            switch (token) {
  106|    258|            case TOK_X_WEBKIT_DEFLATE_FRAME:
  ------------------
  |  Branch (106:13): [True: 258, False: 24.0k]
  ------------------
  107|       |                /* Duplicates not allowed/supported */
  108|    258|                return;
  109|    589|            case TOK_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (109:13): [True: 589, False: 23.6k]
  ------------------
  110|    589|                noContextTakeover = true;
  111|    589|                break;
  112|  2.11k|            case TOK_MAX_WINDOW_BITS:
  ------------------
  |  Branch (112:13): [True: 2.11k, False: 22.1k]
  ------------------
  113|  2.11k|                maxWindowBits = 1;
  114|  2.11k|                lastInteger = &maxWindowBits;
  115|  2.11k|                break;
  116|    338|            case TOK_PERMESSAGE_DEFLATE:
  ------------------
  |  Branch (116:13): [True: 338, False: 23.9k]
  ------------------
  117|       |                /* Duplicates not allowed/supported */
  118|    338|                return;
  119|    512|            case TOK_SERVER_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (119:13): [True: 512, False: 23.7k]
  ------------------
  120|    512|                serverNoContextTakeover = true;
  121|    512|                break;
  122|    388|            case TOK_CLIENT_NO_CONTEXT_TAKEOVER:
  ------------------
  |  Branch (122:13): [True: 388, False: 23.8k]
  ------------------
  123|    388|                clientNoContextTakeover = true;
  124|    388|                break;
  125|    752|            case TOK_SERVER_MAX_WINDOW_BITS:
  ------------------
  |  Branch (125:13): [True: 752, False: 23.5k]
  ------------------
  126|    752|                serverMaxWindowBits = 1;
  127|    752|                lastInteger = &serverMaxWindowBits;
  128|    752|                break;
  129|    624|            case TOK_CLIENT_MAX_WINDOW_BITS:
  ------------------
  |  Branch (129:13): [True: 624, False: 23.6k]
  ------------------
  130|    624|                clientMaxWindowBits = 1;
  131|    624|                lastInteger = &clientMaxWindowBits;
  132|    624|                break;
  133|  18.6k|            default:
  ------------------
  |  Branch (133:13): [True: 18.6k, False: 5.57k]
  ------------------
  134|  18.6k|                if (token < 0 && lastInteger) {
  ------------------
  |  Branch (134:21): [True: 5.51k, False: 13.1k]
  |  Branch (134:34): [True: 4.84k, False: 674]
  ------------------
  135|  4.84k|                    *lastInteger = -token;
  136|  4.84k|                }
  137|  18.6k|                break;
  138|  24.2k|            }
  139|  24.2k|        }
  140|  8.07k|    }
_ZN3uWS16ExtensionsParser8getTokenERPKcS2_:
   69|  43.3k|    int getToken(const char *&in, const char *stop) {
   70|   107k|        while (in != stop && !isalnum(*in)) {
  ------------------
  |  Branch (70:16): [True: 98.7k, False: 9.01k]
  |  Branch (70:30): [True: 64.4k, False: 34.3k]
  ------------------
   71|  64.4k|            in++;
   72|  64.4k|        }
   73|       |
   74|       |        /* Don't care more than this for now */
   75|  43.3k|        static_assert(SHRT_MIN > INT_MIN, "Integer overflow fix is invalid for this platform, report this as a bug!");
   76|       |
   77|  43.3k|        int hashedToken = 0;
   78|   338k|        while (in != stop && (isalnum(*in) || *in == '-' || *in == '_')) {
  ------------------
  |  Branch (78:16): [True: 326k, False: 12.2k]
  |  Branch (78:31): [True: 276k, False: 49.3k]
  |  Branch (78:47): [True: 17.8k, False: 31.4k]
  |  Branch (78:61): [True: 256, False: 31.1k]
  ------------------
   79|   294k|            if (isdigit(*in)) {
  ------------------
  |  Branch (79:17): [True: 20.9k, False: 273k]
  ------------------
   80|       |                /* This check is a quick and incorrect fix for integer overflow
   81|       |                 * in oss-fuzz but we don't care as it doesn't matter either way */
   82|  20.9k|                if (hashedToken > SHRT_MIN && hashedToken < SHRT_MAX) {
  ------------------
  |  Branch (82:21): [True: 20.2k, False: 780]
  |  Branch (82:47): [True: 19.4k, False: 767]
  ------------------
   83|  19.4k|                    hashedToken = hashedToken * 10 - (*in - '0');
   84|  19.4k|                }
   85|   273k|            } else {
   86|   273k|                hashedToken += *in;
   87|   273k|            }
   88|   294k|            in++;
   89|   294k|        }
   90|  43.3k|        return hashedToken;
   91|  43.3k|    }

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

EpollEchoServer.cpp:_ZN3uWS8protocolL13formatMessageILb1EEEmPcPKcmNS_6OpCodeEmbb:
  209|  53.6k|static inline size_t formatMessage(char *dst, const char *src, size_t length, OpCode opCode, size_t reportedLength, bool compressed, bool fin) {
  210|  53.6k|    size_t messageLength;
  211|  53.6k|    size_t headerLength;
  212|  53.6k|    if (reportedLength < 126) {
  ------------------
  |  Branch (212:9): [True: 52.7k, False: 944]
  ------------------
  213|  52.7k|        headerLength = 2;
  214|  52.7k|        dst[1] = (char) reportedLength;
  215|  52.7k|    } else if (reportedLength <= UINT16_MAX) {
  ------------------
  |  Branch (215:16): [True: 944, False: 0]
  ------------------
  216|    944|        headerLength = 4;
  217|    944|        dst[1] = 126;
  218|    944|        uint16_t tmp = cond_byte_swap<uint16_t>((uint16_t) reportedLength);
  219|    944|        memcpy(&dst[2], &tmp, sizeof(uint16_t));
  220|    944|    } 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|  53.6k|    dst[0] = (char) ((fin ? 128 : 0) | ((compressed && opCode) ? SND_COMPRESSED : 0) | (char) opCode);
  ------------------
  |  Branch (227:23): [True: 53.6k, False: 0]
  |  Branch (227:42): [True: 6.48k, False: 47.1k]
  |  Branch (227:56): [True: 6.48k, False: 0]
  ------------------
  228|       |
  229|       |    //printf("%d\n", (int)dst[0]);
  230|       |
  231|  53.6k|    char mask[4];
  232|  53.6k|    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|  53.6k|    messageLength = headerLength + length;
  241|  53.6k|    memcpy(dst + headerLength, src, length);
  242|       |
  243|  53.6k|    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|  53.6k|    return messageLength;
  257|  53.6k|}
_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|  43.1k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 28.7k, False: 14.3k]
  ------------------
  104|  28.7k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  28.7k|        }
  106|       |
  107|  14.3k|        return dst.i;
  108|  14.3k|    }
  109|      0|    return value;
  110|  14.3k|}
_ZN3uWS8protocol14cond_byte_swapImEET_S2_:
   95|  6.03k|T cond_byte_swap(T value) {
   96|  6.03k|    uint32_t endian_test = 1;
   97|  6.03k|    if (*((char *)&endian_test)) {
  ------------------
  |  Branch (97:9): [True: 6.03k, False: 0]
  ------------------
   98|  6.03k|        union {
   99|  6.03k|            T i;
  100|  6.03k|            uint8_t b[sizeof(T)];
  101|  6.03k|        } src = { value }, dst;
  102|       |
  103|  54.2k|        for (unsigned int i = 0; i < sizeof(value); i++) {
  ------------------
  |  Branch (103:34): [True: 48.2k, False: 6.03k]
  ------------------
  104|  48.2k|            dst.b[i] = src.b[sizeof(value) - 1 - i];
  105|  48.2k|        }
  106|       |
  107|  6.03k|        return dst.i;
  108|  6.03k|    }
  109|      0|    return value;
  110|  6.03k|}
EpollEchoServer.cpp:_ZN3uWS8protocolL16messageFrameSizeEm:
  193|  53.6k|static inline size_t messageFrameSize(size_t messageSize) {
  194|  53.6k|    if (messageSize < 126) {
  ------------------
  |  Branch (194:9): [True: 52.7k, False: 944]
  ------------------
  195|  52.7k|        return 2 + messageSize;
  196|  52.7k|    } else if (messageSize <= UINT16_MAX) {
  ------------------
  |  Branch (196:16): [True: 944, False: 0]
  ------------------
  197|    944|        return 4 + messageSize;
  198|    944|    }
  199|      0|    return 10 + messageSize;
  200|  53.6k|}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE7consumeEPcjPNS_14WebSocketStateILb1EEEPv:
  458|  55.0k|    static inline void consume(char *src, unsigned int length, WebSocketState<isServer> *wState, void *user) {
  459|  55.0k|        if (wState->state.spillLength) {
  ------------------
  |  Branch (459:13): [True: 3.54k, False: 51.4k]
  ------------------
  460|  3.54k|            src -= wState->state.spillLength;
  461|  3.54k|            length += wState->state.spillLength;
  462|  3.54k|            memcpy(src, wState->state.spill, wState->state.spillLength);
  463|  3.54k|        }
  464|  55.0k|        if (wState->state.wantsHead) {
  ------------------
  |  Branch (464:13): [True: 45.4k, False: 9.57k]
  ------------------
  465|  49.9k|            parseNext:
  466|   112k|            while (length >= SHORT_MESSAGE_HEADER) {
  ------------------
  |  Branch (466:20): [True: 103k, False: 9.38k]
  ------------------
  467|       |
  468|       |                // invalid reserved bits / invalid opcodes / invalid control frames / set compressed frame
  469|   103k|                if ((rsv1(src) && !Impl::setCompressed(wState, user)) || rsv23(src) || (getOpCode(src) > 2 && getOpCode(src) < 8) ||
  ------------------
  |  Branch (469:22): [True: 13.1k, False: 90.2k]
  |  Branch (469:35): [True: 9.65k, False: 3.52k]
  |  Branch (469:74): [True: 2.82k, False: 90.9k]
  |  Branch (469:89): [True: 20.5k, False: 70.3k]
  |  Branch (469:111): [True: 1.73k, False: 18.8k]
  ------------------
  470|   103k|                    getOpCode(src) > 10 || (getOpCode(src) > 2 && (!isFin(src) || payloadLength(src) > 125))) {
  ------------------
  |  Branch (470:21): [True: 1.20k, False: 88.0k]
  |  Branch (470:45): [True: 17.6k, False: 70.3k]
  |  Branch (470:68): [True: 372, False: 17.2k]
  |  Branch (470:83): [True: 451, False: 16.8k]
  ------------------
  471|  16.2k|                    Impl::forceClose(wState, user);
  472|  16.2k|                    return;
  473|  16.2k|                }
  474|       |
  475|  87.2k|                if (payloadLength(src) < 126) {
  ------------------
  |  Branch (475:21): [True: 73.5k, False: 13.6k]
  ------------------
  476|  73.5k|                    if (consumeMessage<SHORT_MESSAGE_HEADER, uint8_t>(payloadLength(src), src, length, wState, user)) {
  ------------------
  |  Branch (476:25): [True: 14.9k, False: 58.5k]
  ------------------
  477|  14.9k|                        return;
  478|  14.9k|                    }
  479|  73.5k|                } else if (payloadLength(src) == 126) {
  ------------------
  |  Branch (479:28): [True: 7.02k, False: 6.63k]
  ------------------
  480|  7.02k|                    if (length < MEDIUM_MESSAGE_HEADER) {
  ------------------
  |  Branch (480:25): [True: 725, False: 6.29k]
  ------------------
  481|    725|                        break;
  482|  6.29k|                    } 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.43k, False: 1.85k]
  ------------------
  483|  4.43k|                        return;
  484|  4.43k|                    }
  485|  7.02k|                } else if (length < LONG_MESSAGE_HEADER) {
  ------------------
  |  Branch (485:28): [True: 603, False: 6.03k]
  ------------------
  486|    603|                    break;
  487|  6.03k|                } 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.63k, False: 2.39k]
  ------------------
  488|  3.63k|                    return;
  489|  3.63k|                }
  490|  87.2k|            }
  491|  10.7k|            if (length) {
  ------------------
  |  Branch (491:17): [True: 9.45k, False: 1.25k]
  ------------------
  492|  9.45k|                memcpy(wState->state.spill, src, length);
  493|  9.45k|                wState->state.spillLength = length & 0xf;
  494|  9.45k|            }
  495|  10.7k|        } else if (consumeContinuation(src, length, wState, user)) {
  ------------------
  |  Branch (495:20): [True: 4.53k, False: 5.04k]
  ------------------
  496|  4.53k|            goto parseNext;
  497|  4.53k|        }
  498|  55.0k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE4rsv1EPc:
  274|   103k|    static inline bool rsv1(char *frame) {return *((unsigned char *) frame) & 64;}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5rsv23EPc:
  273|  93.7k|    static inline bool rsv23(char *frame) {return *((unsigned char *) frame) & 48;}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE9getOpCodeEPc:
  271|   453k|    static inline unsigned char getOpCode(char *frame) {return *((unsigned char *) frame) & 15;}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE5isFinEPc:
  270|   183k|    static inline bool isFin(char *frame) {return *((unsigned char *) frame) & 128;}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13payloadLengthEPc:
  272|   191k|    static inline unsigned char payloadLength(char *frame) {return ((unsigned char *) frame)[1] & 127;}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj6EhEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  73.5k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  73.5k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 65.7k, False: 7.78k]
  ------------------
  342|  65.7k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 205, False: 65.5k]
  |  Branch (342:48): [True: 2.43k, False: 63.1k]
  |  Branch (342:74): [True: 270, False: 2.16k]
  ------------------
  343|    475|                Impl::forceClose(wState, user);
  344|    475|                return true;
  345|    475|            }
  346|  65.2k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  65.2k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 835, False: 6.95k]
  ------------------
  348|    835|            Impl::forceClose(wState, user);
  349|    835|            return true;
  350|    835|        }
  351|  72.2k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  72.2k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 0, False: 72.2k]
  ------------------
  354|      0|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|      0|            return true;
  356|      0|        }
  357|       |
  358|  72.2k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 64.5k, False: 7.71k]
  ------------------
  359|  64.5k|            bool fin = isFin(src);
  360|  64.5k|            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|  64.5k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  64.5k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 5.93k, False: 58.5k]
  ------------------
  364|  5.93k|                    return true;
  365|  5.93k|                }
  366|  64.5k|            } 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|  58.5k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 47.8k, False: 10.7k]
  ------------------
  373|  47.8k|                wState->state.opStack--;
  374|  47.8k|            }
  375|       |
  376|  58.5k|            src += payLength + MESSAGE_HEADER;
  377|  58.5k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  58.5k|            wState->state.spillLength = 0;
  379|  58.5k|            return false;
  380|  64.5k|        } else {
  381|  7.71k|            wState->state.spillLength = 0;
  382|  7.71k|            wState->state.wantsHead = false;
  383|  7.71k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  7.71k|            bool fin = isFin(src);
  385|  7.71k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  7.71k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  7.71k|                uint64_t mask;
  388|  7.71k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  7.71k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  7.71k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  7.71k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  7.71k|            }
  393|  7.71k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  7.71k|            return true;
  395|  7.71k|        }
  396|  72.2k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi6EEEvPcj:
  308|  64.5k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  64.5k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  64.5k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  64.5k|            uint64_t maskInt;
  312|  64.5k|            memcpy(&maskInt, mask, 8);
  313|  64.5k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  64.5k|        } else {
  315|  64.5k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  64.5k|            uint32_t maskInt;
  317|  64.5k|            memcpy(&maskInt, mask, 4);
  318|  64.5k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  64.5k|        }
  320|  64.5k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise4ILi6EEEvPcjj:
  297|  64.5k|    static inline void unmaskImprecise4(char *src, uint32_t mask, unsigned int length) {
  298|   202k|        for (unsigned int n = (length >> 2) + 1; n; n--) {
  ------------------
  |  Branch (298:50): [True: 138k, False: 64.5k]
  ------------------
  299|   138k|            uint32_t loaded;
  300|   138k|            memcpy(&loaded, src, 4);
  301|   138k|            loaded ^= mask;
  302|   138k|            memcpy(src - DESTINATION, &loaded, 4);
  303|   138k|            src += 4;
  304|   138k|        }
  305|  64.5k|    }
EpollEchoServer.cpp:_ZN3uWS8protocolL11isValidUtf8EPhm:
  117|  40.7k|{
  118|   116k|    for (unsigned char *e = s + length; s != e; ) {
  ------------------
  |  Branch (118:41): [True: 114k, False: 2.13k]
  ------------------
  119|   114k|        if (s + 4 <= e) {
  ------------------
  |  Branch (119:13): [True: 81.5k, False: 32.9k]
  ------------------
  120|  81.5k|            uint32_t tmp;
  121|  81.5k|            memcpy(&tmp, s, 4);
  122|  81.5k|            if ((tmp & 0x80808080) == 0) {
  ------------------
  |  Branch (122:17): [True: 70.3k, False: 11.2k]
  ------------------
  123|  70.3k|                s += 4;
  124|  70.3k|                continue;
  125|  70.3k|            }
  126|  81.5k|        }
  127|       |
  128|  61.6k|        while (!(*s & 0x80)) {
  ------------------
  |  Branch (128:16): [True: 49.6k, False: 12.0k]
  ------------------
  129|  49.6k|            if (++s == e) {
  ------------------
  |  Branch (129:17): [True: 32.1k, False: 17.4k]
  ------------------
  130|  32.1k|                return true;
  131|  32.1k|            }
  132|  49.6k|        }
  133|       |
  134|  12.0k|        if ((s[0] & 0x60) == 0x40) {
  ------------------
  |  Branch (134:13): [True: 1.47k, False: 10.5k]
  ------------------
  135|  1.47k|            if (s + 1 >= e || (s[1] & 0xc0) != 0x80 || (s[0] & 0xfe) == 0xc0) {
  ------------------
  |  Branch (135:17): [True: 248, False: 1.22k]
  |  Branch (135:31): [True: 571, False: 651]
  |  Branch (135:56): [True: 207, False: 444]
  ------------------
  136|  1.02k|                return false;
  137|  1.02k|            }
  138|    444|            s += 2;
  139|  10.5k|        } else if ((s[0] & 0xf0) == 0xe0) {
  ------------------
  |  Branch (139:20): [True: 1.92k, False: 8.64k]
  ------------------
  140|  1.92k|            if (s + 2 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (140:17): [True: 350, False: 1.57k]
  |  Branch (140:31): [True: 382, False: 1.19k]
  |  Branch (140:56): [True: 217, False: 978]
  ------------------
  141|  1.92k|                    (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || (s[0] == 0xed && (s[1] & 0xe0) == 0xa0)) {
  ------------------
  |  Branch (141:22): [True: 266, False: 712]
  |  Branch (141:38): [True: 194, False: 72]
  |  Branch (141:65): [True: 405, False: 379]
  |  Branch (141:81): [True: 209, False: 196]
  ------------------
  142|  1.35k|                return false;
  143|  1.35k|            }
  144|    575|            s += 3;
  145|  8.64k|        } else if ((s[0] & 0xf8) == 0xf0) {
  ------------------
  |  Branch (145:20): [True: 6.61k, False: 2.03k]
  ------------------
  146|  6.61k|            if (s + 3 >= e || (s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80 ||
  ------------------
  |  Branch (146:17): [True: 217, False: 6.39k]
  |  Branch (146:31): [True: 259, False: 6.13k]
  |  Branch (146:56): [True: 746, False: 5.38k]
  |  Branch (146:81): [True: 210, False: 5.17k]
  ------------------
  147|  6.61k|                    (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4) {
  ------------------
  |  Branch (147:22): [True: 4.18k, False: 996]
  |  Branch (147:38): [True: 194, False: 3.98k]
  |  Branch (147:65): [True: 399, False: 4.58k]
  |  Branch (147:81): [True: 201, False: 198]
  |  Branch (147:97): [True: 214, False: 4.57k]
  ------------------
  148|  2.04k|                return false;
  149|  2.04k|            }
  150|  4.57k|            s += 4;
  151|  4.57k|        } else {
  152|  2.03k|            return false;
  153|  2.03k|        }
  154|  12.0k|    }
  155|  2.13k|    return true;
  156|  40.7k|}
EpollEchoServer.cpp:_ZN3uWS8protocolL17parseClosePayloadEPcm:
  164|  5.73k|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.73k|    CloseFrame cf = {1005, nullptr, 0};
  167|  5.73k|    if (length >= 2) {
  ------------------
  |  Branch (167:9): [True: 5.52k, False: 209]
  ------------------
  168|  5.52k|        memcpy(&cf.code, src, 2);
  169|  5.52k|        cf = {cond_byte_swap<uint16_t>(cf.code), src + 2, length - 2};
  170|  5.52k|        if (cf.code < 1000 || cf.code > 4999 || (cf.code > 1011 && cf.code < 4000) ||
  ------------------
  |  Branch (170:13): [True: 440, False: 5.08k]
  |  Branch (170:31): [True: 667, False: 4.42k]
  |  Branch (170:50): [True: 2.45k, False: 1.96k]
  |  Branch (170:68): [True: 789, False: 1.67k]
  ------------------
  171|  5.52k|            (cf.code >= 1004 && cf.code <= 1006) || !isValidUtf8((unsigned char *) cf.message, cf.length)) {
  ------------------
  |  Branch (171:14): [True: 2.98k, False: 648]
  |  Branch (171:33): [True: 565, False: 2.41k]
  |  Branch (171:53): [True: 2.36k, False: 705]
  ------------------
  172|       |            /* Even though we got a WebSocket close frame, it in itself is abnormal */
  173|  4.82k|            return {1006, nullptr, 0};
  174|  4.82k|        }
  175|  5.52k|    }
  176|    914|    return cf;
  177|  5.73k|}
EpollEchoServer.cpp:_ZN3uWS8protocolL18formatClosePayloadEPctPKcm:
  179|  7.49k|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|  7.49k|    if (code && code != 1005 && code != 1006) {
  ------------------
  |  Branch (181:9): [True: 7.49k, False: 0]
  |  Branch (181:17): [True: 7.28k, False: 209]
  |  Branch (181:33): [True: 1.62k, False: 5.65k]
  ------------------
  182|  1.62k|        code = cond_byte_swap<uint16_t>(code);
  183|  1.62k|        memcpy(dst, &code, 2);
  184|       |        /* It is invalid to pass nullptr to memcpy, even though length is 0 */
  185|  1.62k|        if (message) {
  ------------------
  |  Branch (185:13): [True: 705, False: 919]
  ------------------
  186|    705|            memcpy(dst + 2, message, length);
  187|    705|        }
  188|  1.62k|        return length + 2;
  189|  1.62k|    }
  190|  5.86k|    return 0;
  191|  7.49k|}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi0EEEvPcmj:
  285|  11.8k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  78.2k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 66.4k, False: 11.8k]
  ------------------
  287|  66.4k|            uint64_t loaded;
  288|  66.4k|            memcpy(&loaded, src, 8);
  289|  66.4k|            loaded ^= mask;
  290|  66.4k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  66.4k|            src += 8;
  292|  66.4k|        }
  293|  11.8k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE10rotateMaskEjPc:
  322|  12.9k|    static inline void rotateMask(unsigned int offset, char *mask) {
  323|  12.9k|        char originalMask[4] = {mask[0], mask[1], mask[2], mask[3]};
  324|  12.9k|        mask[(0 + offset) % 4] = originalMask[0];
  325|  12.9k|        mask[(1 + offset) % 4] = originalMask[1];
  326|  12.9k|        mask[(2 + offset) % 4] = originalMask[2];
  327|  12.9k|        mask[(3 + offset) % 4] = originalMask[3];
  328|  12.9k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj8EtEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  6.29k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  6.29k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 4.96k, False: 1.33k]
  ------------------
  342|  4.96k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 194, False: 4.77k]
  |  Branch (342:48): [True: 633, False: 4.13k]
  |  Branch (342:74): [True: 70, False: 563]
  ------------------
  343|    264|                Impl::forceClose(wState, user);
  344|    264|                return true;
  345|    264|            }
  346|  4.70k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  4.70k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 195, False: 1.13k]
  ------------------
  348|    195|            Impl::forceClose(wState, user);
  349|    195|            return true;
  350|    195|        }
  351|  5.83k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  5.83k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 207, False: 5.62k]
  ------------------
  354|    207|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    207|            return true;
  356|    207|        }
  357|       |
  358|  5.62k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 3.41k, False: 2.21k]
  ------------------
  359|  3.41k|            bool fin = isFin(src);
  360|  3.41k|            if (isServer) {
  ------------------
  |  Branch (360:17): [Folded - Ignored]
  ------------------
  361|       |                /* This guy can never be assumed to be perfectly aligned since we can get multiple messages in one read */
  362|  3.41k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  3.41k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 1.55k, False: 1.85k]
  ------------------
  364|  1.55k|                    return true;
  365|  1.55k|                }
  366|  3.41k|            } 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.85k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 814, False: 1.04k]
  ------------------
  373|    814|                wState->state.opStack--;
  374|    814|            }
  375|       |
  376|  1.85k|            src += payLength + MESSAGE_HEADER;
  377|  1.85k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  1.85k|            wState->state.spillLength = 0;
  379|  1.85k|            return false;
  380|  3.41k|        } else {
  381|  2.21k|            wState->state.spillLength = 0;
  382|  2.21k|            wState->state.wantsHead = false;
  383|  2.21k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  2.21k|            bool fin = isFin(src);
  385|  2.21k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  2.21k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  2.21k|                uint64_t mask;
  388|  2.21k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  2.21k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  2.21k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  2.21k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  2.21k|            }
  393|  2.21k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  2.21k|            return true;
  395|  2.21k|        }
  396|  5.62k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi8EEEvPcj:
  308|  3.41k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  3.41k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  3.41k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  3.41k|            uint64_t maskInt;
  312|  3.41k|            memcpy(&maskInt, mask, 8);
  313|  3.41k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  3.41k|        } else {
  315|  3.41k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  3.41k|            uint32_t maskInt;
  317|  3.41k|            memcpy(&maskInt, mask, 4);
  318|  3.41k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  3.41k|        }
  320|  3.41k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi8EEEvPcmj:
  285|  3.41k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  21.1k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 17.6k, False: 3.41k]
  ------------------
  287|  17.6k|            uint64_t loaded;
  288|  17.6k|            memcpy(&loaded, src, 8);
  289|  17.6k|            loaded ^= mask;
  290|  17.6k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  17.6k|            src += 8;
  292|  17.6k|        }
  293|  3.41k|    }
_ZN3uWS8protocol8bit_castItEET_Pc:
   87|  6.29k|T bit_cast(char *c) {
   88|  6.29k|    T val;
   89|  6.29k|    memcpy(&val, c, sizeof(T));
   90|  6.29k|    return val;
   91|  6.29k|}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE14consumeMessageILj14EmEEbT0_RPcRjPNS_14WebSocketStateILb1EEEPv:
  340|  6.03k|    static inline bool consumeMessage(T payLength, char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  341|  6.03k|        if (getOpCode(src)) {
  ------------------
  |  Branch (341:13): [True: 4.99k, False: 1.03k]
  ------------------
  342|  4.99k|            if (wState->state.opStack == 1 || (!wState->state.lastFin && getOpCode(src) < 2)) {
  ------------------
  |  Branch (342:17): [True: 240, False: 4.75k]
  |  Branch (342:48): [True: 981, False: 3.77k]
  |  Branch (342:74): [True: 195, False: 786]
  ------------------
  343|    435|                Impl::forceClose(wState, user);
  344|    435|                return true;
  345|    435|            }
  346|  4.55k|            wState->state.opCode[++wState->state.opStack] = (OpCode) getOpCode(src);
  347|  4.55k|        } else if (wState->state.opStack == -1) {
  ------------------
  |  Branch (347:20): [True: 214, False: 824]
  ------------------
  348|    214|            Impl::forceClose(wState, user);
  349|    214|            return true;
  350|    214|        }
  351|  5.38k|        wState->state.lastFin = isFin(src);
  352|       |
  353|  5.38k|        if (Impl::refusePayloadLength(payLength, wState, user)) {
  ------------------
  |  Branch (353:13): [True: 461, False: 4.92k]
  ------------------
  354|    461|            Impl::forceClose(wState, user, ERR_TOO_BIG_MESSAGE);
  355|    461|            return true;
  356|    461|        }
  357|       |
  358|  4.92k|        if (payLength + MESSAGE_HEADER <= length) {
  ------------------
  |  Branch (358:13): [True: 2.98k, False: 1.93k]
  ------------------
  359|  2.98k|            bool fin = isFin(src);
  360|  2.98k|            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.98k|                unmaskImpreciseCopyMask<MESSAGE_HEADER>(src + MESSAGE_HEADER, (unsigned int) payLength);
  363|  2.98k|                if (Impl::handleFragment(src, payLength, 0, wState->state.opCode[wState->state.opStack], fin, wState, user)) {
  ------------------
  |  Branch (363:21): [True: 587, False: 2.39k]
  ------------------
  364|    587|                    return true;
  365|    587|                }
  366|  2.98k|            } else {
  367|      0|                if (Impl::handleFragment(src + MESSAGE_HEADER, payLength, 0, wState->state.opCode[wState->state.opStack], isFin(src), wState, user)) {
  ------------------
  |  Branch (367:21): [True: 0, False: 0]
  ------------------
  368|      0|                    return true;
  369|      0|                }
  370|      0|            }
  371|       |
  372|  2.39k|            if (fin) {
  ------------------
  |  Branch (372:17): [True: 1.51k, False: 886]
  ------------------
  373|  1.51k|                wState->state.opStack--;
  374|  1.51k|            }
  375|       |
  376|  2.39k|            src += payLength + MESSAGE_HEADER;
  377|  2.39k|            length -= (unsigned int) (payLength + MESSAGE_HEADER);
  378|  2.39k|            wState->state.spillLength = 0;
  379|  2.39k|            return false;
  380|  2.98k|        } else {
  381|  1.93k|            wState->state.spillLength = 0;
  382|  1.93k|            wState->state.wantsHead = false;
  383|  1.93k|            wState->remainingBytes = (unsigned int) (payLength - length + MESSAGE_HEADER);
  384|  1.93k|            bool fin = isFin(src);
  385|  1.93k|            if constexpr (isServer) {
  ------------------
  |  Branch (385:27): [Folded - Ignored]
  ------------------
  386|  1.93k|                memcpy(wState->mask, src + MESSAGE_HEADER - 4, 4);
  387|  1.93k|                uint64_t mask;
  388|  1.93k|                memcpy(&mask, src + MESSAGE_HEADER - 4, 4);
  389|  1.93k|                memcpy(((char *)&mask) + 4, src + MESSAGE_HEADER - 4, 4);
  390|  1.93k|                unmaskImprecise8<0>(src + MESSAGE_HEADER, mask, length);
  391|  1.93k|                rotateMask(4 - (length - MESSAGE_HEADER) % 4, wState->mask);
  392|  1.93k|            }
  393|  1.93k|            Impl::handleFragment(src + MESSAGE_HEADER, length - MESSAGE_HEADER, wState->remainingBytes, wState->state.opCode[wState->state.opStack], fin, wState, user);
  394|  1.93k|            return true;
  395|  1.93k|        }
  396|  4.92k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE23unmaskImpreciseCopyMaskILi14EEEvPcj:
  308|  2.98k|    static inline void unmaskImpreciseCopyMask(char *src, unsigned int length) {
  309|  2.98k|        if constexpr (HEADER_SIZE != 6) {
  ------------------
  |  Branch (309:23): [Folded - Ignored]
  ------------------
  310|  2.98k|            char mask[8] = {src[-4], src[-3], src[-2], src[-1], src[-4], src[-3], src[-2], src[-1]};
  311|  2.98k|            uint64_t maskInt;
  312|  2.98k|            memcpy(&maskInt, mask, 8);
  313|  2.98k|            unmaskImprecise8<HEADER_SIZE>(src, maskInt, length);
  314|  2.98k|        } else {
  315|  2.98k|            char mask[4] = {src[-4], src[-3], src[-2], src[-1]};
  316|  2.98k|            uint32_t maskInt;
  317|  2.98k|            memcpy(&maskInt, mask, 4);
  318|  2.98k|            unmaskImprecise4<HEADER_SIZE>(src, maskInt, length);
  319|  2.98k|        }
  320|  2.98k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE16unmaskImprecise8ILi14EEEvPcmj:
  285|  2.98k|    static inline void unmaskImprecise8(char *src, uint64_t mask, unsigned int length) {
  286|  12.7k|        for (unsigned int n = (length >> 3) + 1; n; n--) {
  ------------------
  |  Branch (286:50): [True: 9.72k, False: 2.98k]
  ------------------
  287|  9.72k|            uint64_t loaded;
  288|  9.72k|            memcpy(&loaded, src, 8);
  289|  9.72k|            loaded ^= mask;
  290|  9.72k|            memcpy(src - DESTINATION, &loaded, 8);
  291|  9.72k|            src += 8;
  292|  9.72k|        }
  293|  2.98k|    }
_ZN3uWS8protocol8bit_castImEET_Pc:
   87|  6.03k|T bit_cast(char *c) {
   88|  6.03k|    T val;
   89|  6.03k|    memcpy(&val, c, sizeof(T));
   90|  6.03k|    return val;
   91|  6.03k|}
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE19consumeContinuationERPcRjPNS_14WebSocketStateILb1EEEPv:
  405|  9.57k|    static inline bool consumeContinuation(char *&src, unsigned int &length, WebSocketState<isServer> *wState, void *user) {
  406|  9.57k|        if (wState->remainingBytes <= length) {
  ------------------
  |  Branch (406:13): [True: 7.72k, False: 1.84k]
  ------------------
  407|  7.72k|            if (isServer) {
  ------------------
  |  Branch (407:17): [Folded - Ignored]
  ------------------
  408|  7.72k|                unsigned int n = wState->remainingBytes >> 2;
  409|  7.72k|                unmaskInplace(src, src + n * 4, wState->mask);
  410|  20.3k|                for (unsigned int i = 0, s = wState->remainingBytes % 4; i < s; i++) {
  ------------------
  |  Branch (410:74): [True: 12.6k, False: 7.72k]
  ------------------
  411|  12.6k|                    src[n * 4 + i] ^= wState->mask[i];
  412|  12.6k|                }
  413|  7.72k|            }
  414|       |
  415|  7.72k|            if (Impl::handleFragment(src, wState->remainingBytes, 0, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (415:17): [True: 3.19k, False: 4.53k]
  ------------------
  416|  3.19k|                return false;
  417|  3.19k|            }
  418|       |
  419|  4.53k|            if (wState->state.lastFin) {
  ------------------
  |  Branch (419:17): [True: 3.86k, False: 670]
  ------------------
  420|  3.86k|                wState->state.opStack--;
  421|  3.86k|            }
  422|       |
  423|  4.53k|            src += wState->remainingBytes;
  424|  4.53k|            length -= wState->remainingBytes;
  425|  4.53k|            wState->state.wantsHead = true;
  426|  4.53k|            return true;
  427|  7.72k|        } else {
  428|  1.84k|            if (isServer) {
  ------------------
  |  Branch (428:17): [Folded - Ignored]
  ------------------
  429|       |                /* No need to unmask if mask is 0 */
  430|  1.84k|                uint32_t nullmask = 0;
  431|  1.84k|                if (memcmp(wState->mask, &nullmask, sizeof(uint32_t))) {
  ------------------
  |  Branch (431:21): [True: 1.62k, False: 220]
  ------------------
  432|  1.62k|                    if /*constexpr*/ (LIBUS_RECV_BUFFER_LENGTH == length) {
  ------------------
  |  |   22|  1.62k|#define LIBUS_RECV_BUFFER_LENGTH 524288
  ------------------
  |  Branch (432:39): [True: 0, False: 1.62k]
  ------------------
  433|      0|                        unmaskAll(src, wState->mask);
  434|  1.62k|                    } else {
  435|       |                        // Slow path
  436|  1.62k|                        unmaskInplace(src, src + ((length >> 2) + 1) * 4, wState->mask);
  437|  1.62k|                    }
  438|  1.62k|                }
  439|  1.84k|            }
  440|       |
  441|  1.84k|            wState->remainingBytes -= length;
  442|  1.84k|            if (Impl::handleFragment(src, length, wState->remainingBytes, wState->state.opCode[wState->state.opStack], wState->state.lastFin, wState, user)) {
  ------------------
  |  Branch (442:17): [True: 202, False: 1.64k]
  ------------------
  443|    202|                return false;
  444|    202|            }
  445|       |
  446|  1.64k|            if (isServer && length % 4) {
  ------------------
  |  Branch (446:17): [Folded - Ignored]
  |  Branch (446:29): [True: 1.05k, False: 591]
  ------------------
  447|  1.05k|                rotateMask(4 - (length % 4), wState->mask);
  448|  1.05k|            }
  449|  1.64k|            return false;
  450|  1.84k|        }
  451|  9.57k|    }
EpollEchoServer.cpp:_ZN3uWS17WebSocketProtocolILb1ENS_16WebSocketContextILb0ELb1EZ4testvE13PerSocketDataEEE13unmaskInplaceEPcS5_S5_:
  330|  9.35k|    static inline void unmaskInplace(char *data, char *stop, char *mask) {
  331|  63.8k|        while (data < stop) {
  ------------------
  |  Branch (331:16): [True: 54.5k, False: 9.35k]
  ------------------
  332|  54.5k|            *(data++) ^= mask[0];
  333|  54.5k|            *(data++) ^= mask[1];
  334|  54.5k|            *(data++) ^= mask[2];
  335|  54.5k|            *(data++) ^= mask[3];
  336|  54.5k|        }
  337|  9.35k|    }
_ZN3uWS14WebSocketStateILb1EE5StateC2Ev:
   70|   108k|        State() {
   71|   108k|            wantsHead = true;
   72|   108k|            spillLength = 0;
   73|   108k|            opStack = -1;
   74|   108k|            lastFin = true;
   75|   108k|        }

apple_no_sigpipe:
  259|  1.51M|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.51M|    return fd;
  267|  1.51M|}
bsd_set_nonblocking:
  269|  1.51M|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.51M|    fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
  274|  1.51M|#endif
  275|  1.51M|    return fd;
  276|  1.51M|}
bsd_socket_nodelay:
  278|  1.50M|void bsd_socket_nodelay(LIBUS_SOCKET_DESCRIPTOR fd, int enabled) {
  279|  1.50M|    setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *) &enabled, sizeof(enabled));
  280|  1.50M|}
bsd_create_socket:
  290|  5.51k|LIBUS_SOCKET_DESCRIPTOR bsd_create_socket(int domain, int type, int protocol) {
  291|       |    // returns INVALID_SOCKET on error
  292|  5.51k|    int flags = 0;
  293|  5.51k|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  294|  5.51k|    flags = SOCK_CLOEXEC | SOCK_NONBLOCK;
  295|  5.51k|#endif
  296|       |
  297|  5.51k|    LIBUS_SOCKET_DESCRIPTOR created_fd = socket(domain, type | flags, protocol);
  ------------------
  |  |   38|  5.51k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  298|       |
  299|  5.51k|    return bsd_set_nonblocking(apple_no_sigpipe(created_fd));
  300|  5.51k|}
bsd_close_socket:
  302|  1.51M|void bsd_close_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  303|       |#ifdef _WIN32
  304|       |    closesocket(fd);
  305|       |#else
  306|  1.51M|    close(fd);
  307|  1.51M|#endif
  308|  1.51M|}
bsd_shutdown_socket:
  310|   234k|void bsd_shutdown_socket(LIBUS_SOCKET_DESCRIPTOR fd) {
  311|       |#ifdef _WIN32
  312|       |    shutdown(fd, SD_SEND);
  313|       |#else
  314|   234k|    shutdown(fd, SHUT_WR);
  315|   234k|#endif
  316|   234k|}
internal_finalize_bsd_addr:
  326|  1.50M|void internal_finalize_bsd_addr(struct bsd_addr_t *addr) {
  327|       |    // parse, so to speak, the address
  328|  1.50M|    if (addr->mem.ss_family == AF_INET6) {
  ------------------
  |  Branch (328:9): [True: 368k, False: 1.13M]
  ------------------
  329|   368k|        addr->ip = (char *) &((struct sockaddr_in6 *) addr)->sin6_addr;
  330|   368k|        addr->ip_length = sizeof(struct in6_addr);
  331|   368k|        addr->port = ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
  332|  1.13M|    } else if (addr->mem.ss_family == AF_INET) {
  ------------------
  |  Branch (332:16): [True: 1.13M, False: 0]
  ------------------
  333|  1.13M|        addr->ip = (char *) &((struct sockaddr_in *) addr)->sin_addr;
  334|  1.13M|        addr->ip_length = sizeof(struct in_addr);
  335|  1.13M|        addr->port = ntohs(((struct sockaddr_in *) addr)->sin_port);
  336|  1.13M|    } else {
  337|      0|        addr->ip_length = 0;
  338|      0|        addr->port = -1;
  339|      0|    }
  340|  1.50M|}
bsd_addr_get_ip:
  360|  1.50M|char *bsd_addr_get_ip(struct bsd_addr_t *addr) {
  361|  1.50M|    return addr->ip;
  362|  1.50M|}
bsd_addr_get_ip_length:
  364|  1.50M|int bsd_addr_get_ip_length(struct bsd_addr_t *addr) {
  365|  1.50M|    return addr->ip_length;
  366|  1.50M|}
bsd_accept_socket:
  373|  3.27M|LIBUS_SOCKET_DESCRIPTOR bsd_accept_socket(LIBUS_SOCKET_DESCRIPTOR fd, struct bsd_addr_t *addr) {
  374|  3.27M|    LIBUS_SOCKET_DESCRIPTOR accepted_fd;
  ------------------
  |  |   38|  3.27M|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  375|  3.27M|    addr->len = sizeof(addr->mem);
  376|       |
  377|  3.27M|#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
  378|       |    // Linux, FreeBSD
  379|  3.27M|    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.27M|    if (accepted_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  3.27M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (387:9): [True: 1.76M, False: 1.50M]
  ------------------
  388|  1.76M|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  1.76M|#define LIBUS_SOCKET_ERROR -1
  ------------------
  389|  1.76M|    }
  390|       |
  391|  1.50M|    internal_finalize_bsd_addr(addr);
  392|       |
  393|  1.50M|    return bsd_set_nonblocking(apple_no_sigpipe(accepted_fd));
  394|  3.27M|}
bsd_recv:
  396|   541k|int bsd_recv(LIBUS_SOCKET_DESCRIPTOR fd, void *buf, int length, int flags) {
  397|   541k|    return recv(fd, buf, length, flags);
  398|   541k|}
bsd_send:
  426|   470k|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|   470k|#ifdef MSG_MORE
  435|       |
  436|       |    // for Linux we do not want signals
  437|   470k|    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|   470k|}
bsd_would_block:
  448|  4.39k|int bsd_would_block() {
  449|       |#ifdef _WIN32
  450|       |    return WSAGetLastError() == WSAEWOULDBLOCK;
  451|       |#else
  452|  4.39k|    return errno == EWOULDBLOCK;// || errno == EAGAIN;
  453|  4.39k|#endif
  454|  4.39k|}
bsd_create_listen_socket:
  458|  5.52k|LIBUS_SOCKET_DESCRIPTOR bsd_create_listen_socket(const char *host, int port, int options) {
  459|  5.52k|    struct addrinfo hints, *result;
  460|  5.52k|    memset(&hints, 0, sizeof(struct addrinfo));
  461|       |
  462|  5.52k|    hints.ai_flags = AI_PASSIVE;
  463|  5.52k|    hints.ai_family = AF_UNSPEC;
  464|  5.52k|    hints.ai_socktype = SOCK_STREAM;
  465|       |
  466|  5.52k|    char port_string[16];
  467|  5.52k|    snprintf(port_string, 16, "%d", port);
  468|       |
  469|  5.52k|    if (getaddrinfo(host, port_string, &hints, &result)) {
  ------------------
  |  Branch (469:9): [True: 6, False: 5.51k]
  ------------------
  470|      6|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      6|#define LIBUS_SOCKET_ERROR -1
  ------------------
  471|      6|    }
  472|       |
  473|  5.51k|    LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   38|  5.51k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
                  LIBUS_SOCKET_DESCRIPTOR listenFd = LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|  5.51k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  474|  5.51k|    struct addrinfo *listenAddr;
  475|  11.0k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  5.51k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (475:39): [True: 5.51k, False: 5.51k]
  |  Branch (475:44): [True: 5.51k, False: 0]
  ------------------
  476|  5.51k|        if (a->ai_family == AF_INET6) {
  ------------------
  |  Branch (476:13): [True: 2.83k, False: 2.67k]
  ------------------
  477|  2.83k|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  478|  2.83k|            listenAddr = a;
  479|  2.83k|        }
  480|  5.51k|    }
  481|       |
  482|  8.19k|    for (struct addrinfo *a = result; a && listenFd == LIBUS_SOCKET_ERROR; a = a->ai_next) {
  ------------------
  |  |   44|  5.51k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (482:39): [True: 5.51k, False: 2.67k]
  |  Branch (482:44): [True: 2.67k, False: 2.83k]
  ------------------
  483|  2.67k|        if (a->ai_family == AF_INET) {
  ------------------
  |  Branch (483:13): [True: 2.67k, False: 1]
  ------------------
  484|  2.67k|            listenFd = bsd_create_socket(a->ai_family, a->ai_socktype, a->ai_protocol);
  485|  2.67k|            listenAddr = a;
  486|  2.67k|        }
  487|  2.67k|    }
  488|       |
  489|  5.51k|    if (listenFd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.51k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (489:9): [True: 1, False: 5.51k]
  ------------------
  490|      1|        freeaddrinfo(result);
  491|      1|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|      1|#define LIBUS_SOCKET_ERROR -1
  ------------------
  492|      1|    }
  493|       |
  494|  5.51k|    if (port != 0) {
  ------------------
  |  Branch (494:9): [True: 5.51k, 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.51k|    #if /*defined(__linux) &&*/ defined(SO_REUSEPORT)
  506|  5.51k|        if (!(options & LIBUS_LISTEN_EXCLUSIVE_PORT)) {
  ------------------
  |  Branch (506:13): [True: 5.51k, False: 0]
  ------------------
  507|  5.51k|            int optval = 1;
  508|  5.51k|            setsockopt(listenFd, SOL_SOCKET, SO_REUSEPORT, (void *) &optval, sizeof(optval));
  509|  5.51k|        }
  510|  5.51k|    #endif
  511|  5.51k|        int enabled = 1;
  512|  5.51k|        setsockopt(listenFd, SOL_SOCKET, SO_REUSEADDR, (void *) &enabled, sizeof(enabled));
  513|  5.51k|#endif
  514|       |
  515|  5.51k|    }
  516|       |    
  517|  5.51k|#ifdef IPV6_V6ONLY
  518|  5.51k|    int disabled = 0;
  519|  5.51k|    setsockopt(listenFd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &disabled, sizeof(disabled));
  520|  5.51k|#endif
  521|       |
  522|  5.51k|    if (bind(listenFd, listenAddr->ai_addr, (socklen_t) listenAddr->ai_addrlen) || listen(listenFd, 512)) {
  ------------------
  |  Branch (522:9): [True: 0, False: 5.51k]
  |  Branch (522:84): [True: 10, False: 5.50k]
  ------------------
  523|     10|        bsd_close_socket(listenFd);
  524|     10|        freeaddrinfo(result);
  525|     10|        return LIBUS_SOCKET_ERROR;
  ------------------
  |  |   44|     10|#define LIBUS_SOCKET_ERROR -1
  ------------------
  526|     10|    }
  527|       |
  528|  5.50k|    freeaddrinfo(result);
  529|  5.50k|    return listenFd;
  530|  5.51k|}

default_is_low_prio_handler:
   25|   541k|int default_is_low_prio_handler(struct us_socket_t *s) {
   26|   541k|    return 0;
   27|   541k|}
us_listen_socket_close:
   35|  5.50k|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.50k|    if (!us_socket_is_closed(0, &ls->s)) {
  ------------------
  |  Branch (37:9): [True: 5.50k, False: 0]
  ------------------
   38|  5.50k|        us_internal_socket_context_unlink_listen_socket(ls->s.context, ls);
   39|  5.50k|        us_poll_stop((struct us_poll_t *) &ls->s, ls->s.context->loop);
   40|  5.50k|        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.50k|        ls->s.next = ls->s.context->loop->data.closed_head;
   44|  5.50k|        ls->s.context->loop->data.closed_head = &ls->s;
   45|       |
   46|       |        /* Any socket with prev = context is marked as closed */
   47|  5.50k|        ls->s.prev = (struct us_socket_t *) ls->s.context;
   48|  5.50k|    }
   49|       |
   50|       |    /* We cannot immediately free a listen socket as we can be inside an accept loop */
   51|  5.50k|}
us_internal_socket_context_unlink_listen_socket:
   71|  5.50k|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.50k|    if (ls == (struct us_listen_socket_t *) context->iterator) {
  ------------------
  |  Branch (73:9): [True: 0, False: 5.50k]
  ------------------
   74|      0|        context->iterator = ls->s.next;
   75|      0|    }
   76|       |
   77|  5.50k|    if (ls->s.prev == ls->s.next) {
  ------------------
  |  Branch (77:9): [True: 5.50k, False: 0]
  ------------------
   78|  5.50k|        context->head_listen_sockets = 0;
   79|  5.50k|    } 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.50k|}
us_internal_socket_context_unlink_socket:
   91|  1.61M|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.61M|    if (s == context->iterator) {
  ------------------
  |  Branch (93:9): [True: 27.5k, False: 1.58M]
  ------------------
   94|  27.5k|        context->iterator = s->next;
   95|  27.5k|    }
   96|       |
   97|  1.61M|    if (s->prev == s->next) {
  ------------------
  |  Branch (97:9): [True: 304k, False: 1.31M]
  ------------------
   98|   304k|        context->head_sockets = 0;
   99|  1.31M|    } else {
  100|  1.31M|        if (s->prev) {
  ------------------
  |  Branch (100:13): [True: 630k, False: 680k]
  ------------------
  101|   630k|            s->prev->next = s->next;
  102|   680k|        } else {
  103|   680k|            context->head_sockets = s->next;
  104|   680k|        }
  105|  1.31M|        if (s->next) {
  ------------------
  |  Branch (105:13): [True: 1.21M, False: 101k]
  ------------------
  106|  1.21M|            s->next->prev = s->prev;
  107|  1.21M|        }
  108|  1.31M|    }
  109|  1.61M|}
us_internal_socket_context_link_listen_socket:
  112|  5.50k|void us_internal_socket_context_link_listen_socket(struct us_socket_context_t *context, struct us_listen_socket_t *ls) {
  113|  5.50k|    ls->s.context = context;
  114|  5.50k|    ls->s.next = (struct us_socket_t *) context->head_listen_sockets;
  115|  5.50k|    ls->s.prev = 0;
  116|  5.50k|    if (context->head_listen_sockets) {
  ------------------
  |  Branch (116:9): [True: 0, False: 5.50k]
  ------------------
  117|      0|        context->head_listen_sockets->s.prev = &ls->s;
  118|      0|    }
  119|  5.50k|    context->head_listen_sockets = ls;
  120|  5.50k|}
us_internal_socket_context_link_socket:
  123|  1.61M|void us_internal_socket_context_link_socket(struct us_socket_context_t *context, struct us_socket_t *s) {
  124|  1.61M|    s->context = context;
  125|  1.61M|    s->next = context->head_sockets;
  126|  1.61M|    s->prev = 0;
  127|  1.61M|    if (context->head_sockets) {
  ------------------
  |  Branch (127:9): [True: 1.31M, False: 304k]
  ------------------
  128|  1.31M|        context->head_sockets->prev = s;
  129|  1.31M|    }
  130|  1.61M|    context->head_sockets = s;
  131|  1.61M|}
us_socket_context_loop:
  133|  4.87M|struct us_loop_t *us_socket_context_loop(int ssl, struct us_socket_context_t *context) {
  134|  4.87M|    return context->loop;
  135|  4.87M|}
us_create_socket_context:
  204|  16.5k|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|  16.5k|    struct us_socket_context_t *context = malloc(sizeof(struct us_socket_context_t) + context_ext_size);
  216|  16.5k|    context->loop = loop;
  217|  16.5k|    context->head_sockets = 0;
  218|  16.5k|    context->head_listen_sockets = 0;
  219|  16.5k|    context->iterator = 0;
  220|  16.5k|    context->next = 0;
  221|  16.5k|    context->is_low_prio = default_is_low_prio_handler;
  222|       |
  223|       |    /* Begin at 0 */
  224|  16.5k|    context->timestamp = 0;
  225|  16.5k|    context->long_timestamp = 0;
  226|  16.5k|    context->global_tick = 0;
  227|       |
  228|  16.5k|    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|  16.5k|    return context;
  232|  16.5k|}
us_socket_context_free:
  234|  16.5k|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|  16.5k|    us_internal_loop_unlink(context->loop, context);
  247|  16.5k|    free(context);
  248|  16.5k|}
us_socket_context_listen:
  250|  5.52k|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.52k|    LIBUS_SOCKET_DESCRIPTOR listen_socket_fd = bsd_create_listen_socket(host, port, options);
  ------------------
  |  |   38|  5.52k|#define LIBUS_SOCKET_DESCRIPTOR int
  ------------------
  258|       |
  259|  5.52k|    if (listen_socket_fd == LIBUS_SOCKET_ERROR) {
  ------------------
  |  |   44|  5.52k|#define LIBUS_SOCKET_ERROR -1
  ------------------
  |  Branch (259:9): [True: 17, False: 5.50k]
  ------------------
  260|     17|        return 0;
  261|     17|    }
  262|       |
  263|  5.50k|    struct us_poll_t *p = us_create_poll(context->loop, 0, sizeof(struct us_listen_socket_t));
  264|  5.50k|    us_poll_init(p, listen_socket_fd, POLL_TYPE_SEMI_SOCKET);
  265|  5.50k|    us_poll_start(p, context->loop, LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|  5.50k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  266|       |
  267|  5.50k|    struct us_listen_socket_t *ls = (struct us_listen_socket_t *) p;
  268|       |
  269|  5.50k|    ls->s.context = context;
  270|  5.50k|    ls->s.timeout = 255;
  271|  5.50k|    ls->s.long_timeout = 255;
  272|  5.50k|    ls->s.low_prio_state = 0;
  273|  5.50k|    ls->s.next = 0;
  274|  5.50k|    us_internal_socket_context_link_listen_socket(context, ls);
  275|       |
  276|  5.50k|    ls->socket_ext_size = socket_ext_size;
  277|       |
  278|  5.50k|    return ls;
  279|  5.52k|}
us_create_child_socket_context:
  370|  11.0k|struct us_socket_context_t *us_create_child_socket_context(int ssl, struct us_socket_context_t *context, int context_ext_size) {
  371|       |#ifndef LIBUS_NO_SSL
  372|       |    if (ssl) {
  373|       |        return (struct us_socket_context_t *) us_internal_create_child_ssl_socket_context((struct us_internal_ssl_socket_context_t *) context, context_ext_size);
  374|       |    }
  375|       |#endif
  376|       |
  377|       |    /* For TCP we simply create a new context as nothing is shared */
  378|  11.0k|    struct us_socket_context_options_t options = {0};
  379|  11.0k|    return us_create_socket_context(ssl, context->loop, context_ext_size, options);
  380|  11.0k|}
us_socket_context_adopt_socket:
  383|   108k|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|   108k|    if (us_socket_is_closed(ssl, s)) {
  ------------------
  |  Branch (391:9): [True: 0, False: 108k]
  ------------------
  392|      0|        return s;
  393|      0|    }
  394|       |
  395|   108k|    if (s->low_prio_state != 1) {
  ------------------
  |  Branch (395:9): [True: 108k, False: 0]
  ------------------
  396|       |        /* This properly updates the iterator if in on_timeout */
  397|   108k|        us_internal_socket_context_unlink_socket(s->context, s);
  398|   108k|    }
  399|       |
  400|   108k|    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|   108k|    new_s->timeout = 255;
  402|   108k|    new_s->long_timeout = 255;
  403|       |
  404|   108k|    if (new_s->low_prio_state == 1) {
  ------------------
  |  Branch (404:9): [True: 0, False: 108k]
  ------------------
  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|   108k|    } else {
  411|   108k|        us_internal_socket_context_link_socket(context, new_s);
  412|   108k|    }
  413|       |
  414|   108k|    return new_s;
  415|   108k|}
us_socket_context_on_open:
  417|  5.52k|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|  5.52k|    context->on_open = on_open;
  426|  5.52k|}
us_socket_context_on_close:
  428|  16.5k|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|  16.5k|    context->on_close = on_close;
  437|  16.5k|}
us_socket_context_on_data:
  439|  16.5k|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|  16.5k|    context->on_data = on_data;
  448|  16.5k|}
us_socket_context_on_writable:
  450|  16.5k|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|  16.5k|    context->on_writable = on_writable;
  459|  16.5k|}
us_socket_context_on_long_timeout:
  461|  11.0k|void us_socket_context_on_long_timeout(int ssl, struct us_socket_context_t *context, struct us_socket_t *(*on_long_timeout)(struct us_socket_t *)) {
  462|       |#ifndef LIBUS_NO_SSL
  463|       |    if (ssl) {
  464|       |        us_internal_ssl_socket_context_on_long_timeout((struct us_internal_ssl_socket_context_t *) context, (struct us_internal_ssl_socket_t * (*)(struct us_internal_ssl_socket_t *)) on_long_timeout);
  465|       |        return;
  466|       |    }
  467|       |#endif
  468|       |
  469|  11.0k|    context->on_socket_long_timeout = on_long_timeout;
  470|  11.0k|}
us_socket_context_on_timeout:
  472|  16.5k|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|  16.5k|    context->on_socket_timeout = on_timeout;
  481|  16.5k|}
us_socket_context_on_end:
  483|  16.5k|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|  16.5k|    context->on_end = on_end;
  492|  16.5k|}
us_socket_context_ext:
  505|  4.30M|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.30M|    return context + 1;
  513|  4.30M|}

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

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

us_socket_context:
   52|  10.4M|struct us_socket_context_t *us_socket_context(int ssl, struct us_socket_t *s) {
   53|  10.4M|    return s->context;
   54|  10.4M|}
us_socket_timeout:
   56|  1.94M|void us_socket_timeout(int ssl, struct us_socket_t *s, unsigned int seconds) {
   57|  1.94M|    if (seconds) {
  ------------------
  |  Branch (57:9): [True: 1.82M, False: 113k]
  ------------------
   58|  1.82M|        s->timeout = ((unsigned int)s->context->timestamp + ((seconds + 3) >> 2)) % 240;
   59|  1.82M|    } else {
   60|   113k|        s->timeout = 255;
   61|   113k|    }
   62|  1.94M|}
us_socket_long_timeout:
   64|   108k|void us_socket_long_timeout(int ssl, struct us_socket_t *s, unsigned int minutes) {
   65|   108k|    if (minutes) {
  ------------------
  |  Branch (65:9): [True: 0, False: 108k]
  ------------------
   66|      0|        s->long_timeout = ((unsigned int)s->context->long_timestamp + minutes) % 240;
   67|   108k|    } else {
   68|   108k|        s->long_timeout = 255;
   69|   108k|    }
   70|   108k|}
us_socket_is_closed:
   78|  7.14M|int us_socket_is_closed(int ssl, struct us_socket_t *s) {
   79|  7.14M|    return s->prev == (struct us_socket_t *) s->context;
   80|  7.14M|}
us_socket_close:
  107|  1.50M|struct us_socket_t *us_socket_close(int ssl, struct us_socket_t *s, int code, void *reason) {
  108|  1.50M|    if (!us_socket_is_closed(0, s)) {
  ------------------
  |  Branch (108:9): [True: 1.50M, False: 0]
  ------------------
  109|  1.50M|        if (s->low_prio_state == 1) {
  ------------------
  |  Branch (109:13): [True: 0, False: 1.50M]
  ------------------
  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.50M|        } else {
  120|  1.50M|            us_internal_socket_context_unlink_socket(s->context, s);
  121|  1.50M|        }
  122|  1.50M|        us_poll_stop((struct us_poll_t *) s, s->context->loop);
  123|  1.50M|        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.50M|        s->next = s->context->loop->data.closed_head;
  127|  1.50M|        s->context->loop->data.closed_head = s;
  128|       |
  129|       |        /* Any socket with prev = context is marked as closed */
  130|  1.50M|        s->prev = (struct us_socket_t *) s->context;
  131|       |
  132|  1.50M|        return s->context->on_close(s, code, reason);
  133|  1.50M|    }
  134|      0|    return s;
  135|  1.50M|}
us_socket_write:
  164|   470k|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|   470k|    if (us_socket_is_closed(ssl, s) || us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (171:9): [True: 0, False: 470k]
  |  Branch (171:40): [True: 0, False: 470k]
  ------------------
  172|      0|        return 0;
  173|      0|    }
  174|       |
  175|   470k|    int written = bsd_send(us_poll_fd(&s->p), data, length, msg_more);
  176|   470k|    if (written != length) {
  ------------------
  |  Branch (176:9): [True: 447k, False: 22.5k]
  ------------------
  177|   447k|        s->context->loop->data.last_write_failed = 1;
  178|   447k|        us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   27|   447k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
                      us_poll_change(&s->p, s->context->loop, LIBUS_SOCKET_READABLE | LIBUS_SOCKET_WRITABLE);
  ------------------
  |  |   28|   447k|#define LIBUS_SOCKET_WRITABLE EPOLLOUT
  ------------------
  179|   447k|    }
  180|       |
  181|   470k|    return written < 0 ? 0 : written;
  ------------------
  |  Branch (181:12): [True: 7.92k, False: 462k]
  ------------------
  182|   470k|}
us_socket_ext:
  184|  8.56M|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|  8.56M|    return s + 1;
  192|  8.56M|}
us_socket_is_shut_down:
  194|  1.24M|int us_socket_is_shut_down(int ssl, struct us_socket_t *s) {
  195|       |#ifndef LIBUS_NO_SSL
  196|       |    if (ssl) {
  197|       |        return us_internal_ssl_socket_is_shut_down((struct us_internal_ssl_socket_t *) s);
  198|       |    }
  199|       |#endif
  200|       |
  201|  1.24M|    return us_internal_poll_type(&s->p) == POLL_TYPE_SOCKET_SHUT_DOWN;
  202|  1.24M|}
us_socket_shutdown:
  204|   234k|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|   234k|    if (!us_socket_is_closed(ssl, s) && !us_socket_is_shut_down(ssl, s)) {
  ------------------
  |  Branch (215:9): [True: 234k, False: 0]
  |  Branch (215:41): [True: 234k, False: 232]
  ------------------
  216|   234k|        us_internal_poll_set_type(&s->p, POLL_TYPE_SOCKET_SHUT_DOWN);
  217|   234k|        us_poll_change(&s->p, s->context->loop, us_poll_events(&s->p) & LIBUS_SOCKET_READABLE);
  ------------------
  |  |   27|   234k|#define LIBUS_SOCKET_READABLE EPOLLIN
  ------------------
  218|   234k|        bsd_shutdown_socket(us_poll_fd((struct us_poll_t *) s));
  219|   234k|    }
  220|   234k|}

_Z4testv:
   10|  5.52k|void test() {
   11|       |
   12|  5.52k|    struct PerSocketData {
   13|  5.52k|        int nothing;
   14|  5.52k|        std::shared_ptr<bool> valid;
   15|  5.52k|    };
   16|       |
   17|       |    /* First byte determines what compressor to use */
   18|  5.52k|    unsigned char compressorByte;
   19|  5.52k|    if (consume_byte(&compressorByte)) {
  ------------------
  |  Branch (19:9): [True: 0, False: 5.52k]
  ------------------
   20|       |        //uWS::Loop::get()->free();
   21|      0|        return;
   22|      0|    }
   23|       |
   24|  5.52k|    uWS::CompressOptions compressors[] = {
   25|  5.52k|        uWS::DISABLED,
   26|  5.52k|        uWS::SHARED_COMPRESSOR,
   27|  5.52k|        uWS::DEDICATED_COMPRESSOR_3KB,
   28|  5.52k|        uWS::DEDICATED_COMPRESSOR_4KB,
   29|  5.52k|        uWS::DEDICATED_COMPRESSOR_8KB,
   30|  5.52k|        uWS::DEDICATED_COMPRESSOR_16KB,
   31|  5.52k|        uWS::DEDICATED_COMPRESSOR_32KB,
   32|  5.52k|        uWS::DEDICATED_COMPRESSOR_64KB,
   33|  5.52k|        uWS::DEDICATED_COMPRESSOR_128KB,
   34|  5.52k|        uWS::DEDICATED_COMPRESSOR_256KB
   35|  5.52k|    };
   36|       |
   37|  5.52k|    uWS::CompressOptions compressor = compressors[compressorByte % 10];
   38|       |
   39|  5.52k|    {
   40|  5.52k|        auto app = uWS::App().ws<PerSocketData>("/broadcast", {
   41|       |            /* Settings */
   42|  5.52k|            .compression = compressor,
   43|       |            /* We want this to be low so that we can hit it, yet bigger than 256 */
   44|  5.52k|            .maxPayloadLength = 300,
   45|  5.52k|            .idleTimeout = 12,
   46|       |            /* Handlers */
   47|  5.52k|            .open = [](auto *ws) {
   48|       |                /* Subscribe to anything */
   49|  5.52k|                ws->subscribe(/*req->getHeader(*/"topic"/*)*/);
   50|  5.52k|            },
   51|  5.52k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   52|  5.52k|                if (message.length() && message[0] == 'C') {
   53|  5.52k|                    ws->close();
   54|  5.52k|                } else if (message.length() && message[0] == 'E') {
   55|  5.52k|                    ws->end(1006);
   56|  5.52k|                } else {
   57|       |                    /* Publish to topic sent by message */
   58|  5.52k|                    ws->publish(message, message, opCode, true);
   59|       |
   60|  5.52k|                    if (message.length() && message[0] == 'U') {
   61|  5.52k|                        ws->unsubscribe(message);
   62|  5.52k|                    }
   63|  5.52k|                }
   64|  5.52k|            },
   65|  5.52k|            .drain = [](auto *ws) {
   66|       |                /* Check getBufferedAmount here */
   67|  5.52k|            },
   68|  5.52k|            .ping = [](auto *ws, std::string_view) {
   69|       |
   70|  5.52k|            },
   71|  5.52k|            .pong = [](auto *ws, std::string_view) {
   72|       |
   73|  5.52k|            },
   74|  5.52k|            .close = [](auto *ws, int code, std::string_view message) {
   75|       |                /* Cause reported crash */
   76|  5.52k|                ws->close();
   77|  5.52k|            }
   78|  5.52k|        }).ws<PerSocketData>("/*", {
   79|       |            /* Settings */
   80|  5.52k|            .compression = compressor,
   81|       |            /* We want this to be low so that we can hit it, yet bigger than 256 */
   82|  5.52k|            .maxPayloadLength = 300,
   83|  5.52k|            .idleTimeout = 12,
   84|       |            /* Handlers */
   85|  5.52k|            .open = [](auto *ws) {
   86|       |
   87|  5.52k|                ws->getUserData()->valid.reset(new bool{true});
   88|       |
   89|       |                //if (req->getHeader("close_me").length()) {
   90|       |                //    ws->close();
   91|       |                //} else if (req->getHeader("end_me").length()) {
   92|       |                //    ws->end(1006);
   93|       |                //}
   94|  5.52k|            },
   95|  5.52k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   96|  5.52k|                if (message.length() > 300) {
   97|       |                    /* Inform the sanitizer of the fault */
   98|  5.52k|                    fprintf(stderr, "Too long message passed\n");
   99|  5.52k|                    free((void *) -1);
  100|  5.52k|                }
  101|       |
  102|  5.52k|                if (message.length() && message[0] == 'C') {
  103|  5.52k|                    ws->close();
  104|  5.52k|                } else if (message.length() && message[0] == 'E') {
  105|  5.52k|                    ws->end(1006);
  106|  5.52k|                } else {
  107|  5.52k|                    ws->send(message, opCode, true);
  108|  5.52k|                }
  109|  5.52k|            },
  110|  5.52k|            .drain = [](auto *ws) {
  111|       |                /* Check getBufferedAmount here */
  112|  5.52k|            },
  113|  5.52k|            .ping = [](auto *ws, std::string_view) {
  114|       |                /* Here we test send and end while uncorked, by having them send from deferred */
  115|  5.52k|                PerSocketData *psd = (PerSocketData *) ws->getUserData();
  116|       |
  117|  5.52k|                uWS::Loop::get()->defer([ws, valid = psd->valid]() {
  118|  5.52k|                    if (*valid.get()) {
  119|       |                        /* We haven't been closed */
  120|  5.52k|                        ws->send("Hello!", uWS::TEXT, false);
  121|  5.52k|                        ws->end(1000);
  122|  5.52k|                    }
  123|  5.52k|                });
  124|  5.52k|            },
  125|  5.52k|            .pong = [](auto *ws, std::string_view) {
  126|       |
  127|  5.52k|            },
  128|  5.52k|            .close = [](auto *ws, int code, std::string_view message) {
  129|  5.52k|                (*ws->getUserData()->valid.get()) = false;
  130|  5.52k|            }
  131|  5.52k|        }).listen(9001, [](us_listen_socket_t *listenSocket) {
  132|  5.52k|            listen_socket = listenSocket;
  133|  5.52k|        });
  134|       |
  135|  5.52k|        app.run();
  136|  5.52k|    }
  137|       |
  138|  5.52k|    uWS::Loop::get()->free();
  139|  5.52k|}
_Z8teardownv:
  142|  5.50k|void teardown() {
  143|       |	/* If we are called twice there's a bug (it potentially could if
  144|       |	 * all open sockets cannot be error-closed in one epoll_wait call).
  145|       |	 * But we only allow 1k FDs and we have a buffer of 1024 from epoll_wait */
  146|  5.50k|	if (!listen_socket) {
  ------------------
  |  Branch (146:6): [True: 0, False: 5.50k]
  ------------------
  147|      0|		exit(-1);
  148|      0|	}
  149|       |
  150|       |	/* We might have open sockets still, and these will be error-closed by epoll_wait */
  151|       |	// us_socket_context_close - close all open sockets created with this socket context
  152|  5.50k|    if (listen_socket) {
  ------------------
  |  Branch (152:9): [True: 5.50k, False: 0]
  ------------------
  153|  5.50k|        us_listen_socket_close(0, listen_socket);
  154|  5.50k|        listen_socket = NULL;
  155|  5.50k|    }
  156|  5.50k|}
EpollEchoServer.cpp:_ZZ4testvENK3$_0clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   47|  73.5k|            .open = [](auto *ws) {
   48|       |                /* Subscribe to anything */
   49|  73.5k|                ws->subscribe(/*req->getHeader(*/"topic"/*)*/);
   50|  73.5k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_1clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS1_6OpCodeE:
   51|  31.1k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   52|  31.1k|                if (message.length() && message[0] == 'C') {
  ------------------
  |  Branch (52:21): [True: 30.9k, False: 211]
  |  Branch (52:41): [True: 315, False: 30.6k]
  ------------------
   53|    315|                    ws->close();
   54|  30.8k|                } else if (message.length() && message[0] == 'E') {
  ------------------
  |  Branch (54:28): [True: 30.6k, False: 211]
  |  Branch (54:48): [True: 251, False: 30.3k]
  ------------------
   55|    251|                    ws->end(1006);
   56|  30.5k|                } else {
   57|       |                    /* Publish to topic sent by message */
   58|  30.5k|                    ws->publish(message, message, opCode, true);
   59|       |
   60|  30.5k|                    if (message.length() && message[0] == 'U') {
  ------------------
  |  Branch (60:25): [True: 30.3k, False: 211]
  |  Branch (60:45): [True: 723, False: 29.6k]
  ------------------
   61|    723|                        ws->unsubscribe(message);
   62|    723|                    }
   63|  30.5k|                }
   64|  31.1k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_2clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   65|  11.5k|            .drain = [](auto *ws) {
   66|       |                /* Check getBufferedAmount here */
   67|  11.5k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_3clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   68|  4.96k|            .ping = [](auto *ws, std::string_view) {
   69|       |
   70|  4.96k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_4clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   71|    380|            .pong = [](auto *ws, std::string_view) {
   72|       |
   73|    380|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_5clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_iNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
   74|  73.5k|            .close = [](auto *ws, int code, std::string_view message) {
   75|       |                /* Cause reported crash */
   76|  73.5k|                ws->close();
   77|  73.5k|            }
EpollEchoServer.cpp:_ZZ4testvENK3$_6clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
   85|  34.7k|            .open = [](auto *ws) {
   86|       |
   87|  34.7k|                ws->getUserData()->valid.reset(new bool{true});
   88|       |
   89|       |                //if (req->getHeader("close_me").length()) {
   90|       |                //    ws->close();
   91|       |                //} else if (req->getHeader("end_me").length()) {
   92|       |                //    ws->end(1006);
   93|       |                //}
   94|  34.7k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_7clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEENS1_6OpCodeE:
   95|  13.6k|            .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
   96|  13.6k|                if (message.length() > 300) {
  ------------------
  |  Branch (96:21): [True: 0, False: 13.6k]
  ------------------
   97|       |                    /* Inform the sanitizer of the fault */
   98|      0|                    fprintf(stderr, "Too long message passed\n");
   99|      0|                    free((void *) -1);
  100|      0|                }
  101|       |
  102|  13.6k|                if (message.length() && message[0] == 'C') {
  ------------------
  |  Branch (102:21): [True: 10.8k, False: 2.77k]
  |  Branch (102:41): [True: 268, False: 10.5k]
  ------------------
  103|    268|                    ws->close();
  104|  13.3k|                } else if (message.length() && message[0] == 'E') {
  ------------------
  |  Branch (104:28): [True: 10.5k, False: 2.77k]
  |  Branch (104:48): [True: 586, False: 10.0k]
  ------------------
  105|    586|                    ws->end(1006);
  106|  12.7k|                } else {
  107|  12.7k|                    ws->send(message, opCode, true);
  108|  12.7k|                }
  109|  13.6k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_8clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_:
  110|  8.91k|            .drain = [](auto *ws) {
  111|       |                /* Check getBufferedAmount here */
  112|  8.91k|            },
EpollEchoServer.cpp:_ZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
  113|  4.18k|            .ping = [](auto *ws, std::string_view) {
  114|       |                /* Here we test send and end while uncorked, by having them send from deferred */
  115|  4.18k|                PerSocketData *psd = (PerSocketData *) ws->getUserData();
  116|       |
  117|  4.18k|                uWS::Loop::get()->defer([ws, valid = psd->valid]() {
  118|  4.18k|                    if (*valid.get()) {
  119|       |                        /* We haven't been closed */
  120|  4.18k|                        ws->send("Hello!", uWS::TEXT, false);
  121|  4.18k|                        ws->end(1000);
  122|  4.18k|                    }
  123|  4.18k|                });
  124|  4.18k|            },
EpollEchoServer.cpp:_ZZZ4testvENK3$_9clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEEENKUlvE_clEv:
  117|  3.70k|                uWS::Loop::get()->defer([ws, valid = psd->valid]() {
  118|  3.70k|                    if (*valid.get()) {
  ------------------
  |  Branch (118:25): [True: 919, False: 2.78k]
  ------------------
  119|       |                        /* We haven't been closed */
  120|    919|                        ws->send("Hello!", uWS::TEXT, false);
  121|    919|                        ws->end(1000);
  122|    919|                    }
  123|  3.70k|                });
EpollEchoServer.cpp:_ZZ4testvENK4$_10clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_NSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
  125|  1.08k|            .pong = [](auto *ws, std::string_view) {
  126|       |
  127|  1.08k|            },
EpollEchoServer.cpp:_ZZ4testvENK4$_11clIN3uWS9WebSocketILb0ELb1EZ4testvE13PerSocketDataEEEEDaPT_iNSt3__117basic_string_viewIcNS7_11char_traitsIcEEEE:
  128|  34.7k|            .close = [](auto *ws, int code, std::string_view message) {
  129|  34.7k|                (*ws->getUserData()->valid.get()) = false;
  130|  34.7k|            }
EpollEchoServer.cpp:_ZZ4testvENK4$_12clEP18us_listen_socket_t:
  131|  5.52k|        }).listen(9001, [](us_listen_socket_t *listenSocket) {
  132|  5.52k|            listen_socket = listenSocket;
  133|  5.52k|        });

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

