diff options
Diffstat (limited to 'src/espik_net.c')
-rw-r--r-- | src/espik_net.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/espik_net.c b/src/espik_net.c index 679ee04..d56f070 100644 --- a/src/espik_net.c +++ b/src/espik_net.c @@ -16,21 +16,12 @@ typedef int (*Handler_Func) (void* data, int ev_type, void* ev); -static int ret; /* For debug */ +static int ret_int; /* For debug */ char connected = 0; Ecore_Con_Server* con_sock; -typedef struct -{ - Ecore_Event_Handler* data; - Ecore_Event_Handler* up; - Ecore_Event_Handler* down; - -} espik_con_handler_list; - - -espik_con_handler_list handler_list; +Ecore_Event_Handler* ret; void espik_con_init (t_info serv_info) { @@ -54,30 +45,35 @@ void espik_con_init (t_info serv_info) "(ECORE_CON_REMOTE_SYSTEM)"); exit (-1); } + espik_free (con_sock); - if (! (handler_list.data = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA, + if (! (ret = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA, (Handler_Func) server_data, NULL))) { espik_debug_print ("ecore_event_handler_add " "(ECORE_CON_EVENT_SERVER_DATA)"); exit (-1); } + espik_free (ret); - if (! (handler_list.up = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD, + if (! (ret = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_ADD, (Handler_Func) espik_con_up, NULL))) { espik_debug_print ("ecore_event_handler_add " "(ECORE_CON_EVENT_SERVER_ADD)"); exit (-1); } + espik_free (ret); - if (! (handler_list.down = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL, + if (! (ret = ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DEL, (Handler_Func) espik_con_shutdown, NULL))) { espik_debug_print ("ecore_event_handler_add " "(ECORE_CON_EVENT_SERVER_DEL)"); exit (-1); } + espik_free (ret); + espik_leave(); } @@ -136,12 +132,14 @@ void espik_con_shutdown () ecore_con_shutdown (); + /* ecore_event_handler_del (handler_list.data); ecore_event_handler_del (handler_list.up); ecore_event_handler_del (handler_list.down); + */ ecore_main_loop_quit (); - free (server_dns); + espik_free (server_dns); espik_leave(); } @@ -174,9 +172,9 @@ void espik_raw_send (const char *msg) } - ret = ecore_con_server_send (con_sock, buf.buf, buf.len); + ret_int = ecore_con_server_send (con_sock, buf.buf, buf.len); - espik_debug_print ("ret: %d", ret); + espik_debug_print ("ret_int: %d", ret_int); free (buf.buf); // free (msg); espik_leave(); |