diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | client_list.c | 1 | ||||
-rw-r--r-- | rhdropbox.c | 44 |
3 files changed, 4 insertions, 42 deletions
@@ -28,7 +28,6 @@ EXECUTABLE := rhdropbox OBJ := log.o \ sig_handler.o \ string_list.o \ - key_value_storage.o \ utils.o \ command_queue.o \ client_list.o \ diff --git a/client_list.c b/client_list.c index 5aea541..8379dd9 100644 --- a/client_list.c +++ b/client_list.c @@ -46,7 +46,6 @@ int client_add(client_t** first, int fd) return -2; new_client->fd = fd; - new_client->type = DEFAULT; new_client->status_listener = 0; new_client->request_listener = 0; new_client->next = NULL; diff --git a/rhdropbox.c b/rhdropbox.c index f09d96b..f5de265 100644 --- a/rhdropbox.c +++ b/rhdropbox.c @@ -32,7 +32,6 @@ #include "command_queue.h" #include "client_list.h" -#include "key_value_storage.h" #include "daemon.h" #include "utils.h" @@ -146,7 +145,7 @@ int process_cmd(const char* cmd, int fd, cmd_t **cmd_q, client_t* client_lst, op switch(cmd_id) { case ADD: break; case REMOVE: break; - case STATUS: break + case STATUS: break; case LOG: { if(param && param[0]) log_printf(NOTICE, "ext msg: %s", param); @@ -160,15 +159,14 @@ int process_cmd(const char* cmd, int fd, cmd_t **cmd_q, client_t* client_lst, op return 0; } -int main_loop(int switch_fd, int cmd_listen_fd, options_t* opt) +int main_loop(int cmd_listen_fd, options_t* opt) { log_printf(NOTICE, "entering main loop"); fd_set readfds, tmpfds; FD_ZERO(&readfds); - FD_SET(switch_fd, &readfds); FD_SET(cmd_listen_fd, &readfds); - int max_fd = switch_fd > cmd_listen_fd ? switch_fd : cmd_listen_fd; + int max_fd = cmd_listen_fd; cmd_t* cmd_q = NULL; client_t* client_lst = NULL; @@ -182,28 +180,6 @@ int main_loop(int switch_fd, int cmd_listen_fd, options_t* opt) max_fd = (max_fd < sig_fd) ? sig_fd : max_fd; int return_value = 0; - - char* channel; - if(opt->mode_ == MODE_MASTER && opt->channel_ == CHAN_MAIN) channel = "master_main"; - else if(opt->mode_ == MODE_MASTER && opt->channel_ == CHAN_MUSIC) channel = "master_music"; - else if(opt->mode_ == MODE_STANDBY && opt->channel_ == CHAN_MAIN) channel = "standby_main"; - else if(opt->mode_ == MODE_STANDBY && opt->channel_ == CHAN_MUSIC) channel = "standby_music"; - - char* cmd_param = strdup("*0M1*0ii1"); - char* ch_nr = key_value_storage_find(&opt->alias_table_, channel); - if(!ch_nr || ch_nr[0] == 0 || ch_nr[1] == 0 || ch_nr[2] != 0) { - log_printf(ERROR, "invalid channel name or number: %s", channel); - free(cmd_param); - return_value = -1; - } - else { - cmd_param[6] = ch_nr[0]; - cmd_param[7] = ch_nr[1]; - return_value = cmd_push(&cmd_q, -1, SWITCH, cmd_param); - free(cmd_param); - send_command(switch_fd, cmd_q); - } - struct timeval timeout; while(!return_value) { memcpy(&tmpfds, &readfds, sizeof(tmpfds)); @@ -234,12 +210,6 @@ int main_loop(int switch_fd, int cmd_listen_fd, options_t* opt) } } - if(FD_ISSET(switch_fd, &tmpfds)) { - return_value = process_switch(&switch_buffer, switch_fd, &cmd_q, client_lst); - if(return_value) - break; - } - if(FD_ISSET(cmd_listen_fd, &tmpfds)) { int new_fd = accept(cmd_listen_fd, NULL, NULL); if(new_fd < 0) { @@ -273,9 +243,6 @@ int main_loop(int switch_fd, int cmd_listen_fd, options_t* opt) } lst = lst->next; } - - if(cmd_q && !cmd_q->sent) - send_command(switch_fd, cmd_q); } cmd_clear(&cmd_q); @@ -391,11 +358,8 @@ int main(int argc, char* argv[]) exit(-1); } - ret = main_loop(switch_fd, cmd_listen_fd, &opt); - + ret = main_loop(cmd_listen_fd, &opt); close(cmd_listen_fd); - if(switch_fd > 0) - close(switch_fd); if(!ret) log_printf(NOTICE, "normal shutdown"); |