forked from enlightenment/efl
efl_net_*: improve WIN32.
Thanks to vtorri for poiting out about close() is not the correct socket function, we should use closesocket() instead. Also defined SOCKET to int on Linux so we can use the same 'type' and avoid lots of ifdef in our code. On Windows it's unsigned, thus would cause some warnings about incorrect signed comparison.
This commit is contained in:
parent
a06c9f96aa
commit
cddbce8900
|
@ -3119,16 +3119,16 @@ efl_net_ip_port_split(char *buf, const char **p_host, const char **p_port)
|
|||
static void
|
||||
_cleanup_close(void *data)
|
||||
{
|
||||
int *p_fd = data;
|
||||
int fd = *p_fd;
|
||||
SOCKET *p_fd = data;
|
||||
SOCKET fd = *p_fd;
|
||||
*p_fd = INVALID_SOCKET;
|
||||
if (fd != INVALID_SOCKET) close(fd);
|
||||
if (fd != INVALID_SOCKET) closesocket(fd);
|
||||
}
|
||||
|
||||
int
|
||||
SOCKET
|
||||
efl_net_socket4(int domain, int type, int protocol, Eina_Bool close_on_exec)
|
||||
{
|
||||
int fd = INVALID_SOCKET;
|
||||
SOCKET fd = INVALID_SOCKET;
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
if (close_on_exec) type |= SOCK_CLOEXEC;
|
||||
|
@ -3145,7 +3145,7 @@ efl_net_socket4(int domain, int type, int protocol, Eina_Bool close_on_exec)
|
|||
{
|
||||
int errno_bkp = errno;
|
||||
ERR("fcntl(%d, F_SETFD, FD_CLOEXEC): %s", fd, strerror(errno));
|
||||
close(fd);
|
||||
closesocket(fd);
|
||||
fd = INVALID_SOCKET;
|
||||
errno = errno_bkp;
|
||||
}
|
||||
|
@ -3283,7 +3283,7 @@ typedef struct _Efl_Net_Connect_Async_Data
|
|||
Eina_Bool close_on_exec;
|
||||
int type;
|
||||
int protocol;
|
||||
int sockfd;
|
||||
SOCKET sockfd;
|
||||
Eina_Error error;
|
||||
struct sockaddr addr[];
|
||||
} Efl_Net_Connect_Async_Data;
|
||||
|
@ -3335,14 +3335,14 @@ _efl_net_connect_async_run(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
r = connect(d->sockfd, d->addr, d->addrlen);
|
||||
if (r != 0)
|
||||
{
|
||||
int fd = d->sockfd;
|
||||
SOCKET fd = d->sockfd;
|
||||
d->error = efl_net_socket_error_get();
|
||||
d->sockfd = INVALID_SOCKET;
|
||||
/* close() is a cancellation point, thus unset sockfd before
|
||||
* closing, so the main thread _efl_net_connect_async_cancel()
|
||||
* won't close it again.
|
||||
*/
|
||||
close(fd);
|
||||
closesocket(fd);
|
||||
DBG("connect(%d, %s) failed: %s", fd, buf, eina_error_msg_get(d->error));
|
||||
return;
|
||||
}
|
||||
|
@ -3370,7 +3370,7 @@ _efl_net_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
{
|
||||
d->error = errno;
|
||||
ERR("fcntl(%d, F_GETFD): %s", d->sockfd, eina_error_msg_get(d->error));
|
||||
close(d->sockfd);
|
||||
closesocket(d->sockfd);
|
||||
d->sockfd = INVALID_SOCKET;
|
||||
}
|
||||
else
|
||||
|
@ -3380,7 +3380,7 @@ _efl_net_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
{
|
||||
d->error = errno;
|
||||
ERR("fcntl(%d, F_SETFD, %#x): %s", d->sockfd, flags, eina_error_msg_get(d->error));
|
||||
close(d->sockfd);
|
||||
closesocket(d->sockfd);
|
||||
d->sockfd = INVALID_SOCKET;
|
||||
}
|
||||
}
|
||||
|
@ -3394,7 +3394,7 @@ static void
|
|||
_efl_net_connect_async_cancel(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
Efl_Net_Connect_Async_Data *d = data;
|
||||
if (d->sockfd != INVALID_SOCKET) close(d->sockfd);
|
||||
if (d->sockfd != INVALID_SOCKET) closesocket(d->sockfd);
|
||||
_efl_net_connect_async_data_free(d);
|
||||
}
|
||||
|
||||
|
@ -3478,7 +3478,7 @@ typedef struct _Efl_Net_Ip_Connect_Async_Data
|
|||
Eina_Bool close_on_exec;
|
||||
int type;
|
||||
int protocol;
|
||||
int sockfd;
|
||||
SOCKET sockfd;
|
||||
Eina_Error error;
|
||||
union {
|
||||
struct sockaddr_in addr4;
|
||||
|
@ -3490,7 +3490,7 @@ typedef struct _Efl_Net_Ip_Connect_Async_Data
|
|||
static Eina_Error
|
||||
_efl_net_ip_connect(const struct addrinfo *addr, int *sockfd)
|
||||
{
|
||||
int fd = INVALID_SOCKET;
|
||||
SOCKET fd = INVALID_SOCKET;
|
||||
Eina_Error ret = 0;
|
||||
|
||||
/* always close-on-exec since it's not a point to pass an
|
||||
|
@ -3535,7 +3535,7 @@ _efl_net_ip_connect(const struct addrinfo *addr, int *sockfd)
|
|||
{
|
||||
ret = efl_net_socket_error_get();
|
||||
DBG("couldn't connect fd=%d to %s: %s", fd, buf, eina_error_msg_get(ret));
|
||||
close(fd);
|
||||
closesocket(fd);
|
||||
}
|
||||
EINA_THREAD_CLEANUP_POP(EINA_FALSE); /* we need sockfd on success */
|
||||
}
|
||||
|
@ -3666,7 +3666,7 @@ _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, const
|
|||
struct sockaddr_in *a = (struct sockaddr_in *)addrinfo->ai_addr;
|
||||
struct sockaddr_storage proxy_addr;
|
||||
socklen_t proxy_addrlen;
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Error err;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
ssize_t s;
|
||||
|
@ -3814,7 +3814,7 @@ _efl_net_ip_connect_async_run_socks4(Efl_Net_Ip_Connect_Async_Data *d, const cha
|
|||
static void
|
||||
_efl_net_ip_connect_async_run_socks4a(Efl_Net_Ip_Connect_Async_Data *d, const char *host, const char *port, const char *proxy)
|
||||
{
|
||||
int fd = INVALID_SOCKET;
|
||||
SOCKET fd = INVALID_SOCKET;
|
||||
char *str;
|
||||
const char *proxy_user, *proxy_pass, *proxy_host, *proxy_port;
|
||||
struct sockaddr_storage proxy_addr;
|
||||
|
@ -4119,7 +4119,7 @@ typedef struct _Efl_Net_Socks5_Reply_Ipv4 {
|
|||
} Efl_Net_Socks5_Reply_Ipv6;
|
||||
|
||||
static Eina_Bool
|
||||
_efl_net_ip_connect_async_run_socks5_auth_user_pass(int fd, const char *user, const char *pass, const char *proxy_protocol, const char *proxy_host, const char *proxy_port)
|
||||
_efl_net_ip_connect_async_run_socks5_auth_user_pass(SOCKET fd, const char *user, const char *pass, const char *proxy_protocol, const char *proxy_host, const char *proxy_port)
|
||||
{
|
||||
uint8_t user_len = user ? strlen(user) : 0;
|
||||
uint8_t pass_len = pass ? strlen(pass) : 0;
|
||||
|
@ -4188,7 +4188,7 @@ _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, const
|
|||
};
|
||||
struct sockaddr_storage proxy_addr;
|
||||
socklen_t proxy_addrlen;
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Error err;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
ssize_t s;
|
||||
|
@ -4388,7 +4388,7 @@ _efl_net_ip_connect_async_run_socks5(Efl_Net_Ip_Connect_Async_Data *d, const cha
|
|||
static void
|
||||
_efl_net_ip_connect_async_run_socks5h(Efl_Net_Ip_Connect_Async_Data *d, const char *host, const char *port, const char *proxy)
|
||||
{
|
||||
int fd = INVALID_SOCKET;
|
||||
SOCKET fd = INVALID_SOCKET;
|
||||
char *str;
|
||||
const char *proxy_user, *proxy_pass, *proxy_host, *proxy_port;
|
||||
struct sockaddr_storage proxy_addr;
|
||||
|
@ -4789,7 +4789,7 @@ _efl_net_ip_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
{
|
||||
d->error = errno;
|
||||
ERR("fcntl(%d, F_GETFD): %s", d->sockfd, strerror(errno));
|
||||
close(d->sockfd);
|
||||
closesocket(d->sockfd);
|
||||
d->sockfd = INVALID_SOCKET;
|
||||
}
|
||||
else
|
||||
|
@ -4799,7 +4799,7 @@ _efl_net_ip_connect_async_end(void *data, Ecore_Thread *thread EINA_UNUSED)
|
|||
{
|
||||
d->error = errno;
|
||||
ERR("fcntl(%d, F_SETFD, %#x): %s", d->sockfd, flags, strerror(errno));
|
||||
close(d->sockfd);
|
||||
closesocket(d->sockfd);
|
||||
d->sockfd = INVALID_SOCKET;
|
||||
}
|
||||
}
|
||||
|
@ -4814,7 +4814,7 @@ static void
|
|||
_efl_net_ip_connect_async_cancel(void *data, Ecore_Thread *thread EINA_UNUSED)
|
||||
{
|
||||
Efl_Net_Ip_Connect_Async_Data *d = data;
|
||||
if (d->sockfd != INVALID_SOCKET) close(d->sockfd);
|
||||
if (d->sockfd != INVALID_SOCKET) closesocket(d->sockfd);
|
||||
_efl_net_ip_connect_async_data_free(d);
|
||||
}
|
||||
|
||||
|
|
|
@ -380,11 +380,6 @@ void ecore_con_mempool_shutdown(void);
|
|||
|
||||
#undef GENERIC_ALLOC_FREE_HEADER
|
||||
|
||||
void _efl_net_server_udp_init(Eo *client, int fd, const struct sockaddr *addr, socklen_t addrlen, const char *str);
|
||||
void _efl_net_server_udp_client_feed(Eo *client, Eina_Rw_Slice slice);
|
||||
|
||||
Eina_Bool efl_net_ip_port_fmt(char *buf, int buflen, const struct sockaddr *addr);
|
||||
|
||||
/* allow windows and posix to use the same error comparison */
|
||||
#ifndef SOCKET_ERROR
|
||||
#define SOCKET_ERROR -1
|
||||
|
@ -392,12 +387,21 @@ Eina_Bool efl_net_ip_port_fmt(char *buf, int buflen, const struct sockaddr *addr
|
|||
#ifndef INVALID_SOCKET
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
#ifndef _WIN32
|
||||
#define closesocket(fd) close(fd)
|
||||
#define SOCKET int
|
||||
#endif
|
||||
|
||||
/* some platforms do not have AI_V4MAPPED, then define to 0 so bitwise OR won't be changed */
|
||||
#ifndef AI_V4MAPPED
|
||||
#define AI_V4MAPPED 0
|
||||
#endif
|
||||
|
||||
void _efl_net_server_udp_init(Eo *client, SOCKET fd, const struct sockaddr *addr, socklen_t addrlen, const char *str);
|
||||
void _efl_net_server_udp_client_feed(Eo *client, Eina_Rw_Slice slice);
|
||||
|
||||
Eina_Bool efl_net_ip_port_fmt(char *buf, int buflen, const struct sockaddr *addr);
|
||||
|
||||
/**
|
||||
* @brief splits an address in the format "host:port" in two
|
||||
* null-terminated strings.
|
||||
|
@ -419,7 +423,7 @@ Eina_Bool efl_net_ip_port_fmt(char *buf, int buflen, const struct sockaddr *addr
|
|||
*/
|
||||
Eina_Bool efl_net_ip_port_split(char *buf, const char **p_host, const char **p_port);
|
||||
|
||||
int efl_net_socket4(int domain, int type, int protocol, Eina_Bool close_on_exec);
|
||||
SOCKET efl_net_socket4(int domain, int type, int protocol, Eina_Bool close_on_exec);
|
||||
|
||||
/**
|
||||
* @brief callback to notify of resolved address.
|
||||
|
|
|
@ -204,7 +204,7 @@ typedef struct
|
|||
} authentication;
|
||||
Efl_Future *pending_close;
|
||||
unsigned int in_curl_callback;
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Error error;
|
||||
Efl_Net_Http_Version version;
|
||||
Efl_Net_Dialer_Http_Primary_Mode primary_mode;
|
||||
|
@ -368,7 +368,7 @@ static void
|
|||
_efl_net_dialer_http_curlm_event_fd_read(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Net_Dialer_Http_Curlm *cm = data;
|
||||
int fd = efl_loop_fd_get(event->object);
|
||||
SOCKET fd = efl_loop_fd_get(event->object);
|
||||
CURLMcode r;
|
||||
|
||||
ERR("XXX socket=%d CURL_CSELECT_IN", fd);
|
||||
|
@ -383,7 +383,7 @@ static void
|
|||
_efl_net_dialer_http_curlm_event_fd_write(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Net_Dialer_Http_Curlm *cm = data;
|
||||
int fd = efl_loop_fd_get(event->object);
|
||||
SOCKET fd = efl_loop_fd_get(event->object);
|
||||
CURLMcode r;
|
||||
|
||||
ERR("XXX socket=%d CURL_CSELECT_OUT", fd);
|
||||
|
@ -476,7 +476,8 @@ static Eina_Bool
|
|||
_efl_net_dialer_http_curlm_event_fd(void *data, Ecore_Fd_Handler *fdhandler)
|
||||
{
|
||||
Efl_Net_Dialer_Http_Curlm *cm = data;
|
||||
int fd, flags = 0;
|
||||
SOCKET fd;
|
||||
int flags = 0;
|
||||
CURLMcode r;
|
||||
|
||||
if (ecore_main_fd_handler_active_get(fdhandler, ECORE_FD_READ))
|
||||
|
|
|
@ -92,7 +92,7 @@ _efl_net_dialer_tcp_connect_timeout(void *data, const Efl_Event *ev EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_net_dialer_tcp_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, int sockfd, Eina_Error err)
|
||||
_efl_net_dialer_tcp_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, SOCKET sockfd, Eina_Error err)
|
||||
{
|
||||
Eo *o = data;
|
||||
Efl_Net_Dialer_Tcp_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
||||
|
|
|
@ -90,7 +90,7 @@ _efl_net_dialer_udp_connect_timeout(void *data, const Efl_Event *ev EINA_UNUSED)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_net_dialer_udp_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, int sockfd, Eina_Error err)
|
||||
_efl_net_dialer_udp_connected(void *data, const struct sockaddr *addr, socklen_t addrlen EINA_UNUSED, SOCKET sockfd, Eina_Error err)
|
||||
{
|
||||
Eo *o = data;
|
||||
Efl_Net_Dialer_Udp_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
||||
|
|
|
@ -32,15 +32,15 @@ typedef struct _Efl_Net_Server_Fd_Data
|
|||
Eina_Bool reuse_port;
|
||||
} Efl_Net_Server_Fd_Data;
|
||||
|
||||
static int
|
||||
efl_net_accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, Eina_Bool close_on_exec)
|
||||
static SOCKET
|
||||
efl_net_accept4(SOCKET fd, struct sockaddr *addr, socklen_t *addrlen, Eina_Bool close_on_exec)
|
||||
{
|
||||
#ifdef HAVE_ACCEPT4
|
||||
int flags = 0;
|
||||
if (close_on_exec) flags |= SOCK_CLOEXEC;
|
||||
return accept4(fd, addr, addrlen, flags);
|
||||
#else
|
||||
int client = accept(fd, addr, addrlen);
|
||||
SOCKET client = accept(fd, addr, addrlen);
|
||||
if (client != INVALID_SOCKET) return client;
|
||||
|
||||
#ifdef FD_CLOEXEC
|
||||
|
@ -50,7 +50,7 @@ efl_net_accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, Eina_Bool clo
|
|||
{
|
||||
int errno_bkp = errno;
|
||||
ERR("fcntl(%d, F_SETFD, FD_CLOEXEC): %s", client, strerror(errno));
|
||||
close(client);
|
||||
closesocket(client);
|
||||
errno = errno_bkp;
|
||||
return -1;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ _efl_net_server_fd_process_incoming_data(Eo *o, Efl_Net_Server_Fd_Data *pd)
|
|||
{
|
||||
Eina_Bool do_reject = EINA_FALSE;
|
||||
struct sockaddr_storage addr;
|
||||
int client, fd;
|
||||
SOCKET client, fd;
|
||||
socklen_t addrlen;
|
||||
|
||||
if ((pd->clients_limit > 0) && (pd->clients_count >= pd->clients_limit))
|
||||
|
|
|
@ -59,7 +59,8 @@ _efl_net_server_tcp_resolved_bind(Eo *o, Efl_Net_Server_Tcp_Data *pd, const stru
|
|||
Eina_Error err = 0;
|
||||
char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")];
|
||||
socklen_t addrlen = addr->ai_addrlen;
|
||||
int fd, r;
|
||||
SOCKET fd;
|
||||
int r;
|
||||
|
||||
efl_net_server_fd_family_set(o, addr->ai_family);
|
||||
|
||||
|
@ -118,7 +119,7 @@ _efl_net_server_tcp_resolved_bind(Eo *o, Efl_Net_Server_Tcp_Data *pd, const stru
|
|||
error:
|
||||
efl_net_server_fd_family_set(o, AF_UNSPEC);
|
||||
efl_loop_fd_set(o, -1);
|
||||
close(fd);
|
||||
closesocket(fd);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -212,7 +213,7 @@ _efl_net_server_tcp_efl_net_server_fd_client_add(Eo *o, Efl_Net_Server_Tcp_Data
|
|||
if (!client)
|
||||
{
|
||||
ERR("could not create client object fd=%d", client_fd);
|
||||
close(client_fd);
|
||||
closesocket(client_fd);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -240,7 +241,7 @@ _efl_net_server_tcp_efl_net_server_fd_client_reject(Eo *o, Efl_Net_Server_Tcp_Da
|
|||
else
|
||||
efl_net_ip_port_fmt(str, sizeof(str), (struct sockaddr *)&addr);
|
||||
|
||||
close(client_fd);
|
||||
closesocket(client_fd);
|
||||
efl_event_callback_call(o, EFL_NET_SERVER_EVENT_CLIENT_REJECTED, str);
|
||||
}
|
||||
|
||||
|
@ -249,7 +250,7 @@ _efl_net_server_tcp_ipv6_only_set(Eo *o, Efl_Net_Server_Tcp_Data *pd, Eina_Bool
|
|||
{
|
||||
#ifdef IPV6_V6ONLY
|
||||
Eina_Bool old = pd->ipv6_only;
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = ipv6_only;
|
||||
#else
|
||||
|
@ -275,7 +276,7 @@ EOLIAN Eina_Bool
|
|||
_efl_net_server_tcp_ipv6_only_get(Eo *o EINA_UNUSED, Efl_Net_Server_Tcp_Data *pd)
|
||||
{
|
||||
#ifdef IPV6_V6ONLY
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = 0;
|
||||
int valuelen;
|
||||
|
|
|
@ -72,7 +72,8 @@ _efl_net_server_udp_resolved_bind(Eo *o, Efl_Net_Server_Udp_Data *pd, const stru
|
|||
Eina_Error err = 0;
|
||||
char buf[INET6_ADDRSTRLEN + sizeof("[]:65536")];
|
||||
socklen_t addrlen = addr->ai_addrlen;
|
||||
int fd, r;
|
||||
SOCKET fd;
|
||||
int r;
|
||||
|
||||
efl_net_server_fd_family_set(o, addr->ai_family);
|
||||
|
||||
|
@ -125,7 +126,7 @@ _efl_net_server_udp_resolved_bind(Eo *o, Efl_Net_Server_Udp_Data *pd, const stru
|
|||
error:
|
||||
efl_net_server_fd_family_set(o, AF_UNSPEC);
|
||||
efl_loop_fd_set(o, -1);
|
||||
close(fd);
|
||||
closesocket(fd);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -211,7 +212,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(_efl_net_server_udp_client_cbs,
|
|||
{ EFL_IO_CLOSER_EVENT_CLOSED, _efl_net_server_udp_client_event_closed });
|
||||
|
||||
static size_t
|
||||
_udp_datagram_size_query(int fd)
|
||||
_udp_datagram_size_query(SOCKET fd)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
unsigned long size;
|
||||
|
@ -232,7 +233,7 @@ _efl_net_server_udp_efl_net_server_fd_process_incoming_data(Eo *o, Efl_Net_Serve
|
|||
Eina_Bool reject_excess;
|
||||
struct sockaddr_storage addr;
|
||||
Eo *client;
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
char str[INET6_ADDRSTRLEN + sizeof("[]:65536")] = "";
|
||||
char *buf;
|
||||
|
@ -321,7 +322,7 @@ _efl_net_server_udp_ipv6_only_set(Eo *o, Efl_Net_Server_Udp_Data *pd, Eina_Bool
|
|||
{
|
||||
#ifdef IPV6_V6ONLY
|
||||
Eina_Bool old = pd->ipv6_only;
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = ipv6_only;
|
||||
#else
|
||||
|
@ -347,7 +348,7 @@ EOLIAN Eina_Bool
|
|||
_efl_net_server_udp_ipv6_only_get(Eo *o EINA_UNUSED, Efl_Net_Server_Udp_Data *pd)
|
||||
{
|
||||
#ifdef IPV6_V6ONLY
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = 0;
|
||||
int valuelen;
|
||||
|
@ -376,7 +377,7 @@ EOLIAN static Eina_Bool
|
|||
_efl_net_server_udp_dont_route_set(Eo *o, Efl_Net_Server_Udp_Data *pd, Eina_Bool dont_route)
|
||||
{
|
||||
Eina_Bool old = pd->dont_route;
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = dont_route;
|
||||
#else
|
||||
|
@ -401,7 +402,7 @@ _efl_net_server_udp_dont_route_set(Eo *o, Efl_Net_Server_Udp_Data *pd, Eina_Bool
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_server_udp_dont_route_get(Eo *o, Efl_Net_Server_Udp_Data *pd)
|
||||
{
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value;
|
||||
#else
|
||||
|
|
|
@ -41,7 +41,7 @@ typedef struct _Efl_Net_Server_Udp_Client_Data
|
|||
Eina_Inlist *packets;
|
||||
struct sockaddr *addr_remote;
|
||||
socklen_t addr_remote_len;
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Bool close_on_destructor;
|
||||
Eina_Bool eos;
|
||||
Eina_Bool can_read;
|
||||
|
@ -89,7 +89,7 @@ _efl_net_server_udp_client_efl_object_destructor(Eo *o, Efl_Net_Server_Udp_Clien
|
|||
}
|
||||
|
||||
void
|
||||
_efl_net_server_udp_init(Eo *o, int fd, const struct sockaddr *addr, socklen_t addrlen, const char *str)
|
||||
_efl_net_server_udp_init(Eo *o, SOCKET fd, const struct sockaddr *addr, socklen_t addrlen, const char *str)
|
||||
{
|
||||
Efl_Net_Server_Udp_Client_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
||||
pd->fd = fd;
|
||||
|
|
|
@ -94,7 +94,7 @@ _efl_net_socket_fd_efl_object_destructor(Eo *o, Efl_Net_Socket_Fd_Data *pd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_net_socket_fd_set(Eo *o, Efl_Net_Socket_Fd_Data *pd, int fd)
|
||||
_efl_net_socket_fd_set(Eo *o, Efl_Net_Socket_Fd_Data *pd, SOCKET fd)
|
||||
{
|
||||
Eina_Bool close_on_exec = efl_io_closer_close_on_exec_get(o); /* get cached value, otherwise will query from set fd */
|
||||
efl_io_reader_fd_reader_fd_set(o, fd);
|
||||
|
@ -168,7 +168,7 @@ _efl_net_socket_fd_efl_io_closer_close(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UN
|
|||
EOLIAN static Eina_Error
|
||||
_efl_net_socket_fd_efl_io_reader_read(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNUSED, Eina_Rw_Slice *rw_slice)
|
||||
{
|
||||
int fd = efl_io_reader_fd_reader_fd_get(o);
|
||||
SOCKET fd = efl_io_reader_fd_reader_fd_get(o);
|
||||
ssize_t r;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(rw_slice, EINVAL);
|
||||
|
@ -207,7 +207,7 @@ _efl_net_socket_fd_efl_io_reader_read(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNU
|
|||
EOLIAN static Eina_Error
|
||||
_efl_net_socket_fd_efl_io_writer_write(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNUSED, Eina_Slice *ro_slice, Eina_Slice *remaining)
|
||||
{
|
||||
int fd = efl_io_writer_fd_writer_fd_get(o);
|
||||
SOCKET fd = efl_io_writer_fd_writer_fd_get(o);
|
||||
ssize_t r;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(ro_slice, EINVAL);
|
||||
|
|
|
@ -86,7 +86,7 @@ _efl_net_socket_tcp_efl_loop_fd_fd_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd EINA_U
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_socket_tcp_keep_alive_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool keep_alive)
|
||||
{
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Bool old = pd->keep_alive;
|
||||
#ifdef _WIN32
|
||||
DWORD value;
|
||||
|
@ -114,7 +114,7 @@ _efl_net_socket_tcp_keep_alive_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_socket_tcp_keep_alive_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
|
||||
{
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
#ifdef _WIN32
|
||||
DWORD value = 0;
|
||||
int valuelen;
|
||||
|
@ -144,7 +144,7 @@ _efl_net_socket_tcp_keep_alive_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_socket_tcp_no_delay_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool no_delay)
|
||||
{
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
Eina_Bool old = pd->no_delay;
|
||||
#ifdef _WIN32
|
||||
BOOL value;
|
||||
|
@ -172,7 +172,7 @@ _efl_net_socket_tcp_no_delay_set(Eo *o, Efl_Net_Socket_Tcp_Data *pd, Eina_Bool n
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_socket_tcp_no_delay_get(Eo *o, Efl_Net_Socket_Tcp_Data *pd)
|
||||
{
|
||||
int fd;
|
||||
SOCKET fd;
|
||||
#ifdef _WIN32
|
||||
BOOL value;
|
||||
int valuelen;
|
||||
|
|
|
@ -158,7 +158,7 @@ EOLIAN static Eina_Bool
|
|||
_efl_net_socket_udp_dont_route_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool dont_route)
|
||||
{
|
||||
Eina_Bool old = pd->dont_route;
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value = dont_route;
|
||||
#else
|
||||
|
@ -183,7 +183,7 @@ _efl_net_socket_udp_dont_route_set(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_Bool
|
|||
EOLIAN static Eina_Bool
|
||||
_efl_net_socket_udp_dont_route_get(Eo *o, Efl_Net_Socket_Udp_Data *pd)
|
||||
{
|
||||
int fd = efl_loop_fd_get(o);
|
||||
SOCKET fd = efl_loop_fd_get(o);
|
||||
#ifdef _WIN32
|
||||
DWORD value;
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue