Don't access ResponseReader if ExchangeMsg returns an err

networking
brl 10 years ago
parent cc179a7644
commit 83f489eb54

@ -19,13 +19,14 @@ func clientSend(msg interface{}) (*ipc.Message, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer c.Close()
rr, err := c.ExchangeMsg(msg) rr, err := c.ExchangeMsg(msg)
resp := <- rr.Chan()
rr.Done()
c.Close()
if err != nil { if err != nil {
return nil, err return nil, err
} }
resp := <- rr.Chan()
rr.Done()
return resp,nil return resp,nil
} }

@ -18,14 +18,14 @@ func clientSend(addr string, msg interface{}) (*ipc.Message, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer c.Close()
rr, err := c.ExchangeMsg(msg) rr, err := c.ExchangeMsg(msg)
resp := <- rr.Chan()
rr.Done()
c.Close()
if err != nil { if err != nil {
return nil, err return nil, err
} }
resp := <- rr.Chan()
rr.Done()
return resp, nil return resp, nil
} }

Loading…
Cancel
Save