/* network init */
if(network_init(&(ivac.net))==N_ERROR) {
- printf("[ivac] use 'fuser -n tcp %d' to kill that process",ivac.net.l_port);
+ printf("[ivac] use 'fuser -n tcp %d' to determine the process to kill!\n",
+ ivac.net.l_port);
+ ivac_shutdown(&ivac);
return ERROR;
}
/* start event system - callbacks used: ivac_event_cb + ivac_regular_cb */
event_start(&(ivac.event),(void *)&ivac,ivac_event_cb,ivac_regular_cb);
- network_shutdown(&(ivac.net));
+ ivac_shutdown(&ivac);
- input_shutdown(&(ivac.input));
+ return SUCCESS;
+}
+
+int ivac_shutdown(t_ivac *ivac) {
+
+ network_shutdown(&(ivac->net));
+ input_shutdown(&(ivac->input));
+ event_stop(&(ivac->event));
return SUCCESS;
}
#define _GNU_SOURCE
#include <stdio.h>
+/* for ui */
+#include <ncurses.h>
+
#include "network.h"
#include "event.h"
#include "input.h"
} t_ivac;
/* function prototypes */
+int ivac_shutdown(t_ivac *ivac);
int ivac_send_info(int channel,t_ivac *ivac);
int ivac_receive_info(int channel,t_ivac *ivac);
int ivac_event_cb(t_event *event,void *ptr);