Commit 3b4f3ff3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rpcrt4: Reset assoc_group_id on associations with no active connection.

parent c4d85843
......@@ -80,6 +80,7 @@ static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr,
assoc->Endpoint = RPCRT4_strdupA(Endpoint);
assoc->NetworkOptions = NetworkOptions ? RPCRT4_strdupW(NetworkOptions) : NULL;
assoc->assoc_group_id = 0;
assoc->connection_cnt = 0;
UuidCreate(&assoc->http_uuid);
list_init(&assoc->entry);
*assoc_out = assoc;
......@@ -422,6 +423,7 @@ RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc,
return status;
}
InterlockedIncrement(&assoc->connection_cnt);
*Connection = NewConnection;
return RPC_S_OK;
......@@ -437,6 +439,15 @@ void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
LeaveCriticalSection(&assoc->cs);
}
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
{
if (InterlockedDecrement(&assoc->connection_cnt))
return;
TRACE("Last %p connection released\n", assoc);
assoc->assoc_group_id = 0;
}
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard,
NDR_SCONTEXT *SContext)
{
......
......@@ -41,6 +41,7 @@ typedef struct _RpcAssoc
/* client-only */
/* connections available to be used (protected by cs) */
struct list free_connection_pool;
LONG connection_cnt;
/* server-only */
struct list context_handle_list; /* protected by cs */
......@@ -59,3 +60,4 @@ RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SCon
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock) DECLSPEC_HIDDEN;
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid) DECLSPEC_HIDDEN;
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard) DECLSPEC_HIDDEN;
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc) DECLSPEC_HIDDEN;
......@@ -3419,6 +3419,7 @@ void RPCRT4_ReleaseConnection(RpcConnection *connection)
/* server-only */
if (connection->server_binding) RPCRT4_ReleaseBinding(connection->server_binding);
else if (connection->assoc) RpcAssoc_ConnectionReleased(connection->assoc);
if (connection->wait_release) SetEvent(connection->wait_release);
......
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