Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d0ed6d10
Commit
d0ed6d10
authored
Mar 16, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Get rid of manual_listen_count and use binary state instead.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2656f738
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
45 deletions
+38
-45
rpc_server.c
dlls/rpcrt4/rpc_server.c
+37
-38
rpc.c
dlls/rpcrt4/tests/rpc.c
+0
-4
server.c
dlls/rpcrt4/tests/server.c
+1
-3
No files found.
dlls/rpcrt4/rpc_server.c
View file @
d0ed6d10
...
...
@@ -101,11 +101,9 @@ static CRITICAL_SECTION server_auth_info_cs = { &server_auth_info_cs_debug, -1,
/* whether the server is currently listening */
static
BOOL
std_listen
;
/* number of manual listeners (calls to RpcServerListen) */
static
LONG
manual_listen_count
;
/* total listeners including auto listeners */
static
LONG
listen_count
;
/* event set once all listening is finished */
/* event set once all
manual
listening is finished */
static
HANDLE
listen_done_event
;
static
UUID
uuid_nil
;
...
...
@@ -735,13 +733,16 @@ static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
TRACE
(
"
\n
"
);
EnterCriticalSection
(
&
listen_cs
);
if
(
auto_listen
||
(
manual_listen_count
++
==
0
)
)
if
(
auto_listen
||
!
listen_done_event
)
{
status
=
RPC_S_OK
;
if
(
!
auto_listen
)
listen_done_event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
++
listen_count
==
1
)
std_listen
=
TRUE
;
}
LeaveCriticalSection
(
&
listen_cs
);
if
(
status
)
return
status
;
if
(
std_listen
)
{
...
...
@@ -764,38 +765,38 @@ static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
static
RPC_STATUS
RPCRT4_stop_listen
(
BOOL
auto_listen
)
{
BOOL
stop_listen
=
FALSE
;
RPC_STATUS
status
=
RPC_S_OK
;
EnterCriticalSection
(
&
listen_cs
);
if
(
!
std_listen
)
if
(
!
std_listen
&&
(
auto_listen
||
!
listen_done_event
))
{
status
=
RPC_S_NOT_LISTENING
;
goto
done
;
}
if
(
auto_listen
||
(
--
manual_listen_count
==
0
))
else
{
if
(
listen_count
!=
0
&&
--
listen_count
==
0
)
{
RpcServerProtseq
*
cps
;
stop_listen
=
listen_count
!=
0
&&
--
listen_count
==
0
;
assert
(
listen_count
>=
0
)
;
if
(
stop_listen
)
std_listen
=
FALSE
;
LeaveCriticalSection
(
&
listen_cs
);
}
LeaveCriticalSection
(
&
listen_cs
);
LIST_FOR_EACH_ENTRY
(
cps
,
&
protseqs
,
RpcServerProtseq
,
entry
)
RPCRT4_sync_with_server_thread
(
cps
);
if
(
status
)
return
status
;
EnterCriticalSection
(
&
listen_cs
);
if
(
listen_done_event
)
SetEvent
(
listen_done_event
);
listen_done_event
=
0
;
goto
done
;
}
assert
(
listen_count
>=
0
);
if
(
stop_listen
)
{
RpcServerProtseq
*
cps
;
LIST_FOR_EACH_ENTRY
(
cps
,
&
protseqs
,
RpcServerProtseq
,
entry
)
RPCRT4_sync_with_server_thread
(
cps
);
}
done:
LeaveCriticalSection
(
&
listen_cs
);
return
status
;
if
(
!
auto_listen
)
{
EnterCriticalSection
(
&
listen_cs
);
SetEvent
(
listen_done_event
);
LeaveCriticalSection
(
&
listen_cs
);
}
return
RPC_S_OK
;
}
static
BOOL
RPCRT4_protseq_is_endpoint_registered
(
RpcServerProtseq
*
protseq
,
const
char
*
endpoint
)
...
...
@@ -1527,25 +1528,23 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
TRACE
(
"()
\n
"
);
EnterCriticalSection
(
&
listen_cs
);
if
(
!
std_listen
)
{
LeaveCriticalSection
(
&
listen_cs
);
return
RPC_S_NOT_LISTENING
;
}
if
(
listen_done_event
)
{
LeaveCriticalSection
(
&
listen_cs
);
return
RPC_S_ALREADY_LISTENING
;
}
event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
);
listen_done_event
=
event
;
event
=
listen_done_event
;
LeaveCriticalSection
(
&
listen_cs
);
if
(
!
event
)
return
RPC_S_NOT_LISTENING
;
TRACE
(
"waiting for server calls to finish
\n
"
);
WaitForSingleObject
(
event
,
INFINITE
);
TRACE
(
"done waiting
\n
"
);
CloseHandle
(
event
);
EnterCriticalSection
(
&
listen_cs
);
if
(
listen_done_event
==
event
)
{
listen_done_event
=
NULL
;
CloseHandle
(
event
);
}
LeaveCriticalSection
(
&
listen_cs
);
return
RPC_S_OK
;
}
...
...
@@ -1671,7 +1670,7 @@ RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
status
=
RPCRT4_IsServerListening
(
rpc_binding
->
Protseq
,
rpc_binding
->
Endpoint
);
}
else
{
EnterCriticalSection
(
&
listen_cs
);
if
(
manual_listen_count
>
0
)
status
=
RPC_S_OK
;
if
(
listen_done_event
&&
std_listen
)
status
=
RPC_S_OK
;
LeaveCriticalSection
(
&
listen_cs
);
}
...
...
dlls/rpcrt4/tests/rpc.c
View file @
d0ed6d10
...
...
@@ -250,10 +250,8 @@ static void test_rpc_ncacn_ip_tcp(void)
ok
(
status
==
RPC_S_OK
,
"RpcServerListen failed (%u)
\n
"
,
status
);
status
=
RpcServerListen
(
1
,
20
,
TRUE
);
todo_wine
{
ok
(
status
==
RPC_S_ALREADY_LISTENING
,
"wrong RpcServerListen error (%u)
\n
"
,
status
);
}
status
=
RpcStringBindingComposeA
(
NULL
,
ncacn_ip_tcp
,
address
,
endpoint
,
NULL
,
&
binding
);
...
...
@@ -301,9 +299,7 @@ todo_wine {
ok
(
status
==
RPC_S_OK
,
"RpcServerUnregisterIf failed (%u)
\n
"
,
status
);
status
=
RpcMgmtWaitServerListen
();
todo_wine
{
ok
(
status
==
RPC_S_OK
,
"RpcMgmtWaitServerListen failed (%u)
\n
"
,
status
);
}
status
=
RpcStringFreeA
(
&
binding
);
ok
(
status
==
RPC_S_OK
,
"RpcStringFree failed (%u)
\n
"
,
status
);
...
...
dlls/rpcrt4/tests/server.c
View file @
d0ed6d10
...
...
@@ -1752,9 +1752,7 @@ server(void)
if
(
ret
==
WAIT_OBJECT_0
)
{
status
=
RpcMgmtWaitServerListen
();
todo_wine
{
ok
(
status
==
RPC_S_OK
,
"RpcMgmtWaitServerListening failed with status %d
\n
"
,
status
);
}
ok
(
status
==
RPC_S_OK
,
"RpcMgmtWaitServerListening failed with status %d
\n
"
,
status
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment