winhttp: Factor out socket_send_complete() function.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-01-24 12:43:12 +03:00 committed by Alexandre Julliard
parent c892634244
commit 7dd66e8450
1 changed files with 20 additions and 18 deletions

View File

@ -3240,14 +3240,7 @@ static enum socket_opcode map_buffer_type( WINHTTP_WEB_SOCKET_BUFFER_TYPE type )
} }
} }
static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, const void *buf, DWORD len, static void socket_send_complete( struct socket *socket, DWORD ret, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, DWORD len )
BOOL async )
{
enum socket_opcode opcode = map_buffer_type( type );
DWORD ret;
ret = send_frame( socket, opcode, 0, buf, len, TRUE );
if (async)
{ {
if (!ret) if (!ret)
{ {
@ -3265,6 +3258,15 @@ static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE
send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); send_callback( &socket->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) );
} }
} }
static DWORD socket_send( struct socket *socket, WINHTTP_WEB_SOCKET_BUFFER_TYPE type, const void *buf, DWORD len,
BOOL async )
{
enum socket_opcode opcode = map_buffer_type( type );
DWORD ret;
ret = send_frame( socket, opcode, 0, buf, len, TRUE );
if (async) socket_send_complete( socket, ret, type, len );
return ret; return ret;
} }