- GOOSE subscriber example: added error handling when ethernet cannot be accessed

pull/179/head
Michael Zillgith 6 years ago
parent 9a97519815
commit ebb0f761d2

@ -69,7 +69,7 @@ main(int argc, char** argv)
GoosePublisher_destroy(publisher); GoosePublisher_destroy(publisher);
} }
else { else {
printf("Failed to create GOOSE publisher. Reason can be that the Ethernet interface doesn't exist or you need root permissions.\n"); printf("Failed to create GOOSE publisher. Reason can be that the Ethernet interface doesn't exist or root permission are required.\n");
} }
LinkedList_destroyDeep(dataSetValues, (LinkedListValueDeleteFunction) MmsValue_delete); LinkedList_destroyDeep(dataSetValues, (LinkedListValueDeleteFunction) MmsValue_delete);

@ -66,11 +66,16 @@ main(int argc, char** argv)
GooseReceiver_start(receiver); GooseReceiver_start(receiver);
if (GooseReceiver_isRunning(receiver)) {
signal(SIGINT, sigint_handler); signal(SIGINT, sigint_handler);
while (running) { while (running) {
Thread_sleep(100); Thread_sleep(100);
} }
}
else {
printf("Failed to start GOOSE subscriber. Reason can be that the Ethernet interface doesn't exist or root permission are required.\n");
}
GooseReceiver_stop(receiver); GooseReceiver_stop(receiver);

@ -844,7 +844,9 @@ GooseReceiver_stop(GooseReceiver self)
self->stop = true; self->stop = true;
self->running = false; self->running = false;
if (self->thread)
Thread_destroy(self->thread); Thread_destroy(self->thread);
self->stop = false; self->stop = false;
#endif #endif
} }

Loading…
Cancel
Save