From 1a220100bdf4087dde0d58b3183a8d9910d55e6b Mon Sep 17 00:00:00 2001 From: Ben LeMasurier Date: Fri, 15 Dec 2017 12:56:47 -0700 Subject: [PATCH] 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 --- rpc.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpc.go b/rpc.go index 3fd1816..0e2bbf0 100644 --- a/rpc.go +++ b/rpc.go @@ -208,7 +208,9 @@ func (l *Libvirt) listen() { // callback sends rpc responses to their respective caller. func (l *Libvirt) callback(id uint32, res response) { + l.cm.Lock() c, ok := l.callbacks[id] + l.cm.Unlock() if ok { c <- res }