MCPcopy Create free account
hub / github.com/apache/trafficserver / fast_create

Method fast_create

src/proxy/http3/Http3Frame.cc:534–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534std::shared_ptr<Http3Frame>
535Http3FrameFactory::fast_create(IOBufferReader &reader)
536{
537 uint8_t type_buf[FRAME_TYPE_MAX_BYTES]{};
538 reader.memcpy(type_buf, sizeof(type_buf));
539 Http3FrameType type = Http3Frame::type(type_buf, sizeof(type_buf));
540 if (type == Http3FrameType::UNKNOWN) {
541 if (!this->_unknown_frame) {
542 this->_unknown_frame = Http3FrameFactory::create(reader);
543 } else {
544 this->_unknown_frame->reset(reader);
545 }
546 return this->_unknown_frame;
547 }
548
549 std::shared_ptr<Http3Frame> frame = this->_reusable_frames[static_cast<uint8_t>(type)];
550
551 if (frame == nullptr) {
552 frame = Http3FrameFactory::create(reader);
553 if (frame != nullptr) {
554 this->_reusable_frames[static_cast<uint8_t>(type)] = frame;
555 }
556 } else {
557 frame->reset(reader);
558 }
559
560 return frame;
561}
562
563Http3HeadersFrameUPtr
564Http3FrameFactory::create_headers_frame(const uint8_t *header_block, size_t header_block_len)

Callers 3

on_read_readyMethod · 0.80
test_Http3Frame.ccFile · 0.80
LLVMFuzzerTestOneInputFunction · 0.80

Calls 4

createFunction · 0.85
memcpyMethod · 0.80
typeClass · 0.50
resetMethod · 0.45

Tested by

no test coverage detected