diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-10-21 19:59:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-10-21 19:59:16 +0100 |
| commit | 4b06a77805ea3fd7bc0829d8096f87b341c77832 (patch) | |
| tree | a2cdd85a05654b6513ab50674ba20b637cf4e5d4 /src/lib/server_finder.cc | |
| parent | ab97d9da855060accb12c15073f507b26874eb90 (diff) | |
Nicer exception when we fail to listen for remote encode servers because some other DCP-o-matic is already at it.
Diffstat (limited to 'src/lib/server_finder.cc')
| -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 637103591..35ce9e1a1 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 |
