* fhandler_socket.cc (fhandler_socket::send_internal): Fix value of

out_len when tweaking the last buffer so out_len is correct in a
	subsequent if expression.
This commit is contained in:
Corinna Vinschen 2014-07-24 13:21:02 +00:00
parent e4994e769e
commit c999d29a7b
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2014-07-24 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (fhandler_socket::send_internal): Fix value of
out_len when tweaking the last buffer so out_len is correct in a
subsequent if expression.
2014-07-21 Corinna Vinschen <corinna@vinschen.de>
* thread.cc (pthread::init_mainthread): Initialize thread mutex to

View File

@ -1701,9 +1701,13 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
while (out_len < (unsigned) wmem ()
&& (in_off = 0, ++in_idx < wsamsg->dwBufferCount));
/* Tweak len of the last out_buf buffer so the entire number of bytes
is less than wmem (). */
is (less than or) equal to wmem (). Fix out_len as well since it's
used in a subsequent test expression. */
if (out_len > (unsigned) wmem ())
out_buf[out_idx - 1].len -= out_len - (unsigned) wmem ();
{
out_buf[out_idx - 1].len -= out_len - (unsigned) wmem ();
out_len = (unsigned) wmem ();
}
/* Add the bytes written from the current last buffer to in_off,
so in_off points to the next byte to be written from that buffer,
or beyond which lets the outper loop skip to the next buffer. */