summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-18 14:18:38 -0200
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-11-18 14:21:21 -0200
commitd6584673ea3def020d05cc29762d1924ffb77712 (patch)
tree8adeddfc830dbd63a4fbbf36c49bf35c492fa1dc
parentdc3da201fd3cbc8b681be5c78a359da897df20de (diff)
ecore_con (legacy) fix close()->closesocket() and valid fd check.
use the windows version and it will also work on UNIX due macros.
-rw-r--r--src/lib/ecore_con/ecore_con.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index b2b1969896..7b613715cc 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -416,7 +416,7 @@ _efl_network_server_efl_object_constructor(Ecore_Con_Server *obj, Efl_Network_Se
416{ 416{
417 obj = efl_constructor(efl_super(obj, EFL_NETWORK_SERVER_CLASS)); 417 obj = efl_constructor(efl_super(obj, EFL_NETWORK_SERVER_CLASS));
418 418
419 svr->fd = -1; 419 svr->fd = INVALID_SOCKET;
420 svr->reject_excess_clients = EINA_FALSE; 420 svr->reject_excess_clients = EINA_FALSE;
421 svr->client_limit = -1; 421 svr->client_limit = -1;
422 svr->clients = NULL; 422 svr->clients = NULL;
@@ -742,7 +742,7 @@ _efl_network_server_efl_network_send(Eo *obj EINA_UNUSED, Efl_Network_Server_Dat
742 svr->buf = eina_binbuf_new(); 742 svr->buf = eina_binbuf_new();
743 EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0); 743 EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0);
744#ifdef TCP_CORK 744#ifdef TCP_CORK
745 if ((svr->fd >= 0) && ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)) 745 if ((svr->fd != INVALID_SOCKET) && ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
746 { 746 {
747 int state = 1; 747 int state = 1;
748 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0) 748 if (setsockopt(svr->fd, IPPROTO_TCP, TCP_CORK, (char *)&state, sizeof(int)) < 0)
@@ -867,7 +867,7 @@ _efl_network_client_efl_network_send(Eo *obj EINA_UNUSED, Efl_Network_Client_Dat
867 cl->buf = eina_binbuf_new(); 867 cl->buf = eina_binbuf_new();
868 EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0); 868 EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0);
869#ifdef TCP_CORK 869#ifdef TCP_CORK
870 if ((cl->fd >= 0) && (host_server) && 870 if ((cl->fd != INVALID_SOCKET) && (host_server) &&
871 ((host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK)) 871 ((host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_CORK))
872 { 872 {
873 int state = 1; 873 int state = 1;
@@ -1409,8 +1409,8 @@ _efl_network_server_efl_object_destructor(Eo *obj, Efl_Network_Server_Data *svr)
1409 if (svr->fd_handler) 1409 if (svr->fd_handler)
1410 ecore_main_fd_handler_del(svr->fd_handler); 1410 ecore_main_fd_handler_del(svr->fd_handler);
1411 1411
1412 if (svr->fd >= 0) 1412 if (svr->fd != INVALID_SOCKET)
1413 close(svr->fd); 1413 closesocket(svr->fd);
1414 1414
1415 if (svr->until_deletion) 1415 if (svr->until_deletion)
1416 ecore_timer_del(svr->until_deletion); 1416 ecore_timer_del(svr->until_deletion);
@@ -1472,8 +1472,8 @@ _efl_network_client_efl_object_destructor(Eo *obj, Efl_Network_Client_Data *cl)
1472 if (cl->fd_handler) 1472 if (cl->fd_handler)
1473 ecore_main_fd_handler_del(cl->fd_handler); 1473 ecore_main_fd_handler_del(cl->fd_handler);
1474 1474
1475 if (cl->fd >= 0) 1475 if (cl->fd != INVALID_SOCKET)
1476 close(cl->fd); 1476 closesocket(cl->fd);
1477 1477
1478 free(cl->client_addr); 1478 free(cl->client_addr);
1479 cl->client_addr = NULL; 1479 cl->client_addr = NULL;
@@ -2165,7 +2165,7 @@ _ecore_con_svr_tcp_handler(void *data,
2165 2165
2166error: 2166error:
2167 if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler); 2167 if (cl->fd_handler) ecore_main_fd_handler_del(cl->fd_handler);
2168 if (cl->fd >= 0) close(cl->fd); 2168 if (cl->fd != INVALID_SOCKET) closesocket(cl->fd);
2169 { 2169 {
2170 Ecore_Event *ev; 2170 Ecore_Event *ev;
2171 2171
@@ -2384,7 +2384,7 @@ _ecore_con_svr_udp_handler(void *data,
2384 EINA_SAFETY_ON_NULL_RETURN_VAL(cl, ECORE_CALLBACK_RENEW); 2384 EINA_SAFETY_ON_NULL_RETURN_VAL(cl, ECORE_CALLBACK_RENEW);
2385 2385
2386 cl->host_server = svr_obj; 2386 cl->host_server = svr_obj;
2387 cl->fd = -1; 2387 cl->fd = INVALID_SOCKET;
2388 cl->client_addr = malloc(client_addr_len); 2388 cl->client_addr = malloc(client_addr_len);
2389 if (!cl->client_addr) 2389 if (!cl->client_addr)
2390 { 2390 {