forked from enlightenment/efl
ecore - handle G_IO_ERR conditions for net sockets
Glib integration with using of select() syscall doesn't properly propagates G_IO_ERR condition for network sockets. Problem relies in _ecore_glib_context_poll_to() where rewriting filedescriptor events to GPollFD structures reside. This fixes T5725 @fix
This commit is contained in:
parent
4294561c88
commit
1adb73cef8
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
|
@ -111,6 +114,7 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
|
||||||
int ready)
|
int ready)
|
||||||
{
|
{
|
||||||
GPollFD *itr = pfds, *itr_end = pfds + count;
|
GPollFD *itr = pfds, *itr_end = pfds + count;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
for (; (itr < itr_end) && (ready > 0); itr++)
|
for (; (itr < itr_end) && (ready > 0); itr++)
|
||||||
{
|
{
|
||||||
|
@ -124,6 +128,19 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
|
||||||
{
|
{
|
||||||
itr->revents |= G_IO_OUT;
|
itr->revents |= G_IO_OUT;
|
||||||
ready--;
|
ready--;
|
||||||
|
if (!fstat(itr->fd, &st))
|
||||||
|
{
|
||||||
|
if (S_ISSOCK(st.st_mode))
|
||||||
|
{
|
||||||
|
struct sockaddr_in peer;
|
||||||
|
socklen_t length = sizeof(peer);
|
||||||
|
|
||||||
|
memset(&peer, 0, sizeof(peer));
|
||||||
|
if (getpeername(itr->fd, (struct sockaddr *)&peer,
|
||||||
|
&length))
|
||||||
|
itr->revents |= G_IO_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (FD_ISSET(itr->fd, efds) && (itr->events & (G_IO_HUP | G_IO_ERR)))
|
if (FD_ISSET(itr->fd, efds) && (itr->events & (G_IO_HUP | G_IO_ERR)))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue