adds missing mutex around callback map (#54)
We were missing a mutex when retrieving the caller in callback(). Triggered a test failure here: https://travis-ci.org/digitalocean/go-libvirt/jobs/317051310
This commit is contained in:
parent
fa865cdb8e
commit
1a220100bd
2
rpc.go
2
rpc.go
@ -208,7 +208,9 @@ func (l *Libvirt) listen() {
|
|||||||
|
|
||||||
// callback sends rpc responses to their respective caller.
|
// callback sends rpc responses to their respective caller.
|
||||||
func (l *Libvirt) callback(id uint32, res response) {
|
func (l *Libvirt) callback(id uint32, res response) {
|
||||||
|
l.cm.Lock()
|
||||||
c, ok := l.callbacks[id]
|
c, ok := l.callbacks[id]
|
||||||
|
l.cm.Unlock()
|
||||||
if ok {
|
if ok {
|
||||||
c <- res
|
c <- res
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user