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

Method set_buffer_reference

src/proxy/hdrs/HTTP.cc:2399–2417  ·  view source on GitHub ↗

void HTTPInfo::set_buffer_reference(RefCountObj* block_ref) Setting a buffer reference for the alt is separate from the unmarshalling operation because the clustering utilizes the system differently than cache does The cache maintains external refcounting of the buffer that the alt is in & doesn't always destroy the alt when its done with it because it figures it doesn't need to since it is manag

Source from the content-addressed store, hash-verified

2397// to set up the reference
2398//
2399void
2400HTTPInfo::set_buffer_reference(RefCountObj *block_ref)
2401{
2402 ink_assert(m_alt->m_magic == CACHE_ALT_MAGIC_ALIVE);
2403
2404 // Free existing reference
2405 if (m_alt->m_ext_buffer != nullptr) {
2406 if (m_alt->m_ext_buffer->refcount_dec() == 0) {
2407 m_alt->m_ext_buffer->free();
2408 }
2409 }
2410 // Set up the ref count for the external buffer
2411 // if there is one
2412 if (block_ref) {
2413 block_ref->refcount_inc();
2414 }
2415
2416 m_alt->m_ext_buffer = block_ref;
2417}
2418
2419int
2420HTTPInfo::get_handle(char *buf, int len)

Callers

nothing calls this directly

Calls 3

refcount_decMethod · 0.80
refcount_incMethod · 0.80
freeMethod · 0.45

Tested by

no test coverage detected