summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/net/pvsServiceBroadcast.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/net/pvsServiceBroadcast.cpp b/src/net/pvsServiceBroadcast.cpp
index a861456..7ce7f12 100644
--- a/src/net/pvsServiceBroadcast.cpp
+++ b/src/net/pvsServiceBroadcast.cpp
@@ -28,14 +28,6 @@ PVSServiceBroadcast::PVSServiceBroadcast()
_announce = NULL;
_timer = 0;
_broadcaster.bind(SD_PORT_CONSOLE);
-
- foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces())
- foreach (QNetworkAddressEntry entry, interface.addressEntries())
- if (!entry.broadcast().isNull() && entry.broadcast().toString() != "127.255.255.255")
- _everyone.append(entry.broadcast());
-
- if (_everyone.isEmpty())
- qDebug("ERROR: No broadcast address found");
}
PVSServiceBroadcast::~PVSServiceBroadcast()
@@ -56,10 +48,20 @@ void PVSServiceBroadcast::setFingerprint(QByteArray sha1)
void PVSServiceBroadcast::timerEvent(QTimerEvent *event)
{
+ foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces())
+ foreach (QNetworkAddressEntry entry, interface.addressEntries())
+ if (!entry.broadcast().isNull() && entry.broadcast().toString() != "127.255.255.255")
+ _everyone.append(entry.broadcast());
+
+ if (_everyone.isEmpty())
+ qDebug("ERROR: No broadcast address found");
+
if (_announce == NULL) return;
foreach (QHostAddress bcast, _everyone)
{
qDebug("DEBUG: Broadcasting to %s:%i", qPrintable(bcast.toString()),SD_PORT_CLIENT);
_broadcaster.writeDatagram(*_announce, bcast, SD_PORT_CLIENT);
}
+
+ _everyone.clear();
}