forked from enlightenment/efl
fix error handling of plaintext connect, print ERR on connect failure
SVN revision: 54624
This commit is contained in:
parent
92e255f0dc
commit
24c0ebda74
|
@ -1607,28 +1607,30 @@ svr_try_connect_plain(Ecore_Con_Server *svr)
|
||||||
int so_err = 0;
|
int so_err = 0;
|
||||||
unsigned int size = sizeof(int);
|
unsigned int size = sizeof(int);
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size);
|
res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (res == SOCKET_ERROR)
|
if (res == SOCKET_ERROR)
|
||||||
so_err = -1;
|
so_err = WSAGetLastError();
|
||||||
|
|
||||||
if (so_err == WSAEINPROGRESS && !svr->dead)
|
if ((so_err == WSAEINPROGRESS) && !svr->dead)
|
||||||
return ECORE_CON_INPROGRESS;
|
return ECORE_CON_INPROGRESS;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
so_err = -1;
|
so_err = errno;
|
||||||
|
|
||||||
if (so_err == EINPROGRESS && !svr->dead)
|
if ((so_err == EINPROGRESS) && !svr->dead)
|
||||||
return ECORE_CON_INPROGRESS;
|
return ECORE_CON_INPROGRESS;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (so_err != 0)
|
if (so_err)
|
||||||
{
|
{
|
||||||
/* we lost our server! */
|
/* we lost our server! */
|
||||||
_ecore_con_server_kill(svr);
|
ERR("Connection lost: %s", strerror(so_err));
|
||||||
return ECORE_CON_DISCONNECTED;
|
_ecore_con_server_kill(svr);
|
||||||
|
return ECORE_CON_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting)
|
if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting)
|
||||||
|
|
Loading…
Reference in New Issue