Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit a6882f9

Browse files
committed
Fix SendAsync on Unix with multiple buffers
In the implementation of Send{To}Async for a list of array segments, we try to do the send operation, and if it doesn't send the full amount (e.g. because it does one send that's less than the full amount and then tries to complete it but gets an EAGAIN), we then fall back to creating a SendOperation that stores the data to try again later. But the number of bytes sent wasn't being copied into that SendOperation data structure, so although the data had been sent and although we were correctly updating the pointers to what to send next and when we were done sending, the actual total number of BytesTransferred at the end of the operation would be missing the sum from that initial successful set of synchronous sends prior to the EAGAIN. The fix is simply to store the initial bytesSent into BytesTransferred, as is done for every other send operation on SocketAsyncContext.
1 parent 5fa821e commit a6882f9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncContext.Unix.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,7 @@ public SocketError SendToAsync(IList<ArraySegment<byte>> buffers, SocketFlags fl
13851385
Flags = flags,
13861386
SocketAddress = socketAddress,
13871387
SocketAddressLen = socketAddressLen,
1388+
BytesTransferred = bytesSent
13881389
};
13891390

13901391
bool isStopped;

0 commit comments

Comments
 (0)