rpcrt4: Introduce op for closing connection read end and use it when shutting down server.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-05-24 13:52:07 +02:00 committed by Alexandre Julliard
parent 719e28bd2c
commit 42ba4d731a
3 changed files with 28 additions and 0 deletions

View File

@ -104,6 +104,7 @@ struct connection_ops {
int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
int (*close)(RpcConnection *conn);
void (*close_read)(RpcConnection *conn);
void (*cancel_call)(RpcConnection *conn);
RPC_STATUS (*is_server_listening)(const char *endpoint);
int (*wait_for_incoming_data)(RpcConnection *conn);
@ -197,6 +198,11 @@ static inline int rpcrt4_conn_close(RpcConnection *Connection)
return Connection->ops->close(Connection);
}
static inline void rpcrt4_conn_close_read(RpcConnection *connection)
{
connection->ops->close_read(connection);
}
static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
{
Connection->ops->cancel_call(Connection);

View File

@ -669,9 +669,12 @@ static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
{
/* cleanup */
cps->ops->free_wait_array(cps, objs);
EnterCriticalSection(&cps->cs);
LIST_FOR_EACH_ENTRY(conn, &cps->listeners, RpcConnection, protseq_entry)
RPCRT4_CloseConnection(conn);
LIST_FOR_EACH_ENTRY(conn, &cps->connections, RpcConnection, protseq_entry)
rpcrt4_conn_close_read(conn);
LeaveCriticalSection(&cps->cs);
if (res == 0 && !std_listen)

View File

@ -449,6 +449,11 @@ static int rpcrt4_conn_np_close(RpcConnection *conn)
return 0;
}
static void rpcrt4_conn_np_close_read(RpcConnection *conn)
{
/* FIXME */
}
static void rpcrt4_conn_np_cancel_call(RpcConnection *conn)
{
RpcConnection_np *connection = (RpcConnection_np *)conn;
@ -1441,6 +1446,11 @@ static int rpcrt4_conn_tcp_close(RpcConnection *conn)
return 0;
}
static void rpcrt4_conn_tcp_close_read(RpcConnection *conn)
{
/* FIXME */
}
static void rpcrt4_conn_tcp_cancel_call(RpcConnection *conn)
{
RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
@ -3066,6 +3076,11 @@ static int rpcrt4_ncacn_http_close(RpcConnection *Connection)
return 0;
}
static void rpcrt4_ncacn_http_close_read(RpcConnection *conn)
{
rpcrt4_ncacn_http_close(conn); /* FIXME */
}
static void rpcrt4_ncacn_http_cancel_call(RpcConnection *Connection)
{
RpcConnection_http *httpc = (RpcConnection_http *) Connection;
@ -3119,6 +3134,7 @@ static const struct connection_ops conn_protseq_list[] = {
rpcrt4_conn_np_read,
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
rpcrt4_conn_np_close_read,
rpcrt4_conn_np_cancel_call,
rpcrt4_ncacn_np_is_server_listening,
rpcrt4_conn_np_wait_for_incoming_data,
@ -3140,6 +3156,7 @@ static const struct connection_ops conn_protseq_list[] = {
rpcrt4_conn_np_read,
rpcrt4_conn_np_write,
rpcrt4_conn_np_close,
rpcrt4_conn_np_close_read,
rpcrt4_conn_np_cancel_call,
rpcrt4_ncalrpc_np_is_server_listening,
rpcrt4_conn_np_wait_for_incoming_data,
@ -3161,6 +3178,7 @@ static const struct connection_ops conn_protseq_list[] = {
rpcrt4_conn_tcp_read,
rpcrt4_conn_tcp_write,
rpcrt4_conn_tcp_close,
rpcrt4_conn_tcp_close_read,
rpcrt4_conn_tcp_cancel_call,
rpcrt4_conn_tcp_is_server_listening,
rpcrt4_conn_tcp_wait_for_incoming_data,
@ -3182,6 +3200,7 @@ static const struct connection_ops conn_protseq_list[] = {
rpcrt4_ncacn_http_read,
rpcrt4_ncacn_http_write,
rpcrt4_ncacn_http_close,
rpcrt4_ncacn_http_close_read,
rpcrt4_ncacn_http_cancel_call,
rpcrt4_ncacn_http_is_server_listening,
rpcrt4_ncacn_http_wait_for_incoming_data,