Skip to content

Commit

Permalink
rename struct name
Browse files Browse the repository at this point in the history
  • Loading branch information
childe committed Apr 11, 2019
1 parent 44ef000 commit d2c6472
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions alter_config_request.go
Expand Up @@ -13,7 +13,7 @@ type AlterConfigsRequest struct {
type AlterConfigsRequestResource struct {
ResourceType uint8
ResourceName string
ConfigEntries []*ConfigEntry
ConfigEntries []*AlterConfigsRequestConfigEntry
}

func (r *AlterConfigsRequestResource) encode(payload []byte) (offset int) {
Expand All @@ -36,12 +36,12 @@ func (r *AlterConfigsRequestResource) encode(payload []byte) (offset int) {
return
}

type ConfigEntry struct {
type AlterConfigsRequestConfigEntry struct {
ConfigName string
ConfigValue string
}

func (c *ConfigEntry) encode(payload []byte) (offset int) {
func (c *AlterConfigsRequestConfigEntry) encode(payload []byte) (offset int) {
binary.BigEndian.PutUint16(payload[offset:], uint16(len(c.ConfigName)))
offset += 2

Expand Down
4 changes: 4 additions & 0 deletions alter_config_response.go
Expand Up @@ -63,7 +63,11 @@ func NewAlterConfigsResponse(payload []byte) (*AlterConfigsResponse, error) {

r.Resources = make([]*AlterConfigsResponseResource, count)
for _, r := range r.Resources {
r = &AlterConfigsResponseResource{}
offset += r.decode(payload[offset:])
if err == nil && r.ErrorCode != 0 {
err = getErrorFromErrorCode(r.ErrorCode)
}
}

return r, err
Expand Down

0 comments on commit d2c6472

Please sign in to comment.