Commit 1d0e21db authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

server: Move sock->error setting completely out of sock_dispatch_events().

parent 41cdc667
...@@ -1084,7 +1084,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error ) ...@@ -1084,7 +1084,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
return event; return event;
} }
static void post_socket_event( struct sock *sock, enum afd_poll_bit event_bit, int error ) static void post_socket_event( struct sock *sock, enum afd_poll_bit event_bit )
{ {
unsigned int event = (1 << event_bit); unsigned int event = (1 << event_bit);
...@@ -1092,11 +1092,10 @@ static void post_socket_event( struct sock *sock, enum afd_poll_bit event_bit, i ...@@ -1092,11 +1092,10 @@ static void post_socket_event( struct sock *sock, enum afd_poll_bit event_bit, i
{ {
sock->pending_events |= event; sock->pending_events |= event;
sock->reported_events |= event; sock->reported_events |= event;
sock->errors[event_bit] = error;
} }
} }
static void sock_dispatch_events( struct sock *sock, enum connection_state prevstate, int event, int error ) static void sock_dispatch_events( struct sock *sock, enum connection_state prevstate, int event )
{ {
switch (prevstate) switch (prevstate)
{ {
...@@ -1105,29 +1104,29 @@ static void sock_dispatch_events( struct sock *sock, enum connection_state prevs ...@@ -1105,29 +1104,29 @@ static void sock_dispatch_events( struct sock *sock, enum connection_state prevs
case SOCK_CONNECTING: case SOCK_CONNECTING:
if (event & POLLOUT) if (event & POLLOUT)
post_socket_event( sock, AFD_POLL_BIT_CONNECT, 0 ); post_socket_event( sock, AFD_POLL_BIT_CONNECT );
if (event & (POLLERR | POLLHUP)) if (event & (POLLERR | POLLHUP))
post_socket_event( sock, AFD_POLL_BIT_CONNECT_ERR, error ); post_socket_event( sock, AFD_POLL_BIT_CONNECT_ERR );
break; break;
case SOCK_LISTENING: case SOCK_LISTENING:
if (event & (POLLIN | POLLERR | POLLHUP)) if (event & (POLLIN | POLLERR | POLLHUP))
post_socket_event( sock, AFD_POLL_BIT_ACCEPT, error ); post_socket_event( sock, AFD_POLL_BIT_ACCEPT );
break; break;
case SOCK_CONNECTED: case SOCK_CONNECTED:
case SOCK_CONNECTIONLESS: case SOCK_CONNECTIONLESS:
if (event & POLLIN) if (event & POLLIN)
post_socket_event( sock, AFD_POLL_BIT_READ, 0 ); post_socket_event( sock, AFD_POLL_BIT_READ );
if (event & POLLOUT) if (event & POLLOUT)
post_socket_event( sock, AFD_POLL_BIT_WRITE, 0 ); post_socket_event( sock, AFD_POLL_BIT_WRITE );
if (event & POLLPRI) if (event & POLLPRI)
post_socket_event( sock, AFD_POLL_BIT_OOB, 0 ); post_socket_event( sock, AFD_POLL_BIT_OOB );
if (event & (POLLERR | POLLHUP)) if (event & (POLLERR | POLLHUP))
post_socket_event( sock, AFD_POLL_BIT_HUP, error ); post_socket_event( sock, AFD_POLL_BIT_HUP );
break; break;
} }
...@@ -1194,6 +1193,7 @@ static void sock_poll_event( struct fd *fd, int event ) ...@@ -1194,6 +1193,7 @@ static void sock_poll_event( struct fd *fd, int event )
{ {
error = errno; error = errno;
event |= POLLERR; event |= POLLERR;
sock->errors[AFD_POLL_BIT_HUP] = error;
if ( debug_level ) if ( debug_level )
fprintf( stderr, "recv error on socket %p: %d\n", sock, errno ); fprintf( stderr, "recv error on socket %p: %d\n", sock, errno );
} }
...@@ -1218,7 +1218,7 @@ static void sock_poll_event( struct fd *fd, int event ) ...@@ -1218,7 +1218,7 @@ static void sock_poll_event( struct fd *fd, int event )
} }
event = sock_dispatch_asyncs( sock, event, error ); event = sock_dispatch_asyncs( sock, event, error );
sock_dispatch_events( sock, prevstate, event, error ); sock_dispatch_events( sock, prevstate, event );
complete_async_polls( sock, event, error ); complete_async_polls( sock, event, error );
sock_reselect( sock ); sock_reselect( sock );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment