if (!svr)
return NULL;
- svr->name = strdup(name);
- if (!svr->name)
- goto error;
-
+ ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
+ svr->fd = -1;
svr->start_time = ecore_time_get();
svr->type = compl_type;
svr->port = port;
svr->client_limit = -1;
svr->clients = NULL;
svr->ppid = getpid();
+
+ svr->name = strdup(name);
+ if (!svr->name)
+ goto error;
+
if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL))
goto error;
goto error;
servers = eina_list_append(servers, svr);
- ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
return svr;
error:
- if (svr->name)
- free(svr->name);
-
- if (svr->path)
- free(svr->path);
-
- if (svr->fd_handler)
- ecore_main_fd_handler_del(svr->fd_handler);
-
- if (svr->fd > 0)
- close(svr->fd);
-
- if (svr->buf)
- eina_binbuf_free(svr->buf);
-
- if (svr->ip)
- eina_stringshare_del(svr->ip);
-
- ecore_con_ssl_server_shutdown(svr);
- free(svr);
+ if (svr->delete_me) return NULL;
+ _ecore_con_server_kill(svr);
return NULL;
}
if (!svr)
return NULL;
- svr->name = strdup(name);
- if (!svr->name)
- goto error;
-
+ ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
+ svr->fd = -1;
svr->type = compl_type;
svr->port = port;
svr->data = (void *)data;
svr->clients = NULL;
svr->client_limit = -1;
+ svr->name = strdup(name);
+ if (!svr->name)
+ goto error;
+
type = compl_type & ECORE_CON_TYPE;
if ((!svr->disable_proxy) && (type > ECORE_CON_LOCAL_ABSTRACT))
EINA_SAFETY_ON_FALSE_GOTO(ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, svr), error);
servers = eina_list_append(servers, svr);
- ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER);
return svr;
error:
- if (svr->name)
- free(svr->name);
-
- if (svr->path)
- free(svr->path);
-
- if (svr->fd_handler)
- ecore_main_fd_handler_del(svr->fd_handler);
-
- if (svr->fd > 0)
- close(svr->fd);
-
- ecore_con_ssl_server_shutdown(svr);
- free(svr);
+ if (svr->delete_me) return NULL;
+ _ecore_con_server_kill(svr);
return NULL;
}
if (svr->fd_handler)
ecore_main_fd_handler_del(svr->fd_handler);
- if (svr->fd > 0)
+ if (svr->fd >= 0)
close(svr->fd);
if (svr->until_deletion)
if (cl->fd_handler)
ecore_main_fd_handler_del(cl->fd_handler);
- if (cl->fd > 0)
+ if (cl->fd >= 0)
close(cl->fd);
free(cl->client_addr);