Update TransmitFile sent bytes to be the actual number sent instead of the attempted bytes.

This commit is contained in:
Erich E. Hoover 2014-08-22 13:29:56 -06:00
parent 19ff1ed17c
commit 1ccb2f1d1e
3 changed files with 19 additions and 18 deletions

View File

@ -1,18 +1,18 @@
From 882d1b1d21aeccfca1dbb6a25168fafa10ee91bf Mon Sep 17 00:00:00 2001
From 87a9e724ea4529250b5e194265fd81019b76eea9 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 18:24:27 -0700
Subject: ws2_32: Implement a basic synchronous TransmitFile.
---
dlls/ws2_32/socket.c | 65 +++++++++++++++++++++++++++++++++++++++++-
dlls/ws2_32/socket.c | 66 +++++++++++++++++++++++++++++++++++++++++-
dlls/ws2_32/tests/sock.c | 71 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 134 insertions(+), 2 deletions(-)
2 files changed, 135 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 597b248..b4e45df 100644
index 597b248..322c5ed 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2485,6 +2485,64 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
@@ -2485,6 +2485,65 @@ static BOOL WINAPI WS2_AcceptEx(SOCKET listener, SOCKET acceptor, PVOID dest, DW
}
/***********************************************************************
@ -56,7 +56,8 @@ index 597b248..b4e45df 100644
+ break;
+ else if(!ok)
+ goto cleanup;
+ if (WS_send( s, buffer, n, 0 ) == SOCKET_ERROR)
+ n = WS_send( s, buffer, n, 0 );
+ if (n == SOCKET_ERROR)
+ goto cleanup;
+ bytes_sent += n;
+ } while(total_bytes == 0 || bytes_sent < total_bytes);
@ -77,7 +78,7 @@ index 597b248..b4e45df 100644
* TransmitFile
*/
static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send,
@@ -2494,7 +2552,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2494,7 +2553,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
unsigned int uaddrlen = sizeof(uaddr);
int fd;
@ -86,7 +87,7 @@ index 597b248..b4e45df 100644
flags );
fd = get_sock_fd( s, 0, NULL );
@@ -2513,6 +2571,11 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2513,6 +2572,11 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
if (flags)
FIXME("Flags are not currently supported (0x%x).\n", flags);

View File

@ -1,4 +1,4 @@
From 519fb92c76fd924bd3cc00181ddd69231f12549e Mon Sep 17 00:00:00 2001
From 7e7370ad1ee7cba45ad65bdf02d41ff9171c00e8 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 18:24:53 -0700
Subject: ws2_32: Add asynchronous support for TransmitFile.
@ -9,7 +9,7 @@ Subject: ws2_32: Add asynchronous support for TransmitFile.
2 files changed, 124 insertions(+), 9 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index b4e45df..3b54e3e 100644
index 322c5ed..1c30bd1 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -364,6 +364,18 @@ typedef struct ws2_accept_async
@ -48,7 +48,7 @@ index b4e45df..3b54e3e 100644
/* read and send the data from the file */
do
{
@@ -2543,6 +2565,32 @@ cleanup:
@@ -2544,6 +2566,32 @@ cleanup:
}
/***********************************************************************
@ -81,7 +81,7 @@ index b4e45df..3b54e3e 100644
* TransmitFile
*/
static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWORD bytes_per_send,
@@ -2550,7 +2598,9 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2551,7 +2599,9 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
{
union generic_unix_sockaddr uaddr;
unsigned int uaddrlen = sizeof(uaddr);
@ -92,7 +92,7 @@ index b4e45df..3b54e3e 100644
TRACE("(%lx, %p, %d, %d, %p, %p, %d): stub !\n", s, h, total_bytes, bytes_per_send, overlapped, buffers,
flags );
@@ -2574,9 +2624,37 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2575,9 +2625,37 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
if (!overlapped)
return WS2_transmitfile_base( s, h, total_bytes, bytes_per_send, overlapped, buffers, flags );

View File

@ -1,4 +1,4 @@
From 0e7bb2d1abdc6b27fb6b48520780a39c12343de8 Mon Sep 17 00:00:00 2001
From 0e0a27b0e40f55fbca7eb4c9fefa55d2b85ba6d4 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 16 Jan 2014 19:08:30 -0700
Subject: ws2_32: Add support for TF_DISCONNECT and TF_REUSE_SOCKET to
@ -13,10 +13,10 @@ Subject: ws2_32: Add support for TF_DISCONNECT and TF_REUSE_SOCKET to
5 files changed, 89 insertions(+), 12 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 3b54e3e..172b131 100644
index 1c30bd1..b200e93 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2557,6 +2557,18 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD
@@ -2558,6 +2558,18 @@ static BOOL WS2_transmitfile_base( SOCKET s, HANDLE h, DWORD total_bytes, DWORD
if (buffers && WS_send( s, buffers->Tail, buffers->TailLength, 0 ) == SOCKET_ERROR)
goto cleanup;
@ -35,7 +35,7 @@ index 3b54e3e..172b131 100644
ret = TRUE;
cleanup:
@@ -2598,6 +2610,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2599,6 +2611,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
{
union generic_unix_sockaddr uaddr;
unsigned int uaddrlen = sizeof(uaddr);
@ -43,7 +43,7 @@ index 3b54e3e..172b131 100644
IO_STATUS_BLOCK *iosb = (IO_STATUS_BLOCK *)overlapped;
struct ws2_transmitfile_async *wsa;
int status, fd;
@@ -2618,8 +2631,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
@@ -2619,8 +2632,8 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD total_bytes, DWOR
return FALSE;
}
release_sock_fd( s, fd );