rpcrt4: Fix RpcMgmtStopServerListening() return value when we're not listening.

This commit is contained in:
Nikolay Sivov 2015-03-25 23:36:46 +03:00 committed by Alexandre Julliard
parent fd25d9aadb
commit 73a68b065b
2 changed files with 15 additions and 10 deletions

View file

@ -762,9 +762,18 @@ static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
return status;
}
static void RPCRT4_stop_listen(BOOL auto_listen)
static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
{
RPC_STATUS status = RPC_S_OK;
EnterCriticalSection(&listen_cs);
if (!std_listen)
{
status = RPC_S_NOT_LISTENING;
goto done;
}
if (auto_listen || (--manual_listen_count == 0))
{
if (listen_count != 0 && --listen_count == 0) {
@ -779,12 +788,14 @@ static void RPCRT4_stop_listen(BOOL auto_listen)
EnterCriticalSection(&listen_cs);
if (listen_done_event) SetEvent( listen_done_event );
listen_done_event = 0;
LeaveCriticalSection(&listen_cs);
return;
goto done;
}
assert(listen_count >= 0);
}
done:
LeaveCriticalSection(&listen_cs);
return status;
}
static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint)
@ -1560,9 +1571,7 @@ RPC_STATUS WINAPI RpcMgmtStopServerListening ( RPC_BINDING_HANDLE Binding )
return RPC_S_WRONG_KIND_OF_BINDING;
}
RPCRT4_stop_listen(FALSE);
return RPC_S_OK;
return RPCRT4_stop_listen(FALSE);
}
/***********************************************************************

View file

@ -224,10 +224,8 @@ static void test_rpc_ncacn_ip_tcp(void)
ok(status == RPC_S_OK, "return wrong\n");
status = RpcMgmtStopServerListening(NULL);
todo_wine {
ok(status == RPC_S_NOT_LISTENING,
"wrong RpcMgmtStopServerListening error (%u)\n", status);
}
status = RpcMgmtWaitServerListen();
ok(status == RPC_S_NOT_LISTENING,
@ -244,9 +242,7 @@ todo_wine {
ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
status = RpcServerListen(1, 20, TRUE);
todo_wine {
ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
}
status = RpcServerListen(1, 20, TRUE);
todo_wine {