Skip to content

Commit

Permalink
socket.Packet: update UnmarshalBody comment
Browse files Browse the repository at this point in the history
  • Loading branch information
andeya committed Mar 21, 2018
1 parent 72efb9b commit c515eca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions socket/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ type (
// MarshalBody returns the encoding of body.
// Note: when the body is a stream of bytes, no marshalling is done.
MarshalBody() ([]byte, error)
// UnmarshalBody unmarshals the encoded data to the existed body.
// UnmarshalBody unmarshals the encoded data to the body.
// Note:
// seq, ptype, uri must be setted already;
// if body=nil, try to use newBodyFunc to create a new one;
// when the body is a stream of bytes, no unmarshalling is done.
UnmarshalBody(bodyBytes []byte) error
}
Expand Down Expand Up @@ -301,9 +302,10 @@ func (p *Packet) MarshalBody() ([]byte, error) {
}
}

// UnmarshalBody unmarshals the encoded data to the existed body.
// UnmarshalBody unmarshals the encoded data to the body.
// Note:
// seq, ptype, uri must be setted already;
// if body=nil, try to use newBodyFunc to create a new one;
// when the body is a stream of bytes, no unmarshalling is done.
func (p *Packet) UnmarshalBody(bodyBytes []byte) error {
if p.body == nil && p.newBodyFunc != nil {
Expand Down

0 comments on commit c515eca

Please sign in to comment.