summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con/ecore_con.c
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/ecore_con.c
parent7d4f95171c9546273e6e7788e21613a70128ac34 (diff)
ecore_con: fix _ecore_con_server_flush on Windows.
@fix
Diffstat (limited to '')
-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)
2461 } 2461 }
2462 2462
2463 if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL))) 2463 if (svr->ecs_state || (!(svr->type & ECORE_CON_SSL)))
2464#ifdef _WIN32
2465 count = send(svr->fd, (const char *)buf + *buf_offset, num, 0);
2466#else
2464 count = write(svr->fd, buf + *buf_offset, num); 2467 count = write(svr->fd, buf + *buf_offset, num);
2468#endif
2465 else 2469 else
2466 count = ecore_con_ssl_server_write(obj, buf + *buf_offset, num); 2470 count = ecore_con_ssl_server_write(obj, buf + *buf_offset, num);
2467 2471
2468 if (count < 0) 2472#ifdef _WIN32
2473 if (count == SOCKET_ERROR)
2469 { 2474 {
2470 if ((errno != EAGAIN) && (errno != EINTR)) 2475 switch (WSAGetLastError())
2471 { 2476 {
2472 ecore_con_event_server_error(obj, strerror(errno)); 2477 case WSAEINTR:
2473 _ecore_con_server_kill(obj); 2478 case WSAEINPROGRESS:
2479 case WSAEWOULDBLOCK:
2480 break;
2481 default:
2482 {
2483 LPTSTR s;
2484
2485 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
2486 FORMAT_MESSAGE_FROM_SYSTEM |
2487 FORMAT_MESSAGE_FROM_STRING,
2488 NULL, WSAGetLastError(), (DWORD)NULL, s, 0, NULL);
2489 ecore_con_event_server_error(svr, (char *)s);
2490 free(s);
2491 _ecore_con_server_kill(svr);
2492 }
2474 } 2493 }
2475 return;
2476 } 2494 }
2495#else
2496 if (count < 0)
2497 {
2498 if ((errno != EAGAIN) && (errno != EINTR))
2499 {
2500 ecore_con_event_server_error(svr, strerror(errno));
2501 _ecore_con_server_kill(svr);
2502 }
2503 return;
2504 }
2505#endif
2506
2477 2507
2478 if (count && (!svr->ecs_state)) ecore_con_event_server_write(obj, count); 2508 if (count && (!svr->ecs_state)) ecore_con_event_server_write(obj, count);
2479 2509