mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 12:30:58 +00:00
webservices: Check for channel state in WsReceiveMessage.
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9eb26280f3
commit
dc849b0a6d
|
@ -2415,6 +2415,11 @@ HRESULT WINAPI WsReceiveMessage( WS_CHANNEL *handle, WS_MESSAGE *msg, const WS_M
|
|||
LeaveCriticalSection( &channel->cs );
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
if (channel->state != WS_CHANNEL_STATE_OPEN)
|
||||
{
|
||||
LeaveCriticalSection( &channel->cs );
|
||||
return WS_E_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
if (!ctx) async_init( &async, &ctx_local );
|
||||
hr = queue_receive_message( channel, msg, desc, count, option, read_option, heap, value, size, index,
|
||||
|
|
|
@ -626,6 +626,7 @@ static void server_duplex_session( WS_CHANNEL *channel )
|
|||
static void client_duplex_session( const struct listener_info *info )
|
||||
{
|
||||
WS_XML_STRING action = {6, (BYTE *)"action"}, localname = {9, (BYTE *)"localname"}, ns = {2, (BYTE *)"ns"};
|
||||
const WS_MESSAGE_DESCRIPTION *descs[1];
|
||||
WS_ELEMENT_DESCRIPTION desc_body;
|
||||
WS_MESSAGE_DESCRIPTION desc;
|
||||
WS_ENDPOINT_ADDRESS addr;
|
||||
|
@ -645,6 +646,26 @@ static void client_duplex_session( const struct listener_info *info )
|
|||
hr = WsShutdownSessionChannel( channel, NULL, NULL );
|
||||
ok( hr == WS_E_INVALID_OPERATION, "got %#lx\n", hr );
|
||||
|
||||
desc_body.elementLocalName = &localname;
|
||||
desc_body.elementNs = &ns;
|
||||
desc_body.type = WS_INT32_TYPE;
|
||||
desc_body.typeDescription = NULL;
|
||||
desc.action = &action;
|
||||
desc.bodyElementDescription = &desc_body;
|
||||
descs[0] = &desc;
|
||||
|
||||
hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL );
|
||||
ok( hr == S_OK, "got %#lx\n", hr );
|
||||
|
||||
hr = WsReceiveMessage( channel, msg, descs, 1, WS_RECEIVE_REQUIRED_MESSAGE, WS_READ_REQUIRED_VALUE,
|
||||
NULL, &val, sizeof(val), NULL, NULL, NULL );
|
||||
ok( hr == WS_E_INVALID_OPERATION, "got %#lx\n", hr);
|
||||
|
||||
hr = WsSendMessage( channel, msg, &desc, WS_WRITE_REQUIRED_VALUE, &val, sizeof(val), NULL, NULL );
|
||||
ok( hr == WS_E_INVALID_OPERATION, "got %#lx\n", hr );
|
||||
|
||||
WsFreeMessage( msg );
|
||||
|
||||
memset( &addr, 0, sizeof(addr) );
|
||||
addr.url.length = wsprintfW( buf, L"net.tcp://localhost:%u", info->port );
|
||||
addr.url.chars = buf;
|
||||
|
@ -654,13 +675,6 @@ static void client_duplex_session( const struct listener_info *info )
|
|||
hr = WsCreateMessageForChannel( channel, NULL, 0, &msg, NULL );
|
||||
ok( hr == S_OK, "got %#lx\n", hr );
|
||||
|
||||
desc_body.elementLocalName = &localname;
|
||||
desc_body.elementNs = &ns;
|
||||
desc_body.type = WS_INT32_TYPE;
|
||||
desc_body.typeDescription = NULL;
|
||||
desc.action = &action;
|
||||
desc.bodyElementDescription = &desc_body;
|
||||
|
||||
hr = WsSendMessage( channel, msg, &desc, WS_WRITE_REQUIRED_VALUE, &val, sizeof(val), NULL, NULL );
|
||||
ok( hr == S_OK, "got %#lx\n", hr );
|
||||
|
||||
|
|
Loading…
Reference in a new issue