gluon-mesh-babel: respondd: Do not create neighbour watcher thread when unable to allocate memory for neighbour json
We don't need a thread parsing babeld if there is not enough memory to store the results. Print an error message in this case andcontinue without neighbour information in respondd data
This commit is contained in:
parent
005b8bd5f0
commit
ed191a2789
@ -477,10 +477,15 @@ __attribute__((constructor)) static void init(void) {
|
|||||||
|
|
||||||
model = gluonutil_read_line("/tmp/sysinfo/model");
|
model = gluonutil_read_line("/tmp/sysinfo/model");
|
||||||
|
|
||||||
|
if (neighbours) {
|
||||||
if (pthread_create(&babelmonitor, NULL, &babeld_monitor_thread_start, NULL) < 0 ) {
|
if (pthread_create(&babelmonitor, NULL, &babeld_monitor_thread_start, NULL) < 0 ) {
|
||||||
perror("error on pthread_create for babel monitor");
|
perror("error on pthread_create for babel monitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "Unable to allocate json object >neighbours< - not creating neighbour watcher thread. The neighbour structure will always be empty.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__((destructor)) static void deinit(void) {
|
__attribute__((destructor)) static void deinit(void) {
|
||||||
pthread_cancel(babelmonitor);
|
pthread_cancel(babelmonitor);
|
||||||
|
Loading…
Reference in New Issue
Block a user