diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-21 20:00:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-21 20:00:56 +0100 |
| commit | f8607d7950013d26b33be022bd4d06acb5807cd0 (patch) | |
| tree | 092f4a50df42d8b5f8050335fde5ce3b674a6b58 /src/lib | |
| parent | e8859c11a407ac167045fbb3b9a9296de688ca7a (diff) | |
Nicer exception when we fail to listen for remote encode servers because some other DCP-o-matic is already at it (backport from 2.0).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/server_finder.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/server_finder.cc b/src/lib/server_finder.cc index a082f3bab..f034f46f6 100644 --- a/src/lib/server_finder.cc +++ b/src/lib/server_finder.cc @@ -26,6 +26,8 @@ #include "cross.h" #include "ui_signaller.h" +#include "i18n.h" + using std::string; using std::list; using std::vector; @@ -105,11 +107,16 @@ try using namespace boost::asio::ip; boost::asio::io_service io_service; - tcp::acceptor acceptor (io_service, tcp::endpoint (tcp::v4(), Config::instance()->server_port_base() + 1)); + boost::scoped_ptr<tcp::acceptor> acceptor; + try { + acceptor.reset (new tcp::acceptor (io_service, tcp::endpoint (tcp::v4(), Config::instance()->server_port_base() + 1))); + } catch (...) { + boost::throw_exception (NetworkError (_("Could not listen for remote encode servers. Perhaps another instance of DCP-o-matic is running."))); + } while (true) { tcp::socket socket (io_service); - acceptor.accept (socket); + acceptor->accept (socket); /* XXX: these reads should have timeouts, otherwise we will stop finding servers if one dies during this conversation |
