projects
/
project
/
procd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
register the system namespace on ubus regardless of the pid
[project/procd.git]
/
ubus.c
diff --git
a/ubus.c
b/ubus.c
index
e87543a
..
202646a
100644
(file)
--- a/
ubus.c
+++ b/
ubus.c
@@
-23,6
+23,7
@@
char *ubus_socket = NULL;
static struct ubus_context *ctx;
static struct uloop_process ubus_proc;
static bool ubus_connected = false;
static struct ubus_context *ctx;
static struct uloop_process ubus_proc;
static bool ubus_connected = false;
+static int reconnect = 1;
static void procd_ubus_connection_lost(struct ubus_context *old_ctx);
static void procd_ubus_connection_lost(struct ubus_context *old_ctx);
@@
-76,14
+77,16
@@
static void procd_ubus_try_connect(void)
ctx->connection_lost = procd_ubus_connection_lost;
ubus_connected = true;
ubus_init_service(ctx);
ctx->connection_lost = procd_ubus_connection_lost;
ubus_connected = true;
ubus_init_service(ctx);
- if (getpid() == 1) {
+ ubus_init_system(ctx);
+ if (getpid() == 1)
ubus_init_log(ctx);
ubus_init_log(ctx);
- ubus_init_system(ctx);
- }
}
static void procd_ubus_connection_lost(struct ubus_context *old_ctx)
{
}
static void procd_ubus_connection_lost(struct ubus_context *old_ctx)
{
+ if (!reconnect)
+ return;
+
procd_ubus_try_connect();
while (!ubus_connected) {
procd_restart_ubus();
procd_ubus_try_connect();
while (!ubus_connected) {
procd_restart_ubus();
@@
-101,3
+104,8
@@
void procd_connect_ubus(void)
procd_ubus_connection_lost(NULL);
}
procd_ubus_connection_lost(NULL);
}
+void procd_reconnect_ubus(int _reconnect)
+{
+ reconnect = _reconnect;
+}
+