X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fivac.git;a=blobdiff_plain;f=src%2Fivac.c;h=70d1a35c234809708086d60c423e6a2c9c68b587;hp=062fc56eb08f26ef05f335f7bc199b6ee37900b5;hb=8a6fa2a921c79c007f3203aab1388fe2f0620eda;hpb=0bc14060d26317692d960c39e7e64b74d8963e61 diff --git a/src/ivac.c b/src/ivac.c index 062fc56..70d1a35 100644 --- a/src/ivac.c +++ b/src/ivac.c @@ -52,7 +52,9 @@ int main(int argc,char **argv) { /* 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; } @@ -66,9 +68,16 @@ int main(int argc,char **argv) { /* 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; }