bsnmpd: Only refresh devtree if devd event is a new or removed device.

It makes sense to refresh the tree only when a device is inserted or
removed, otherwise bsnmpd wastes lot of CPU.

PR:		209368
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2017-10-28 21:26:49 +00:00
parent 0f23ab8aac
commit 7e7315b542

View File

@ -479,7 +479,9 @@ devd_socket_callback(int fd, void *arg __unused)
} else {
if (read_len == sizeof(buf))
goto again;
refresh_device_tbl(1);
/* Only refresh device table on a device add or remove event. */
if (buf[0] == '+' || buf[0] == '-')
refresh_device_tbl(1);
}
}