mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
survive reboot
This commit is contained in:
parent
5709b96a4d
commit
899eae05f0
2 changed files with 15 additions and 3 deletions
|
@ -135,6 +135,7 @@ static void server_cb(struct uloop_fd *fd, unsigned int events) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int run_server(int port) {
|
int run_server(int port) {
|
||||||
|
printf("Adding socket!\n");
|
||||||
char port_str[12];
|
char port_str[12];
|
||||||
sprintf(port_str, "%d", port);
|
sprintf(port_str, "%d", port);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ void update_tcp_connections(struct uloop_timeout *t);
|
||||||
|
|
||||||
void update_channel_utilization(struct uloop_timeout *t);
|
void update_channel_utilization(struct uloop_timeout *t);
|
||||||
|
|
||||||
|
void run_server_update(struct uloop_timeout *t);
|
||||||
|
|
||||||
struct uloop_timeout client_timer = {
|
struct uloop_timeout client_timer = {
|
||||||
.cb = update_clients
|
.cb = update_clients
|
||||||
};
|
};
|
||||||
|
@ -53,6 +55,9 @@ struct uloop_timeout umdns_timer = {
|
||||||
struct uloop_timeout channel_utilization_timer = {
|
struct uloop_timeout channel_utilization_timer = {
|
||||||
.cb = update_channel_utilization
|
.cb = update_channel_utilization
|
||||||
};
|
};
|
||||||
|
struct uloop_timeout usock_timer = {
|
||||||
|
.cb = run_server_update
|
||||||
|
};
|
||||||
|
|
||||||
#define MAX_HOSTAPD_SOCKETS 10
|
#define MAX_HOSTAPD_SOCKETS 10
|
||||||
#define MAX_INTERFACE_NAME 64
|
#define MAX_INTERFACE_NAME 64
|
||||||
|
@ -669,14 +674,15 @@ int dawn_init_ubus(const char *ubus_socket, const char *hostapd_dir) {
|
||||||
|
|
||||||
uloop_timeout_add(&channel_utilization_timer);
|
uloop_timeout_add(&channel_utilization_timer);
|
||||||
|
|
||||||
ubus_call_umdns();
|
|
||||||
|
|
||||||
ubus_add_oject();
|
ubus_add_oject();
|
||||||
|
|
||||||
start_umdns_update();
|
start_umdns_update();
|
||||||
|
|
||||||
if (network_config.network_option == 2)
|
if (network_config.network_option == 2)
|
||||||
run_server(network_config.tcp_port);
|
{
|
||||||
|
if(run_server(network_config.tcp_port))
|
||||||
|
uloop_timeout_set(&usock_timer, 1 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
subscribe_to_new_interfaces(hostapd_dir_glob);
|
subscribe_to_new_interfaces(hostapd_dir_glob);
|
||||||
|
|
||||||
|
@ -919,6 +925,11 @@ void update_clients(struct uloop_timeout *t) {
|
||||||
uloop_timeout_set(&client_timer, timeout_config.update_client * 1000);
|
uloop_timeout_set(&client_timer, timeout_config.update_client * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void run_server_update(struct uloop_timeout *t) {
|
||||||
|
if(run_server(network_config.tcp_port))
|
||||||
|
uloop_timeout_set(&usock_timer, 1 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
void update_channel_utilization(struct uloop_timeout *t) {
|
void update_channel_utilization(struct uloop_timeout *t) {
|
||||||
struct hostapd_sock_entry *sub;
|
struct hostapd_sock_entry *sub;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue