disable autostart pibroadcast
This commit is contained in:
@@ -53,8 +53,6 @@ PIBroadcast::PIBroadcast(bool send_only): PIThread(), PIEthUtilBase() {
|
|||||||
_started = false;
|
_started = false;
|
||||||
_send_only = send_only;
|
_send_only = send_only;
|
||||||
_reinit = true;
|
_reinit = true;
|
||||||
//initMcast(PIEthernet::allAddresses());
|
|
||||||
PIThread::start(3000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -140,7 +138,6 @@ void PIBroadcast::initAll(PIVector<PIEthernet::Address> al) {
|
|||||||
piForeachC (PIEthernet::Address & a, al) {
|
piForeachC (PIEthernet::Address & a, al) {
|
||||||
PIEthernet * ce = 0;
|
PIEthernet * ce = 0;
|
||||||
//piCout << "mcast try" << a;
|
//piCout << "mcast try" << a;
|
||||||
|
|
||||||
if (_channels[Multicast]) {
|
if (_channels[Multicast]) {
|
||||||
ce = new PIEthernet();
|
ce = new PIEthernet();
|
||||||
ce->setDebug(false);
|
ce->setDebug(false);
|
||||||
@@ -184,7 +181,6 @@ void PIBroadcast::initAll(PIVector<PIEthernet::Address> al) {
|
|||||||
eth_mcast << ce;
|
eth_mcast << ce;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_channels[Loopback]) {
|
if (_channels[Loopback]) {
|
||||||
@@ -210,8 +206,7 @@ void PIBroadcast::send(const PIByteArray & data) {
|
|||||||
PIByteArray cd = cryptData(data);
|
PIByteArray cd = cryptData(data);
|
||||||
if (cd.isEmpty()) return;
|
if (cd.isEmpty()) return;
|
||||||
PIMutexLocker ml(mcast_mutex);
|
PIMutexLocker ml(mcast_mutex);
|
||||||
piForeach (PIEthernet * e, eth_mcast)
|
piForeach (PIEthernet * e, eth_mcast) e->send(cd);
|
||||||
e->send(cd);
|
|
||||||
if (eth_lo) {
|
if (eth_lo) {
|
||||||
for (int i = 0; i < lo_pcnt; ++i) {
|
for (int i = 0; i < lo_pcnt; ++i) {
|
||||||
eth_lo->send("127.0.0.1", lo_port + i, cd);
|
eth_lo->send("127.0.0.1", lo_port + i, cd);
|
||||||
@@ -221,30 +216,30 @@ void PIBroadcast::send(const PIByteArray & data) {
|
|||||||
|
|
||||||
|
|
||||||
void PIBroadcast::startRead() {
|
void PIBroadcast::startRead() {
|
||||||
|
if (!isRunning()) {
|
||||||
|
reinit();
|
||||||
|
PIThread::start(3000);
|
||||||
|
}
|
||||||
if (_send_only) return;
|
if (_send_only) return;
|
||||||
PIMutexLocker ml(mcast_mutex);
|
PIMutexLocker ml(mcast_mutex);
|
||||||
piForeach (PIEthernet * e, eth_mcast)
|
piForeach (PIEthernet * e, eth_mcast) e->startThreadedRead();
|
||||||
e->startThreadedRead();
|
if (eth_lo) eth_lo->startThreadedRead();
|
||||||
if (eth_lo)
|
|
||||||
eth_lo->startThreadedRead();
|
|
||||||
_started = true;
|
_started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIBroadcast::stopRead() {
|
void PIBroadcast::stopRead() {
|
||||||
|
if (isRunning()) stop();
|
||||||
PIMutexLocker ml(mcast_mutex);
|
PIMutexLocker ml(mcast_mutex);
|
||||||
piForeach (PIEthernet * e, eth_mcast)
|
piForeach (PIEthernet * e, eth_mcast) e->stopThreadedRead();
|
||||||
e->stopThreadedRead();
|
if (eth_lo) eth_lo->stopThreadedRead();
|
||||||
if (eth_lo)
|
|
||||||
eth_lo->stopThreadedRead();
|
|
||||||
_started = false;
|
_started = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PIBroadcast::reinit() {
|
void PIBroadcast::reinit() {
|
||||||
initAll(PIEthernet::allAddresses());
|
initAll(PIEthernet::allAddresses());
|
||||||
if (_started)
|
if (_started) startRead();
|
||||||
startRead();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -261,8 +256,6 @@ void PIBroadcast::run() {
|
|||||||
mcast_mutex.lock();
|
mcast_mutex.lock();
|
||||||
bool r = _reinit, ac = (al != prev_al);
|
bool r = _reinit, ac = (al != prev_al);
|
||||||
mcast_mutex.unlock();
|
mcast_mutex.unlock();
|
||||||
if (ac || r)
|
if (ac || r) reinit();
|
||||||
reinit();
|
if (ac) addressesChanged();
|
||||||
if (ac)
|
|
||||||
addressesChanged();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -993,6 +993,7 @@ void PIEthernet::configureFromVariantDevice(const PIPropertyStorage & d) {
|
|||||||
|
|
||||||
|
|
||||||
PIEthernet::InterfaceList PIEthernet::interfaces() {
|
PIEthernet::InterfaceList PIEthernet::interfaces() {
|
||||||
|
//piCout << "PIEthernet::interfaces()";
|
||||||
PIEthernet::InterfaceList il;
|
PIEthernet::InterfaceList il;
|
||||||
Interface ci;
|
Interface ci;
|
||||||
ci.index = -1;
|
ci.index = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user