Skip to content

Commit

Permalink
Fixed|libshell: Catch exception from failed server discovery init
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
skyjake committed May 4, 2013
1 parent 5e775dc commit 172d5f9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions doomsday/libshell/src/serverfinder.cpp
Expand Up @@ -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()
Expand Down

0 comments on commit 172d5f9

Please sign in to comment.