MCPcopy Create free account
hub / github.com/cloudwego/netpoll / resetTail

Method resetTail

nocopy_linkbuffer.go:740–749  ·  view source on GitHub ↗

resetTail will reset tail node or add an empty tail node to guarantee the tail node is not larger than 8KB

(maxSize int)

Source from the content-addressed store, hash-verified

738// resetTail will reset tail node or add an empty tail node to
739// guarantee the tail node is not larger than 8KB
740func (b *UnsafeLinkBuffer) resetTail(maxSize int) {
741 if maxSize <= pagesize {
742 // no need to reset a small buffer tail node
743 return
744 }
745 // set nil tail
746 b.write.next = newLinkBufferNode(0)
747 b.write = b.write.next
748 b.flush = b.write
749}
750
751// indexByte returns the index of the first instance of c in buffer, or -1 if c is not present in buffer.
752func (b *UnsafeLinkBuffer) indexByte(c byte, skip int) int {

Callers 2

TestLinkBufferResetTailFunction · 0.45
ReleaseMethod · 0.45

Calls 1

newLinkBufferNodeFunction · 0.85

Tested by 1

TestLinkBufferResetTailFunction · 0.36