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:
Ben LeMasurier 2017-12-15 12:56:47 -07:00 committed by GitHub
parent fa865cdb8e
commit 1a220100bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
rpc.go
View File

@ -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
} }