summaryrefslogtreecommitdiff
path: root/src/lib/server_finder.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-11-06 15:11:43 +0000
committerCarl Hetherington <cth@carlh.net>2013-11-06 15:11:43 +0000
commitd98bdad019ba9be5d800dece0414d7a080609027 (patch)
tree003bdcb6a1b0f4c6516d4a11dd84c2c79cdab5db /src/lib/server_finder.h
parent4782e1c0beec98560950a616902669f09a98faae (diff)
Add some missing test stuff; split server discovery off into ServerFinder.
Diffstat (limited to 'src/lib/server_finder.h')
-rw-r--r--src/lib/server_finder.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/server_finder.h b/src/lib/server_finder.h
new file mode 100644
index 000000000..8b56022de
--- /dev/null
+++ b/src/lib/server_finder.h
@@ -0,0 +1,41 @@
+/*
+ Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/signals2.hpp>
+#include "server.h"
+
+class ServerFinder
+{
+public:
+ ServerFinder ();
+ ~ServerFinder ();
+
+ boost::signals2::signal<void (ServerDescription)> ServerFound;
+
+private:
+ void broadcast_thread ();
+ void listen_thread ();
+
+ /** A thread to periodically issue broadcasts to find encoding servers */
+ boost::thread* _broadcast_thread;
+ boost::thread* _listen_thread;
+
+ bool _terminate;
+ boost::mutex _mutex;
+};