From 172d5f932fdf7bee209b5b214cf14cf852443fc6 Mon Sep 17 00:00:00 2001 From: skyjake Date: Sat, 4 May 2013 13:33:34 +0300 Subject: [PATCH] Fixed|libshell: Catch exception from failed server discovery init If something is blocking network access, a Beacon::PortError exception is thrown during the ServerFinder constructor. Now the exception is caught and a warning is printed in the log. --- doomsday/libshell/src/serverfinder.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/doomsday/libshell/src/serverfinder.cpp b/doomsday/libshell/src/serverfinder.cpp index 7941c0c9d1..5afe8042e5 100644 --- a/doomsday/libshell/src/serverfinder.cpp +++ b/doomsday/libshell/src/serverfinder.cpp @@ -79,12 +79,19 @@ DENG2_PIMPL_NOREF(ServerFinder) ServerFinder::ServerFinder() : d(new Instance) { - qsrand(Time().asDateTime().toTime_t()); + try + { + qsrand(Time().asDateTime().toTime_t()); - connect(&d->beacon, SIGNAL(found(de::Address, de::Block)), this, SLOT(found(de::Address, de::Block))); - QTimer::singleShot(1000, this, SLOT(expire())); + connect(&d->beacon, SIGNAL(found(de::Address, de::Block)), this, SLOT(found(de::Address, de::Block))); + QTimer::singleShot(1000, this, SLOT(expire())); - d->beacon.discover(0 /* no timeout */, 2); + d->beacon.discover(0 /* no timeout */, 2); + } + catch(Beacon::PortError const &er) + { + LOG_WARNING("Automatic server discovery is not available:\n") << er.asText(); + } } ServerFinder::~ServerFinder()