@@ -23,8 +23,9 @@ type ResponseStateMachine struct {
2323 currentAttributeGroupTag int8
2424 currentAttributes Attributes
2525 currentAttributeTag int8
26+ currentAttributeName string
2627 currentLength int16
27- currentAttribute Attribute
28+ currentAttribute * Attribute
2829}
2930
3031func NewResponseStateMachine () * ResponseStateMachine {
@@ -111,15 +112,16 @@ func (r *ResponseStateMachine) Decode(reader io.Reader) error {
111112 }
112113 name := string (bs )
113114
114- r .currentAttribute = Attribute {
115+ r .currentAttribute = & Attribute {
115116 Tag : r .currentAttributeTag ,
116117 Name : name ,
117118 }
119+ r .currentAttributeName = name
118120 var attrs []Attribute
119121 if attrs , ok := r .currentAttributes [name ]; ok {
120- attrs = append (attrs , r .currentAttribute )
122+ attrs = append (attrs , * r .currentAttribute )
121123 } else {
122- attrs = []Attribute {r .currentAttribute }
124+ attrs = []Attribute {* r .currentAttribute }
123125 }
124126 r .currentAttributes [name ] = attrs
125127 r .State = ResponseStateAttributeValue
@@ -131,7 +133,13 @@ func (r *ResponseStateMachine) Decode(reader io.Reader) error {
131133 if _ , err := reader .Read (bs ); err != nil {
132134 return err
133135 }
134- r .currentAttribute .Value = bs
136+
137+ attr := r .currentAttributes [r .currentAttributeName ]
138+ attr .Value = bs
139+
140+ //println("Attribute Name: ", r.currentAttribute.Name)
141+ //r.currentAttribute.Value = bs
142+ //fmt.Printf("Attribute Value: %v\n", r.currentAttribute)
135143 r .State = ResponseStateAttribute
136144
137145 }
0 commit comments