Skip to content

Commit e6e1b26

Browse files
committed
syntax errors
1 parent c5e4a5d commit e6e1b26

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

connection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func (conn *Connection) reader() {
180180
if fut, ok := conn.requests[resp.RequestId]; ok {
181181
delete(conn.requests, resp.RequestId)
182182
fut.resp = resp
183-
close(rae.c)
183+
close(fut.c)
184184
conn.mutex.Unlock()
185185
} else {
186186
conn.mutex.Unlock()

request.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (req *Request) future() (f *Future) {
211211
close(f.c)
212212
return
213213
}
214-
req.conn.requests[req.requestId] = &f
214+
req.conn.requests[req.requestId] = f
215215
req.conn.mutex.Unlock()
216216
req.conn.packets <- (packet)
217217

@@ -259,6 +259,6 @@ func (f *Future) GetTyped(r interface{}) (error) {
259259
if f.err != nil {
260260
return f.err
261261
}
262-
f.err = f.resp.decodeBody(r)
262+
f.err = f.resp.decodeBodyTyped(r)
263263
return f.err
264264
}

response.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ func (resp *Response) decodeHeader() (err error) {
4949
}
5050

5151
func (resp *Response) decodeBody() (err error) {
52-
if len(resp.buf.Len()) > 2 {
52+
if resp.buf.Len() > 2 {
5353
var body map[int]interface{}
5454
d := msgpack.NewDecoder(&resp.buf)
5555

5656
if err = d.Decode(&body); err != nil {
57-
return nil, err
57+
return err
5858
}
5959

6060
if body[KeyData] != nil {
@@ -64,15 +64,19 @@ func (resp *Response) decodeBody() (err error) {
6464
resp.Data[i] = v.([]interface{})
6565
}
6666
}
67+
if body[KeyError] != nil {
68+
resp.Error = body[KeyError].(string)
69+
}
6770

6871
if resp.Code != OkCode {
69-
err = Error{resp.Code, body[KeyError].(string)}
72+
err = Error{resp.Code, resp.Error}
7073
}
7174
}
75+
return
7276
}
7377

7478
func (resp *Response) decodeBodyTyped(res interface{}) (err error) {
75-
if len(resp.buf.Len()) > 0 {
79+
if resp.buf.Len() > 0 {
7680
var l int
7781
d := msgpack.NewDecoder(&resp.buf)
7882
if l, err = d.DecodeMapLen(); err != nil {
@@ -97,7 +101,7 @@ func (resp *Response) decodeBodyTyped(res interface{}) (err error) {
97101
}
98102

99103
if resp.Code != OkCode {
100-
err = Error{resp.Code, body[KeyError].(string)}
104+
err = Error{resp.Code, resp.Error}
101105
}
102106
}
103107
return

0 commit comments

Comments
 (0)