while (TRUE)
{
- if (socket->priv->blocking &&
- !g_socket_condition_wait (socket,
- G_IO_IN, cancellable, error))
- return NULL;
-
if ((ret = accept (socket->priv->fd, NULL, 0)) < 0)
{
int errsv = get_socket_errno ();
- win32_unset_event_mask (socket, FD_ACCEPT);
-
if (errsv == EINTR)
continue;
- if (socket->priv->blocking)
- {
#ifdef WSAEWOULDBLOCK
- if (errsv == WSAEWOULDBLOCK)
- continue;
+ if (errsv == WSAEWOULDBLOCK)
#else
- if (errsv == EWOULDBLOCK ||
- errsv == EAGAIN)
- continue;
+ if (errsv == EWOULDBLOCK ||
+ errsv == EAGAIN)
#endif
- }
+ {
+ win32_unset_event_mask (socket, FD_ACCEPT);
+
+ if (socket->priv->blocking)
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_IN, cancellable, error))
+ return NULL;
+
+ continue;
+ }
+ }
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
if (errsv == WSAEWOULDBLOCK)
#endif
{
+ win32_unset_event_mask (socket, FD_CONNECT);
+
if (socket->priv->blocking)
{
if (g_socket_condition_wait (socket, G_IO_OUT, cancellable, error))
while (1)
{
- if (blocking &&
- !g_socket_condition_wait (socket,
- G_IO_IN, cancellable, error))
- return -1;
-
if ((ret = recv (socket->priv->fd, buffer, size, 0)) < 0)
{
int errsv = get_socket_errno ();
if (errsv == EINTR)
continue;
- if (blocking)
- {
#ifdef WSAEWOULDBLOCK
- if (errsv == WSAEWOULDBLOCK)
- continue;
+ if (errsv == WSAEWOULDBLOCK)
#else
- if (errsv == EWOULDBLOCK ||
- errsv == EAGAIN)
- continue;
+ if (errsv == EWOULDBLOCK ||
+ errsv == EAGAIN)
#endif
- }
+ {
+ win32_unset_event_mask (socket, FD_READ);
+
+ if (blocking)
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_IN, cancellable, error))
+ return -1;
+
+ continue;
+ }
+ }
win32_unset_event_mask (socket, FD_READ);
while (1)
{
- if (blocking &&
- !g_socket_condition_wait (socket,
- G_IO_OUT, cancellable, error))
- return -1;
-
if ((ret = send (socket->priv->fd, buffer, size, G_SOCKET_DEFAULT_SEND_FLAGS)) < 0)
{
int errsv = get_socket_errno ();
continue;
#ifdef WSAEWOULDBLOCK
- if (errsv == WSAEWOULDBLOCK)
- win32_unset_event_mask (socket, FD_WRITE);
-#endif
-
- if (blocking)
- {
-#ifdef WSAEWOULDBLOCK
- if (errsv == WSAEWOULDBLOCK)
- continue;
+ if (errsv == WSAEWOULDBLOCK)
#else
- if (errsv == EWOULDBLOCK ||
- errsv == EAGAIN)
- continue;
+ if (errsv == EWOULDBLOCK ||
+ errsv == EAGAIN)
#endif
- }
+ {
+ win32_unset_event_mask (socket, FD_WRITE);
+
+ if (blocking)
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_OUT, cancellable, error))
+ return -1;
+
+ continue;
+ }
+ }
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
while (1)
{
- if (socket->priv->blocking &&
- !g_socket_condition_wait (socket,
- G_IO_OUT, cancellable, error))
- return -1;
-
result = sendmsg (socket->priv->fd, &msg, flags | G_SOCKET_DEFAULT_SEND_FLAGS);
if (result < 0)
{
if (socket->priv->blocking &&
(errsv == EWOULDBLOCK ||
errsv == EAGAIN))
- continue;
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_OUT, cancellable, error))
+ return -1;
+
+ continue;
+ }
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
while (1)
{
- if (socket->priv->blocking &&
- !g_socket_condition_wait (socket,
- G_IO_OUT, cancellable, error))
- return -1;
-
if (address)
result = WSASendTo (socket->priv->fd,
bufs, num_vectors,
continue;
if (errsv == WSAEWOULDBLOCK)
- win32_unset_event_mask (socket, FD_WRITE);
+ {
+ win32_unset_event_mask (socket, FD_WRITE);
- if (socket->priv->blocking &&
- errsv == WSAEWOULDBLOCK)
- continue;
+ if (socket->priv->blocking)
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_OUT, cancellable, error))
+ return -1;
+
+ continue;
+ }
+ }
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),
/* do it */
while (1)
{
- if (socket->priv->blocking &&
- !g_socket_condition_wait (socket,
- G_IO_IN, cancellable, error))
- return -1;
-
addrlen = sizeof addr;
if (address)
result = WSARecvFrom (socket->priv->fd,
if (errsv == WSAEINTR)
continue;
- win32_unset_event_mask (socket, FD_READ);
+ if (errsv == WSAEWOULDBLOCK)
+ {
+ win32_unset_event_mask (socket, FD_READ);
- if (socket->priv->blocking &&
- errsv == WSAEWOULDBLOCK)
- continue;
+ if (socket->priv->blocking)
+ {
+ if (!g_socket_condition_wait (socket,
+ G_IO_IN, cancellable, error))
+ return -1;
+
+ continue;
+ }
+ }
g_set_error (error, G_IO_ERROR,
socket_io_error_from_errno (errsv),