From 0c23de2f7e162d24223fe9793fc8c904f1b3d3f0 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 4 Feb 2018 17:39:49 +0400 Subject: [PATCH] Deregister channels in request() method --- rpc.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rpc.go b/rpc.go index 4161fcc..bea3317 100644 --- a/rpc.go +++ b/rpc.go @@ -195,8 +195,6 @@ func (l *Libvirt) callback(id uint32, res response) { if ok { c <- res } - - l.deregister(id) } // route sends incoming packets to their listeners. @@ -297,6 +295,7 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response c := make(chan response) l.register(serial, c) + defer l.deregister(serial) err := l.sendPacket(serial, proc, program, payload, Call, StatusOK) if err != nil {