Commit 89f77a93 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

server: Mark the socket as cacheable when it is connected, marked listening, or…

server: Mark the socket as cacheable when it is connected, marked listening, or created as connectionless. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent a5540798
...@@ -416,7 +416,6 @@ static int sock_reselect( struct sock *sock ) ...@@ -416,7 +416,6 @@ static int sock_reselect( struct sock *sock )
if (!(sock->state & ~FD_WINE_NONBLOCKING)) return 0; if (!(sock->state & ~FD_WINE_NONBLOCKING)) return 0;
/* ok, it is, attach it to the wineserver's main poll loop */ /* ok, it is, attach it to the wineserver's main poll loop */
sock->polling = 1; sock->polling = 1;
allow_fd_caching( sock->fd );
} }
/* update condition mask */ /* update condition mask */
set_fd_events( sock->fd, ev ); set_fd_events( sock->fd, ev );
...@@ -1358,7 +1357,11 @@ static int init_socket( struct sock *sock, int family, int type, int protocol, u ...@@ -1358,7 +1357,11 @@ static int init_socket( struct sock *sock, int family, int type, int protocol, u
{ {
return -1; return -1;
} }
sock_reselect( sock );
/* We can't immediately allow caching for a connection-mode socket, since it
* might be accepted into (changing the underlying fd object.) */
if (sock->type != WS_SOCK_STREAM) allow_fd_caching( sock->fd );
return 0; return 0;
} }
...@@ -1750,6 +1753,9 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) ...@@ -1750,6 +1753,9 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
sock->state |= FD_WINE_LISTENING; sock->state |= FD_WINE_LISTENING;
sock->state &= ~(FD_CONNECT | FD_WINE_CONNECTED); sock->state &= ~(FD_CONNECT | FD_WINE_CONNECTED);
/* a listening socket can no longer be accepted into */
allow_fd_caching( sock->fd );
/* we may already be selecting for FD_ACCEPT */ /* we may already be selecting for FD_ACCEPT */
sock_reselect( sock ); sock_reselect( sock );
return 0; return 0;
...@@ -1790,6 +1796,9 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) ...@@ -1790,6 +1796,9 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
return 0; return 0;
} }
/* a connected or connecting socket can no longer be accepted into */
allow_fd_caching( sock->fd );
sock->pending_events &= ~(FD_CONNECT | FD_READ | FD_WRITE); sock->pending_events &= ~(FD_CONNECT | FD_READ | FD_WRITE);
sock->reported_events &= ~(FD_CONNECT | FD_READ | FD_WRITE); sock->reported_events &= ~(FD_CONNECT | FD_READ | FD_WRITE);
......
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