From 093bf5d859c3a0e5b82744719952d7dd178d4bbf Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Thu, 4 Apr 2019 19:48:28 +0200
Subject: [PATCH] event/*, ...: make GetEventLoop() const

---
 src/db/update/Service.hxx                     | 2 +-
 src/event/DeferEvent.hxx                      | 2 +-
 src/event/MaskMonitor.hxx                     | 2 +-
 src/event/SocketMonitor.hxx                   | 2 +-
 src/event/TimerEvent.hxx                      | 2 +-
 src/input/AsyncInputStream.hxx                | 2 +-
 src/input/plugins/TidalSessionManager.hxx     | 2 +-
 src/lib/curl/Global.hxx                       | 2 +-
 src/lib/dbus/Glue.hxx                         | 2 +-
 src/lib/dbus/Watch.hxx                        | 2 +-
 src/lib/nfs/Connection.hxx                    | 4 +---
 src/lib/nfs/FileReader.hxx                    | 2 +-
 src/lib/upnp/Discovery.cxx                    | 2 +-
 src/lib/upnp/Discovery.hxx                    | 2 +-
 src/neighbor/plugins/UdisksNeighborPlugin.cxx | 2 +-
 src/storage/plugins/NfsStorage.cxx            | 2 +-
 src/storage/plugins/UdisksStorage.cxx         | 2 +-
 17 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/src/db/update/Service.hxx b/src/db/update/Service.hxx
index c00b8f42f..a03e451ad 100644
--- a/src/db/update/Service.hxx
+++ b/src/db/update/Service.hxx
@@ -66,7 +66,7 @@ public:
 
 	~UpdateService();
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return defer.GetEventLoop();
 	}
 
diff --git a/src/event/DeferEvent.hxx b/src/event/DeferEvent.hxx
index 4dd8c9e66..64ddbf280 100644
--- a/src/event/DeferEvent.hxx
+++ b/src/event/DeferEvent.hxx
@@ -50,7 +50,7 @@ public:
 		Cancel();
 	}
 
-	EventLoop &GetEventLoop() noexcept {
+	EventLoop &GetEventLoop() const noexcept {
 		return loop;
 	}
 
diff --git a/src/event/MaskMonitor.hxx b/src/event/MaskMonitor.hxx
index cff69e8aa..81e7aff24 100644
--- a/src/event/MaskMonitor.hxx
+++ b/src/event/MaskMonitor.hxx
@@ -44,7 +44,7 @@ public:
 		:defer(_loop, BIND_THIS_METHOD(RunDeferred)),
 		 callback(_callback), pending_mask(0) {}
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return defer.GetEventLoop();
 	}
 
diff --git a/src/event/SocketMonitor.hxx b/src/event/SocketMonitor.hxx
index df80ced04..46a087342 100644
--- a/src/event/SocketMonitor.hxx
+++ b/src/event/SocketMonitor.hxx
@@ -68,7 +68,7 @@ public:
 
 	~SocketMonitor() noexcept;
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return loop;
 	}
 
diff --git a/src/event/TimerEvent.hxx b/src/event/TimerEvent.hxx
index 993a2d82c..1e103f4b8 100644
--- a/src/event/TimerEvent.hxx
+++ b/src/event/TimerEvent.hxx
@@ -62,7 +62,7 @@ public:
 		Cancel();
 	}
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return loop;
 	}
 
diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx
index 566ec6601..fb71ba5e1 100644
--- a/src/input/AsyncInputStream.hxx
+++ b/src/input/AsyncInputStream.hxx
@@ -76,7 +76,7 @@ public:
 
 	virtual ~AsyncInputStream() noexcept;
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return deferred_resume.GetEventLoop();
 	}
 
diff --git a/src/input/plugins/TidalSessionManager.hxx b/src/input/plugins/TidalSessionManager.hxx
index f5b4c9299..429612255 100644
--- a/src/input/plugins/TidalSessionManager.hxx
+++ b/src/input/plugins/TidalSessionManager.hxx
@@ -102,7 +102,7 @@ public:
 
 	~TidalSessionManager() noexcept;
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return defer_invoke_handlers.GetEventLoop();
 	}
 
diff --git a/src/lib/curl/Global.hxx b/src/lib/curl/Global.hxx
index 5a3a87209..79ab535aa 100644
--- a/src/lib/curl/Global.hxx
+++ b/src/lib/curl/Global.hxx
@@ -50,7 +50,7 @@ class CurlGlobal final {
 public:
 	explicit CurlGlobal(EventLoop &_loop);
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return timeout_event.GetEventLoop();
 	}
 
diff --git a/src/lib/dbus/Glue.hxx b/src/lib/dbus/Glue.hxx
index ed6612155..66e0ec15a 100644
--- a/src/lib/dbus/Glue.hxx
+++ b/src/lib/dbus/Glue.hxx
@@ -42,7 +42,7 @@ public:
 		DisconnectIndirect();
 	}
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return watch.GetEventLoop();
 	}
 
diff --git a/src/lib/dbus/Watch.hxx b/src/lib/dbus/Watch.hxx
index 939793043..87fbf5217 100644
--- a/src/lib/dbus/Watch.hxx
+++ b/src/lib/dbus/Watch.hxx
@@ -102,7 +102,7 @@ public:
 
 	void Shutdown() noexcept;
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return defer_dispatch.GetEventLoop();
 	}
 
diff --git a/src/lib/nfs/Connection.hxx b/src/lib/nfs/Connection.hxx
index 7260c5f6d..20905add0 100644
--- a/src/lib/nfs/Connection.hxx
+++ b/src/lib/nfs/Connection.hxx
@@ -161,9 +161,7 @@ public:
 		return export_name.c_str();
 	}
 
-	EventLoop &GetEventLoop() noexcept {
-		return SocketMonitor::GetEventLoop();
-	}
+	using SocketMonitor::GetEventLoop;
 
 	/**
 	 * Ensure that the connection is established.  The connection
diff --git a/src/lib/nfs/FileReader.hxx b/src/lib/nfs/FileReader.hxx
index 02697e097..e1f5d81e7 100644
--- a/src/lib/nfs/FileReader.hxx
+++ b/src/lib/nfs/FileReader.hxx
@@ -69,7 +69,7 @@ public:
 	NfsFileReader() noexcept;
 	~NfsFileReader() noexcept;
 
-	EventLoop &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return defer_open.GetEventLoop();
 	}
 
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx
index facf94a10..9e720bf31 100644
--- a/src/lib/upnp/Discovery.cxx
+++ b/src/lib/upnp/Discovery.cxx
@@ -272,7 +272,7 @@ UPnPDeviceDirectory::~UPnPDeviceDirectory() noexcept
 }
 
 inline EventLoop &
-UPnPDeviceDirectory::GetEventLoop() noexcept
+UPnPDeviceDirectory::GetEventLoop() const noexcept
 {
 	return curl->GetEventLoop();
 }
diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx
index 8af1c1ae6..fa6673203 100644
--- a/src/lib/upnp/Discovery.hxx
+++ b/src/lib/upnp/Discovery.hxx
@@ -168,7 +168,7 @@ public:
 	UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
 	UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
 
-	EventLoop &GetEventLoop() noexcept;
+	EventLoop &GetEventLoop() const noexcept;
 
 	void Start();
 
diff --git a/src/neighbor/plugins/UdisksNeighborPlugin.cxx b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
index bb6a70d51..cb5d422f2 100644
--- a/src/neighbor/plugins/UdisksNeighborPlugin.cxx
+++ b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
@@ -70,7 +70,7 @@ public:
 			       NeighborListener &_listener) noexcept
 		:NeighborExplorer(_listener), event_loop(_event_loop) {}
 
-	auto &GetEventLoop() noexcept {
+	auto &GetEventLoop() const noexcept {
 		return event_loop;
 	}
 
diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx
index 5f9450497..e485fd8e4 100644
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -129,7 +129,7 @@ public:
 	}
 
 private:
-	EventLoop &GetEventLoop() noexcept {
+	EventLoop &GetEventLoop() const noexcept {
 		return defer_connect.GetEventLoop();
 	}
 
diff --git a/src/storage/plugins/UdisksStorage.cxx b/src/storage/plugins/UdisksStorage.cxx
index 60f1e27e0..1bd17b4e2 100644
--- a/src/storage/plugins/UdisksStorage.cxx
+++ b/src/storage/plugins/UdisksStorage.cxx
@@ -94,7 +94,7 @@ public:
 		}
 	}
 
-	EventLoop &GetEventLoop() noexcept {
+	EventLoop &GetEventLoop() const noexcept {
 		return defer_mount.GetEventLoop();
 	}