aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorGuillaume Friloux <guillaume.friloux@gmail.com>2015-01-30 11:21:03 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-11 17:03:37 +0100
commite57c1d396e140e22d5d0213f863a66540a258c9d (patch)
tree1afd860705e6221f5b7567962b25a9c59f31197a /src/lib/ecore_con
parentecore_con: Fix checks from socket() and accept() under windows. (diff)
downloadefl-e57c1d396e140e22d5d0213f863a66540a258c9d.tar.gz
ecore_con: fix _ecore_con_server_flush on Windows.
@fix
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con.c40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index b56535cd13..0bf16c0a30 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -2461,19 +2461,49 @@ _ecore_con_server_flush(Ecore_Con_Server *obj)
}
if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL)))
+#ifdef _WIN32
+ count = send(svr->fd, (const char *)buf + *buf_offset, num, 0);
+#else
count = write(svr->fd, buf + *buf_offset, num);
+#endif
else
count = ecore_con_ssl_server_write(obj, buf + *buf_offset, num);
- if (count < 0)
+#ifdef _WIN32
+ if (count == SOCKET_ERROR)
{
- if ((errno != EAGAIN) && (errno != EINTR))
+ switch (WSAGetLastError())
{
- ecore_con_event_server_error(obj, strerror(errno));
- _ecore_con_server_kill(obj);
+ case WSAEINTR:
+ case WSAEINPROGRESS:
+ case WSAEWOULDBLOCK:
+ break;
+ default:
+ {
+ LPTSTR s;
+
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_FROM_STRING,
+ NULL, WSAGetLastError(), (DWORD)NULL, s, 0, NULL);
+ ecore_con_event_server_error(svr, (char *)s);
+ free(s);
+ _ecore_con_server_kill(svr);
+ }
}
- return;
}
+#else
+ if (count < 0)
+ {
+ if ((errno != EAGAIN) && (errno != EINTR))
+ {
+ ecore_con_event_server_error(svr, strerror(errno));
+ _ecore_con_server_kill(svr);
+ }
+ return;
+ }
+#endif
+
if (count && (!svr->ecs_state)) ecore_con_event_server_write(obj, count);