gsocket: always try before waiting for condition
authorIgnacio Casal Quinteiro <icq@gnome.org>
Mon, 22 Dec 2014 15:38:50 +0000 (16:38 +0100)
committerPaolo Borelli <pborelli@gnome.org>
Sat, 17 Jan 2015 14:04:25 +0000 (15:04 +0100)
commitcf03e824780d4ca58de664737bf5ba9ed416cfa2
tree0e8996891d25637475dc78c54f2cd4176b3533ee
parent4f4714285dcc5c3ce9c87f65d9f684f285113a6e
gsocket: always try before waiting for condition

When implementing blocking operations on top of
nonblocking sockets we should always first try to
perform the operation and then if needed handle
EAGAIN and wait with g_socket_wait_condition.
This is an optimization since we avoid calling
wait condition when it is not needed, but most
importantly this fixes hangs on win32 where some
events (in particular FD_WRITE) are only emitted
after the operation fails with EWOULDBLOCK.

https://bugzilla.gnome.org/show_bug.cgi?id=732439
https://bugzilla.gnome.org/show_bug.cgi?id=741707
gio/gsocket.c