Commit a3999d77 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Implement WsResetListener.

parent 9cacff8e
...@@ -361,6 +361,38 @@ HRESULT WINAPI WsCloseListener( WS_LISTENER *handle, const WS_ASYNC_CONTEXT *ctx ...@@ -361,6 +361,38 @@ HRESULT WINAPI WsCloseListener( WS_LISTENER *handle, const WS_ASYNC_CONTEXT *ctx
} }
/************************************************************************** /**************************************************************************
* WsResetListener [webservices.@]
*/
HRESULT WINAPI WsResetListener( WS_LISTENER *handle, WS_ERROR *error )
{
struct listener *listener = (struct listener *)handle;
TRACE( "%p %p\n", handle, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!listener) return E_INVALIDARG;
EnterCriticalSection( &listener->cs );
if (listener->magic != LISTENER_MAGIC)
{
LeaveCriticalSection( &listener->cs );
return E_INVALIDARG;
}
if (listener->state != WS_LISTENER_STATE_CREATED && listener->state != WS_LISTENER_STATE_CLOSED)
{
LeaveCriticalSection( &listener->cs );
return WS_E_INVALID_OPERATION;
}
reset_listener( listener );
LeaveCriticalSection( &listener->cs );
return S_OK;
}
/**************************************************************************
* WsGetListenerProperty [webservices.@] * WsGetListenerProperty [webservices.@]
*/ */
HRESULT WINAPI WsGetListenerProperty( WS_LISTENER *handle, WS_LISTENER_PROPERTY_ID id, void *buf, HRESULT WINAPI WsGetListenerProperty( WS_LISTENER *handle, WS_LISTENER_PROPERTY_ID id, void *buf,
......
...@@ -190,9 +190,60 @@ static void test_WsCreateChannelForListener(void) ...@@ -190,9 +190,60 @@ static void test_WsCreateChannelForListener(void)
WsFreeListener( listener ); WsFreeListener( listener );
} }
static void test_WsResetListener(void)
{
WCHAR str[] =
{'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
WS_STRING url = { sizeof(str)/sizeof(str[0]), str };
WS_LISTENER *listener;
WS_LISTENER_STATE state;
WS_LISTENER_PROPERTY prop;
ULONG size, timeout = 1000;
HRESULT hr;
hr = WsResetListener( NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
prop.id = WS_LISTENER_PROPERTY_CONNECT_TIMEOUT;
prop.value = &timeout;
prop.valueSize = sizeof(timeout);
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, &prop, 1, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsResetListener( listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsResetListener( listener, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = WsCloseListener( listener, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsResetListener( listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
state = 0xdeadbeef;
size = sizeof(state);
hr = WsGetListenerProperty( listener, WS_LISTENER_PROPERTY_STATE, &state, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( state == WS_LISTENER_STATE_CREATED, "got %u\n", state );
timeout = 0xdeadbeef;
size = sizeof(timeout);
hr = WsGetListenerProperty( listener, WS_LISTENER_PROPERTY_CONNECT_TIMEOUT, &timeout, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( timeout == 1000, "got %u\n", timeout );
WsFreeListener( listener );
}
START_TEST(listener) START_TEST(listener)
{ {
test_WsCreateListener(); test_WsCreateListener();
test_WsOpenListener(); test_WsOpenListener();
test_WsCreateChannelForListener(); test_WsCreateChannelForListener();
test_WsResetListener();
} }
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
@ stdcall WsResetChannel(ptr ptr) @ stdcall WsResetChannel(ptr ptr)
@ stdcall WsResetError(ptr) @ stdcall WsResetError(ptr)
@ stdcall WsResetHeap(ptr ptr) @ stdcall WsResetHeap(ptr ptr)
@ stub WsResetListener @ stdcall WsResetListener(ptr ptr)
@ stdcall WsResetMessage(ptr ptr) @ stdcall WsResetMessage(ptr ptr)
@ stub WsResetMetadata @ stub WsResetMetadata
@ stub WsResetServiceHost @ stub WsResetServiceHost
......
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