rpcrt4: Store the assoc_group_id field returned from the bind_ack packet and use it when creating further connections in the association group.

oldstable
Rob Shearman 2007-06-25 14:26:23 +01:00 committed by Alexandre Julliard
parent 62c49bdd18
commit 0ebcacca39
5 changed files with 10 additions and 1 deletions

View File

@ -312,6 +312,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
hdr = RPCRT4_BuildBindHeader(NDR_LOCAL_DATA_REPRESENTATION,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE,
Binding->Assoc->assoc_group_id,
InterfaceId, TransferSyntax);
status = RPCRT4_Send(NewConnection, hdr, NULL, 0);

View File

@ -55,6 +55,9 @@ typedef struct _RpcAssoc
LPWSTR NetworkOptions;
RpcAuthInfo *AuthInfo;
/* id of this association group */
ULONG assoc_group_id;
CRITICAL_SECTION cs;
struct list connection_pool;
} RpcAssoc;
@ -86,6 +89,7 @@ typedef struct _RpcConnection
/* client-only */
struct list conn_pool_entry;
ULONG assoc_group_id; /* association group returned during binding */
} RpcConnection;
struct connection_ops {

View File

@ -177,6 +177,7 @@ RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation,
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation,
unsigned short MaxTransmissionSize,
unsigned short MaxReceiveSize,
unsigned long AssocGroupId,
RPC_SYNTAX_IDENTIFIER *AbstractId,
RPC_SYNTAX_IDENTIFIER *TransferId)
{
@ -191,6 +192,7 @@ RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation,
header->common.frag_len = sizeof(header->bind);
header->bind.max_tsize = MaxTransmissionSize;
header->bind.max_rsize = MaxReceiveSize;
header->bind.assoc_gid = AssocGroupId;
header->bind.num_elements = 1;
header->bind.num_syntaxes = 1;
memcpy(&header->bind.abstract, AbstractId, sizeof(RPC_SYNTAX_IDENTIFIER));

View File

@ -25,7 +25,7 @@
#include "rpc_defs.h"
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, LPSTR ServerAddress, unsigned long Result, unsigned long Reason, RPC_SYNTAX_IDENTIFIER *TransferId);
VOID RPCRT4_FreeHeader(RpcPktHdr *Header);

View File

@ -1432,6 +1432,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
assoc->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
assoc->Endpoint = RPCRT4_strdupA(Endpoint);
assoc->NetworkOptions = NetworkOptions ? RPCRT4_strdupW(NetworkOptions) : NULL;
assoc->assoc_group_id = 0;
list_add_head(&assoc_list, &assoc->entry);
*assoc_out = assoc;
@ -1503,6 +1504,7 @@ void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
{
assert(!Connection->server);
EnterCriticalSection(&assoc->cs);
if (!assoc->assoc_group_id) assoc->assoc_group_id = Connection->assoc_group_id;
list_add_head(&assoc->connection_pool, &Connection->conn_pool_entry);
LeaveCriticalSection(&assoc->cs);
}