From 91ae0b712afca7c27f0e3729b6b5a5a7810970de Mon Sep 17 00:00:00 2001
From: Oleg Girko
Date: Tue, 5 Sep 2017 11:53:28 +0100
Subject: [PATCH] Use connman passed to ThreadSendAlert() instead of g_connman
global. (#1610)
There is no reason to use g_connman global variable in ThreadSendAlert()
because reference to CConnman instance is already passed to it as argument.
This was overlooked when refactoring sendalert module, it's time to fix it.
Signed-off-by: Oleg Girko
---
src/sendalert.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/sendalert.cpp b/src/sendalert.cpp
index 169ce5f41a..2896278517 100644
--- a/src/sendalert.cpp
+++ b/src/sendalert.cpp
@@ -100,8 +100,8 @@ void ThreadSendAlert(CConnman& connman)
printf("ThreadSendAlert() : Sending alert\n");
int nSent = 0;
{
- g_connman->ForEachNode([&alert2, &nSent](CNode* pnode) {
- if (alert2.RelayTo(pnode, *g_connman))
+ connman.ForEachNode([&alert2, &connman, &nSent](CNode* pnode) {
+ if (alert2.RelayTo(pnode, connman))
{
printf("ThreadSendAlert() : Sent alert to %s\n", pnode->addr.ToString().c_str());
nSent++;