diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-12-02 15:23:03 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-12-02 15:23:03 +0000 |
commit | 2bc3381e5c9922ba6013c8b8cc7809d49057d4d4 (patch) | |
tree | 8e09307dc9a4a57460e4935538f26e4b2601fda0 /winsup/cygwin/fhandler_socket.cc | |
parent | 39276d4bceae7c91479f7e691a833a3991b8ed79 (diff) | |
download | newlib-2bc3381e5c9922ba6013c8b8cc7809d49057d4d4.zip newlib-2bc3381e5c9922ba6013c8b8cc7809d49057d4d4.tar.gz newlib-2bc3381e5c9922ba6013c8b8cc7809d49057d4d4.tar.bz2 |
* fhandler_socket.cc (send_internal): Don't split datagram messages
into pieces.
* syslog.cc (vsyslog): Set default facility to LOG_USER if it hasn't
been set yet.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 5f22d7d..98a64ae 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1613,8 +1613,10 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags) for (DWORD i = 0; i < wsamsg->dwBufferCount; off >= wsamsg->lpBuffers[i].len && (++i, off = 0)) { - /* FIXME? Use the same technique in call to WSASendMsg? */ - if (!use_sendmsg) + /* CV 2009-12-02: Don't split datagram messages. */ + /* FIXME: Look for a way to split a message into the least number of + pieces to minimize the number of WsaSendTo calls. */ + if (get_socket_type () == SOCK_STREAM) { buf.buf = wsamsg->lpBuffers[i].buf + off; buf.len = wsamsg->lpBuffers[i].len - off; @@ -1627,9 +1629,13 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags) { if (use_sendmsg) res = WSASendMsg (get_socket (), wsamsg, flags, &ret, NULL, NULL); - else + else if (get_socket_type () == SOCK_STREAM) res = WSASendTo (get_socket (), &buf, 1, &ret, flags, wsamsg->name, wsamsg->namelen, NULL, NULL); + else + res = WSASendTo (get_socket (), wsamsg->lpBuffers, + wsamsg->dwBufferCount, &ret, flags, + wsamsg->name, wsamsg->namelen, NULL, NULL); if (res && (err = WSAGetLastError ()) == WSAEWOULDBLOCK) { LOCK_EVENTS; @@ -1644,7 +1650,7 @@ fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags) { off += ret; sum += ret; - if (use_sendmsg) + if (get_socket_type () != SOCK_STREAM) break; } else if (is_nonblocking () || err != WSAEWOULDBLOCK) |