mirror of
https://github.com/fhmq/hmq.git
synced 2026-09-01 23:34:52 +00:00
* modify * update * add acl * add feature * update dockerfile * add deploy * update * update * plugins * plugins * update * update * update * fixed * remove * fixed * add log * update * fixed * update * fix config * add http api * add http api * resp * add config for work chan * update * fixed * update * disable trace * fixed * change acl * fixed * fixed res * dd * dd * ddd * dd * update * fixed * update * add * fixed * update key * add log * update * format * update * update auth * update * update readme * added * update * fixed * fixed * fix * upade * update * update
32 lines
716 B
Go
32 lines
716 B
Go
package ndr
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
)
|
|
|
|
func (dec *Decoder) fillPipe(v reflect.Value, tag reflect.StructTag) error {
|
|
s, err := dec.readUint32() // read element count of first chunk
|
|
if err != nil {
|
|
return err
|
|
}
|
|
a := reflect.MakeSlice(v.Type(), 0, 0)
|
|
c := reflect.MakeSlice(v.Type(), int(s), int(s))
|
|
for s != 0 {
|
|
for i := 0; i < int(s); i++ {
|
|
err := dec.fill(c.Index(i), tag, &[]deferedPtr{})
|
|
if err != nil {
|
|
return fmt.Errorf("could not fill element %d of pipe: %v", i, err)
|
|
}
|
|
}
|
|
s, err = dec.readUint32() // read element count of first chunk
|
|
if err != nil {
|
|
return err
|
|
}
|
|
a = reflect.AppendSlice(a, c)
|
|
c = reflect.MakeSlice(v.Type(), int(s), int(s))
|
|
}
|
|
v.Set(a)
|
|
return nil
|
|
}
|