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

Method write_to

src/proxy/http2/Http2Frame.cc:51–78  ·  view source on GitHub ↗

DATA Frame

Source from the content-addressed store, hash-verified

49// DATA Frame
50//
51int64_t
52Http2DataFrame::write_to(MIOBuffer *iobuffer) const
53{
54 // Write frame header
55 uint8_t buf[HTTP2_FRAME_HEADER_LEN];
56 http2_write_frame_header(this->_hdr, make_iovec(buf));
57 int64_t len = iobuffer->write(buf, sizeof(buf));
58
59 // Write frame payload
60 if (this->_reader && this->_payload_len > 0) {
61 int64_t written = 0;
62 // Fill current IOBufferBlock as much as possible to reduce SSL_write() calls
63 while (written < this->_payload_len) {
64 int64_t read_len = std::min(this->_payload_len - written, this->_reader->block_read_avail());
65
66 if (iobuffer->block_write_avail() < read_len) {
67 // This block size is the buffer size that we pass to SSLWriteBuffer
68 iobuffer->append_block(Http2::write_buffer_block_size_index);
69 }
70
71 written += iobuffer->write(this->_reader->start(), read_len);
72 this->_reader->consume(read_len);
73 }
74 len += written;
75 }
76
77 return len;
78}
79
80//
81// HEADERS Frame

Callers 2

xmitMethod · 0.80
test_Http2Frame.ccFile · 0.80

Calls 15

http2_write_frame_headerFunction · 0.85
make_iovecFunction · 0.85
http2_write_rst_streamFunction · 0.85
http2_write_settingsFunction · 0.85
http2_write_push_promiseFunction · 0.85
http2_write_pingFunction · 0.85
http2_write_goawayFunction · 0.85
block_read_availMethod · 0.80
block_write_availMethod · 0.80
ink_abortFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected