예제 #1
0
// newWritableChunk creates a new writable chunk around a checksum and a buffer to hold data
func newWritableChunk(checksum Checksum, contents *typed.WriteBuffer) *writableChunk {
	return &writableChunk{
		size:     0,
		sizeRef:  contents.DeferUint16(),
		checksum: checksum,
		contents: contents,
	}
}
예제 #2
0
파일: buf.go 프로젝트: gosuper/tchannel-go
func writeHeaders(wb *typed.WriteBuffer, form http.Header) {
	numHeadersDeferred := wb.DeferUint16()
	numHeaders := uint16(0)
	for k, values := range form {
		for _, v := range values {
			wb.WriteLen16String(k)
			wb.WriteLen16String(v)
			numHeaders++
		}
	}
	numHeadersDeferred.Update(numHeaders)
}