diff --git a/src/network/lan.cpp b/src/network/lan.cpp
index 80b4c9671..7762edfde 100644
--- a/src/network/lan.cpp
+++ b/src/network/lan.cpp
@@ -30,9 +30,10 @@ along with Freeminer. If not, see .
#include "server/serverlist.h"
#include "debug.h"
#include "json/json.h"
+#include
+#include
#include "porting.h"
#include "threading/thread.h"
-#include "threading/concurrent_map.h"
#include "network/address.h"
//copypaste from ../socket.cpp
@@ -303,6 +304,7 @@ void *lan_adv::run()
if (p["port"].isInt()) {
p["address"] = addr_str;
auto key = addr_str + ":" + p["port"].asString();
+ std::unique_lock lock(mutex);
if (p["cmd"].asString() == "shutdown") {
//infostream << "server shutdown " << key << "\n";
collected.erase(key);
diff --git a/src/network/lan.h b/src/network/lan.h
index ea058f1ae..085a597a2 100644
--- a/src/network/lan.h
+++ b/src/network/lan.h
@@ -20,10 +20,11 @@ along with Freeminer. If not, see .
#pragma once
#include "json/json.h"
+#include