* fhandler.h (class fhandler_socket): Add class members and methods

to store and retrieve the SO_RCVBUF and SO_SNDBUF sizes.
	* fhandler_socket.cc (fhandler_socket::dup): Duplicate new members.
	(fhandler_socket::send_internal): Check for SO_SNDBUF size and
	restrict send to 1 byte less per KB 823764.  Leave loop immediately
	if WSASendMsg has been used.
	* net.cc (fdsock): Change comment again.  Set buffer sizes to 65536.
	Store values in fhandler_socket.
	(cygwin_setsockopt): Store SO_RCVBUF and SO_SNDBUF sizes in
	fhandler_socket.
	(cygwin_sendto): Drop call to sig_dispatch_pending.
	(cygwin_recvfrom): Ditto.
	(cygwin_recvmsg): Ditto.
	(cygwin_sendmsg): Ditto.
This commit is contained in:
Corinna Vinschen
2009-07-01 09:16:17 +00:00
parent b4fa816474
commit 975a630109
4 changed files with 68 additions and 17 deletions

View File

@ -657,6 +657,8 @@ fhandler_socket::dup (fhandler_base *child)
}
fhs->wsock_events = wsock_events;
fhs->rmem (rmem ());
fhs->wmem (wmem ());
fhs->addr_family = addr_family;
fhs->set_socket_type (get_socket_type ());
if (get_addr_family () == AF_LOCAL)
@ -1487,10 +1489,15 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
for (DWORD i = 0; i < wsamsg->dwBufferCount;
off >= wsamsg->lpBuffers[i].len && (++i, off = 0))
{
buf.buf = wsamsg->lpBuffers[i].buf + off;
buf.len = wsamsg->lpBuffers[i].len - off;
if (buf.len > 65520) /* See net.cc:fdsock() and MSDN KB 823764 */
buf.len = 65520;
/* FIXME? Use the same technique in call to WSASendMsg? */
if (!use_sendmsg)
{
buf.buf = wsamsg->lpBuffers[i].buf + off;
buf.len = wsamsg->lpBuffers[i].len - off;
/* See net.cc:fdsock() and MSDN KB 823764 */
if (buf.len >= (unsigned) wmem ())
buf.len = (unsigned) wmem () - 1;
}
do
{
@ -1513,6 +1520,8 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags)
{
off += ret;
sum += ret;
if (use_sendmsg)
break;
}
else if (is_nonblocking () || err != WSAEWOULDBLOCK)
break;