(e *encoder)
| 576 | } |
| 577 | |
| 578 | func (r *structuredReply) decode(e *encoder) Error { |
| 579 | if e.uint64() != structuredReplyMagic { |
| 580 | e.check(errors.New("invalid magic for reply")) |
| 581 | } |
| 582 | r.flags = e.uint16() |
| 583 | r.typ = e.uint16() |
| 584 | r.handle = e.uint64() |
| 585 | r.length = e.uint32() |
| 586 | if r.length > 4<<20 { |
| 587 | e.discard(r.length) |
| 588 | return EOVERFLOW |
| 589 | } |
| 590 | buf := make([]byte, r.length) |
| 591 | e.read(buf) |
| 592 | r.data = buf |
| 593 | return nil |
| 594 | } |