Build fixes for Boost >= 1.73
[dcpomatic.git] / src / lib / encode_server_finder.cc
index 1837101b580a550fca5f53ba979c4882efd6eed1..ef199e8db6cb12b530fe947c057e0b2874ae3a3d 100644 (file)
@@ -27,6 +27,7 @@
 #include "dcpomatic_socket.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
+#include <boost/bind/placeholders.hpp>
 #include <boost/lambda/lambda.hpp>
 #include <iostream>
 
@@ -40,6 +41,9 @@ using boost::shared_ptr;
 using boost::scoped_array;
 using boost::weak_ptr;
 using boost::optional;
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
 using dcp::raw_convert;
 
 EncodeServerFinder* EncodeServerFinder::_instance = 0;
@@ -149,10 +153,10 @@ try
                }
 
                /* Discard servers that we haven't seen for a while */
+               bool removed = false;
                {
                        boost::mutex::scoped_lock lm (_servers_mutex);
 
-                       bool removed = false;
                        list<EncodeServerDescription>::iterator i = _servers.begin();
                        while (i != _servers.end()) {
                                if (i->last_seen_seconds() > 2 * interval) {
@@ -165,10 +169,10 @@ try
                                        ++i;
                                }
                        }
+               }
 
-                       if (removed) {
-                               emit (boost::bind (boost::ref (ServersListChanged)));
-                       }
+               if (removed) {
+                       emit (boost::bind (boost::ref (ServersListChanged)));
                }
 
                boost::mutex::scoped_lock lm (_search_condition_mutex);
@@ -236,8 +240,10 @@ EncodeServerFinder::handle_accept (boost::system::error_code ec, shared_ptr<Sock
                (*found)->set_seen ();
        } else {
                EncodeServerDescription sd (ip, xml->number_child<int>("Threads"), xml->optional_number_child<int>("Version").get_value_or(0));
-               boost::mutex::scoped_lock lm (_servers_mutex);
-               _servers.push_back (sd);
+               {
+                       boost::mutex::scoped_lock lm (_servers_mutex);
+                       _servers.push_back (sd);
+               }
                emit (boost::bind (boost::ref (ServersListChanged)));
        }