From 1dc575ce5b0016eb91779e1e48453cf96dc871b4 Mon Sep 17 00:00:00 2001
From: gord chung <gord@live.ca>
Date: Tue, 3 Jan 2017 14:39:21 +0000
Subject: [PATCH] ensure we set channel in lock

_set_current_channel must be called  with a lock

Change-Id: I151564670946b3399158352c51d1670b9e7291fb
---
 oslo_messaging/_drivers/impl_rabbit.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py
index 11b1bae99..eb6d11ab6 100644
--- a/oslo_messaging/_drivers/impl_rabbit.py
+++ b/oslo_messaging/_drivers/impl_rabbit.py
@@ -607,7 +607,8 @@ class Connection(object):
         self._heartbeat_support_log_emitted = False
 
         # NOTE(sileht): just ensure the connection is setuped at startup
-        self.ensure_connection()
+        with self._connection_lock:
+            self.ensure_connection()
 
         # NOTE(sileht): if purpose is PURPOSE_LISTEN
         # the consume code does the heartbeat stuff