mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
clean up code
This commit is contained in:
parent
13e594287d
commit
e00e11b728
3 changed files with 3 additions and 78 deletions
|
@ -22,8 +22,6 @@ void del_client_all_interfaces(const uint8_t *client_addr, uint32_t reason, uint
|
|||
|
||||
void *update_clients_thread(void *arg);
|
||||
|
||||
void *kick_clients_thread(void *arg);
|
||||
|
||||
char *hostapd_dir_glob;
|
||||
|
||||
int ubus_call_umdns();
|
||||
|
|
55
src/main.c
55
src/main.c
|
@ -36,8 +36,6 @@ void signal_handler(int sig);
|
|||
|
||||
struct sigaction newSigAction;
|
||||
|
||||
//int free_counter = 0;
|
||||
|
||||
pthread_t tid_probe;
|
||||
pthread_t tid_client;
|
||||
pthread_t tid_get_client;
|
||||
|
@ -46,13 +44,13 @@ pthread_t tid_kick_clients;
|
|||
pthread_t tid_ap;
|
||||
|
||||
void daemon_shutdown() {
|
||||
|
||||
// kill threads
|
||||
printf("Cancelling Threads!\n");
|
||||
pthread_cancel(tid_probe);
|
||||
//pthread_cancel(tid_client);
|
||||
pthread_cancel(tid_client);
|
||||
pthread_cancel(tid_get_client);
|
||||
//pthread_cancel(tid_kick_clients);
|
||||
//pthread_cancel(tid_ap);
|
||||
pthread_cancel(tid_update_hostapd_socks);
|
||||
|
||||
// free ressources
|
||||
printf("Freeing mutex ressources\n");
|
||||
|
@ -83,46 +81,6 @@ void signal_handler(int sig) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
static void mtrace_init(void)
|
||||
{
|
||||
real_malloc = dlsym(RTLD_NEXT, "malloc");
|
||||
if (NULL == real_malloc) {
|
||||
fprintf(stderr, "Error in `dlsym`: %s\n", dlerror());
|
||||
}
|
||||
real_free = dlsym(RTLD_NEXT, "free");
|
||||
if (NULL == real_free) {
|
||||
fprintf(stderr, "Error in `dlsym`: %s\n", dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
void *malloc(size_t size)
|
||||
{
|
||||
mtrace_init();
|
||||
if(real_malloc==NULL) {
|
||||
mtrace_init();
|
||||
}
|
||||
|
||||
void *p = NULL;
|
||||
fprintf(stderr, "malloc(%d) = ", size);
|
||||
p = real_malloc(size);
|
||||
fprintf(stderr, "%p\n", p);
|
||||
free_counter++;
|
||||
return p;
|
||||
}
|
||||
|
||||
void free(void *p)
|
||||
{
|
||||
mtrace_init();
|
||||
if(real_free==NULL) {
|
||||
mtrace_init();
|
||||
}
|
||||
p = real_free(p);
|
||||
fprintf(stderr, "free: ");
|
||||
fprintf(stderr, "%p\n", p);
|
||||
free_counter--;
|
||||
}*/
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
//free_counter = 0;
|
||||
|
||||
|
@ -217,14 +175,7 @@ int main(int argc, char **argv) {
|
|||
pthread_create(&tid_get_client, NULL, &update_clients_thread, (void *) &time_config.update_client);
|
||||
pthread_create(&tid_update_hostapd_socks, NULL, &update_hostapd_sockets, &time_config.update_hostapd);
|
||||
|
||||
|
||||
//pthread_create(&tid_kick_clients, NULL, &kick_clients_thread, NULL);
|
||||
//pthread_create(&tid_ap, NULL, &remove_ap_array_thread, NULL);
|
||||
|
||||
//pthread_create(&tid, NULL, &remove_thread, NULL);
|
||||
|
||||
dawn_init_ubus(ubus_socket, opt_hostapd_dir);
|
||||
//free_list(probe_list_head);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -534,8 +534,6 @@ dump_client_table(struct blob_attr *head, int len, const char *bssid_addr, uint3
|
|||
int parse_to_clients(struct blob_attr *msg, int do_kick, uint32_t id) {
|
||||
struct blob_attr *tb[__CLIENT_TABLE_MAX];
|
||||
|
||||
//printf("[CLIENTS] : Parse Clients\n");
|
||||
|
||||
blobmsg_parse(client_table_policy, __CLIENT_TABLE_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (tb[CLIENT_TABLE] && tb[CLIENT_TABLE_BSSID] && tb[CLIENT_TABLE_FREQ] && tb[CLIENT_TABLE_HT] &&
|
||||
|
@ -595,28 +593,6 @@ void *update_clients_thread(void *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *kick_clients_thread(void *arg) {
|
||||
while (1) {
|
||||
sleep(TIME_THRESHOLD_CLIENT_KICK);
|
||||
printf("[Thread] : Updating clients!\n");
|
||||
// a4:2b:b0:de:f1:fd
|
||||
// a4:2b:b0:de:f1:fe
|
||||
/*
|
||||
int tmp_int_mac[ETH_ALEN];
|
||||
uint8_t tmp_mac[ETH_ALEN];
|
||||
sscanf("a4:2b:b0:de:f1:fd", MACSTR, STR2MAC(tmp_int_mac));
|
||||
for(int i = 0; i < ETH_ALEN; ++i )
|
||||
tmp_mac[i] = (uint8_t) tmp_int_mac[i];
|
||||
//kick_clients(tmp_mac);
|
||||
|
||||
sscanf("a4:2b:b0:de:f1:fe", MACSTR, STR2MAC(tmp_int_mac));
|
||||
for(int i = 0; i < ETH_ALEN; ++i )
|
||||
tmp_mac[i] = (uint8_t) tmp_int_mac[i];*/
|
||||
//kick_clients(tmp_mac);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *update_hostapd_sockets(void *arg) {
|
||||
time_t time_update_hostapd = *(time_t *) arg;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue