Commit f302d93e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 55cd6072
......@@ -926,11 +926,11 @@ func (d *decoder) genSlice1(assignto string, typ types.Type) {
// emit code to size/encode/decode zodb.Buf
// same as slice1 but buffer is allocated via zodb.BufAlloc
func (s *sizer) genBuf(path string) {
s.genSlice1(path + ".Data", nil /* typ unused */)
s.genSlice1(path + ".XData()", nil /* typ unused */)
}
func (e *encoder) genBuf(path string) {
e.genSlice1(path + ".Data", nil /* typ unused */)
e.genSlice1(path + ".XData()", nil /* typ unused */)
}
func (d *decoder) genBuf(path string) {
......
......@@ -471,6 +471,12 @@ func (stor *Storage) serveClient(ctx context.Context, req neo.Request) {
return
}
// XXX hack -> resp.Release()
// XXX req.Msg release too?
if resp, ok := resp.(*neo.AnswerObject); ok {
resp.Data.Release()
}
// keep on going in the same goroutine to avoid goroutine creation overhead
// TODO += timeout -> go away if inactive
req, err = link.Recv1()
......
......@@ -1930,7 +1930,7 @@ func (*AnswerObject) neoMsgCode() uint16 {
}
func (p *AnswerObject) neoMsgEncodedLen() int {
return 57 + len(p.Data.Data)
return 57 + len(p.Data.XData())
}
func (p *AnswerObject) neoMsgEncode(data []byte) {
......@@ -1940,10 +1940,10 @@ func (p *AnswerObject) neoMsgEncode(data []byte) {
(data[24:])[0] = bool2byte(p.Compression)
copy(data[25:], p.Checksum[:])
{
l := uint32(len(p.Data.Data))
l := uint32(len(p.Data.XData()))
binary.BigEndian.PutUint32(data[45:], l)
data = data[49:]
copy(data, p.Data.Data)
copy(data, p.Data.XData())
data = data[l:]
}
binary.BigEndian.PutUint64(data[0:], uint64(p.DataSerial))
......
......@@ -171,3 +171,11 @@ func (buf *Buf) Cap() int {
}
return 0
}
// XData return's buf.Data or nil if buf == nil.
func (buf *Buf) XData() []byte {
if buf != nil {
return buf.Data
}
return nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment