Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Johnny Cai
wine
Commits
8e382337
Commit
8e382337
authored
21 years ago
by
Ove Kåven
Committed by
Alexandre Julliard
21 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implemented simple caching of client connections.
parent
255ecc56
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/rpcrt4/rpc_binding.c
+61
-7
61 additions, 7 deletions
dlls/rpcrt4/rpc_binding.c
dlls/rpcrt4/rpc_binding.h
+1
-1
1 addition, 1 deletion
dlls/rpcrt4/rpc_binding.h
dlls/rpcrt4/rpc_server.c
+1
-1
1 addition, 1 deletion
dlls/rpcrt4/rpc_server.c
with
63 additions
and
9 deletions
dlls/rpcrt4/rpc_binding.c
+
61
−
7
View file @
8e382337
...
...
@@ -40,6 +40,9 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
static
RpcConnection
*
conn_cache
;
static
CRITICAL_SECTION
conn_cache_cs
=
CRITICAL_SECTION_INIT
(
"conn_cache_cs"
);
LPSTR
RPCRT4_strndupA
(
LPSTR
src
,
INT
slen
)
{
DWORD
len
;
...
...
@@ -93,7 +96,7 @@ void RPCRT4_strfree(LPSTR src)
if
(
src
)
HeapFree
(
GetProcessHeap
(),
0
,
src
);
}
RPC_STATUS
RPCRT4_CreateConnection
(
RpcConnection
**
Connection
,
BOOL
server
,
LPSTR
Protseq
,
LPSTR
NetworkAddr
,
LPSTR
Endpoint
,
LPSTR
NetworkOptions
)
RPC_STATUS
RPCRT4_CreateConnection
(
RpcConnection
**
Connection
,
BOOL
server
,
LPSTR
Protseq
,
LPSTR
NetworkAddr
,
LPSTR
Endpoint
,
LPSTR
NetworkOptions
,
RpcBinding
*
Binding
)
{
RpcConnection
*
NewConnection
;
...
...
@@ -102,6 +105,12 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPST
NewConnection
->
Protseq
=
RPCRT4_strdupA
(
Protseq
);
NewConnection
->
NetworkAddr
=
RPCRT4_strdupA
(
NetworkAddr
);
NewConnection
->
Endpoint
=
RPCRT4_strdupA
(
Endpoint
);
NewConnection
->
Used
=
Binding
;
EnterCriticalSection
(
&
conn_cache_cs
);
NewConnection
->
Next
=
conn_cache
;
conn_cache
=
NewConnection
;
LeaveCriticalSection
(
&
conn_cache_cs
);
TRACE
(
"connection: %p
\n
"
,
NewConnection
);
*
Connection
=
NewConnection
;
...
...
@@ -111,8 +120,18 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPST
RPC_STATUS
RPCRT4_DestroyConnection
(
RpcConnection
*
Connection
)
{
RpcConnection
*
PrevConnection
;
TRACE
(
"connection: %p
\n
"
,
Connection
);
if
(
Connection
->
Used
)
ERR
(
"connection is still in use
\n
"
);
EnterCriticalSection
(
&
conn_cache_cs
);
PrevConnection
=
conn_cache
;
while
(
PrevConnection
&&
PrevConnection
->
Next
!=
Connection
)
PrevConnection
=
PrevConnection
->
Next
;
if
(
PrevConnection
)
PrevConnection
->
Next
=
Connection
->
Next
;
LeaveCriticalSection
(
&
conn_cache_cs
);
RPCRT4_CloseConnection
(
Connection
);
RPCRT4_strfree
(
Connection
->
Endpoint
);
RPCRT4_strfree
(
Connection
->
NetworkAddr
);
...
...
@@ -121,6 +140,44 @@ RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection)
return
RPC_S_OK
;
}
RPC_STATUS
RPCRT4_GetConnection
(
RpcConnection
**
Connection
,
BOOL
server
,
LPSTR
Protseq
,
LPSTR
NetworkAddr
,
LPSTR
Endpoint
,
LPSTR
NetworkOptions
,
RpcBinding
*
Binding
)
{
RpcConnection
*
NewConnection
;
if
(
!
server
)
{
EnterCriticalSection
(
&
conn_cache_cs
);
for
(
NewConnection
=
conn_cache
;
NewConnection
;
NewConnection
=
NewConnection
->
Next
)
{
if
(
NewConnection
->
Used
)
continue
;
if
(
NewConnection
->
server
!=
server
)
continue
;
if
(
Protseq
&&
strcmp
(
NewConnection
->
Protseq
,
Protseq
))
continue
;
if
(
NetworkAddr
&&
strcmp
(
NewConnection
->
NetworkAddr
,
NetworkAddr
))
continue
;
if
(
Endpoint
&&
strcmp
(
NewConnection
->
Endpoint
,
Endpoint
))
continue
;
/* this connection fits the bill */
NewConnection
->
Used
=
Binding
;
break
;
}
LeaveCriticalSection
(
&
conn_cache_cs
);
if
(
NewConnection
)
{
TRACE
(
"cached connection: %p
\n
"
,
NewConnection
);
*
Connection
=
NewConnection
;
return
RPC_S_OK
;
}
}
return
RPCRT4_CreateConnection
(
Connection
,
server
,
Protseq
,
NetworkAddr
,
Endpoint
,
NetworkOptions
,
Binding
);
}
RPC_STATUS
RPCRT4_ReleaseConnection
(
RpcConnection
*
Connection
)
{
TRACE
(
"connection: %p
\n
"
,
Connection
);
Connection
->
Used
=
NULL
;
if
(
!
Connection
->
server
)
{
/* cache the open connection for reuse later */
/* FIXME: we should probably clean the cache someday */
return
RPC_S_OK
;
}
return
RPCRT4_DestroyConnection
(
Connection
);
}
RPC_STATUS
RPCRT4_OpenConnection
(
RpcConnection
*
Connection
)
{
TRACE
(
"(Connection == ^%p)
\n
"
,
Connection
);
...
...
@@ -264,7 +321,7 @@ RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* Old
{
RpcConnection
*
NewConnection
;
RPC_STATUS
err
=
RPCRT4_CreateConnection
(
&
NewConnection
,
OldConnection
->
server
,
OldConnection
->
Protseq
,
OldConnection
->
NetworkAddr
,
OldConnection
->
Endpoint
,
NULL
);
OldConnection
->
NetworkAddr
,
OldConnection
->
Endpoint
,
NULL
,
NULL
);
if
(
err
==
RPC_S_OK
)
{
/* because of the way named pipes work, we'll transfer the connected pipe
* to the child, then reopen the server binding to continue listening */
...
...
@@ -418,9 +475,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection)
return
RPC_S_OK
;
}
/* FIXME: cache connections */
RPCRT4_CreateConnection
(
&
NewConnection
,
Binding
->
server
,
Binding
->
Protseq
,
Binding
->
NetworkAddr
,
Binding
->
Endpoint
,
NULL
);
NewConnection
->
Used
=
Binding
;
RPCRT4_GetConnection
(
&
NewConnection
,
Binding
->
server
,
Binding
->
Protseq
,
Binding
->
NetworkAddr
,
Binding
->
Endpoint
,
NULL
,
Binding
);
*
Connection
=
NewConnection
;
return
RPCRT4_OpenConnection
(
NewConnection
);
}
...
...
@@ -430,8 +485,7 @@ RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection)
TRACE
(
"(Binding == ^%p)
\n
"
,
Binding
);
if
(
!
Connection
)
return
RPC_S_OK
;
if
(
Binding
->
FromConn
==
Connection
)
return
RPC_S_OK
;
Connection
->
Used
=
NULL
;
return
RPCRT4_DestroyConnection
(
Connection
);
return
RPCRT4_ReleaseConnection
(
Connection
);
}
/* utility functions for string composing and parsing */
...
...
This diff is collapsed.
Click to expand it.
dlls/rpcrt4/rpc_binding.h
+
1
−
1
View file @
8e382337
...
...
@@ -60,7 +60,7 @@ void RPCRT4_strfree(LPSTR src);
#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
RPC_STATUS
RPCRT4_CreateConnection
(
RpcConnection
**
Connection
,
BOOL
server
,
LPSTR
Protseq
,
LPSTR
NetworkAddr
,
LPSTR
Endpoint
,
LPSTR
NetworkOptions
);
RPC_STATUS
RPCRT4_CreateConnection
(
RpcConnection
**
Connection
,
BOOL
server
,
LPSTR
Protseq
,
LPSTR
NetworkAddr
,
LPSTR
Endpoint
,
LPSTR
NetworkOptions
,
RpcBinding
*
Binding
);
RPC_STATUS
RPCRT4_DestroyConnection
(
RpcConnection
*
Connection
);
RPC_STATUS
RPCRT4_OpenConnection
(
RpcConnection
*
Connection
);
RPC_STATUS
RPCRT4_CloseConnection
(
RpcConnection
*
Connection
);
...
...
This diff is collapsed.
Click to expand it.
dlls/rpcrt4/rpc_server.c
+
1
−
1
View file @
8e382337
...
...
@@ -433,7 +433,7 @@ static void RPCRT4_stop_listen(void)
static
RPC_STATUS
RPCRT4_use_protseq
(
RpcServerProtseq
*
ps
)
{
RPCRT4_CreateConnection
(
&
ps
->
conn
,
TRUE
,
ps
->
Protseq
,
NULL
,
ps
->
Endpoint
,
NULL
);
RPCRT4_CreateConnection
(
&
ps
->
conn
,
TRUE
,
ps
->
Protseq
,
NULL
,
ps
->
Endpoint
,
NULL
,
NULL
);
EnterCriticalSection
(
&
server_cs
);
ps
->
Next
=
protseqs
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment