* fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
WSARecvFrom with fromlen = NULL.
This commit is contained in:
parent
ef1bf288df
commit
2f5e9ace2e
|
@ -1,3 +1,8 @@
|
||||||
|
2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
|
||||||
|
|
||||||
|
* fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
|
||||||
|
WSARecvFrom with fromlen = NULL.
|
||||||
|
|
||||||
2002-11-04 Christopher Faylor <cgf@redhat.com>
|
2002-11-04 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin.
|
* pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin.
|
||||||
|
|
|
@ -734,14 +734,16 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
|
||||||
struct iovec *const iov = msg->msg_iov;
|
struct iovec *const iov = msg->msg_iov;
|
||||||
const int iovcnt = msg->msg_iovlen;
|
const int iovcnt = msg->msg_iovlen;
|
||||||
|
|
||||||
|
struct sockaddr *from = (struct sockaddr *) msg->msg_name;
|
||||||
|
int *fromlen = from ? &msg->msg_namelen : NULL;
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (!winsock2_active)
|
if (!winsock2_active)
|
||||||
{
|
{
|
||||||
if (iovcnt == 1)
|
if (iovcnt == 1)
|
||||||
res = recvfrom (iov->iov_base, iov->iov_len, flags,
|
res = recvfrom (iov->iov_base, iov->iov_len, flags,
|
||||||
(struct sockaddr *) msg->msg_name,
|
from, fromlen);
|
||||||
&msg->msg_namelen);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tot == -1) // i.e. if not pre-calculated by the caller.
|
if (tot == -1) // i.e. if not pre-calculated by the caller.
|
||||||
|
@ -766,8 +768,7 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = recvfrom (buf, tot, flags,
|
res = recvfrom (buf, tot, flags,
|
||||||
(struct sockaddr *) msg->msg_name,
|
from, fromlen);
|
||||||
&msg->msg_namelen);
|
|
||||||
|
|
||||||
const struct iovec *iovptr = iov;
|
const struct iovec *iovptr = iov;
|
||||||
int nbytes = res;
|
int nbytes = res;
|
||||||
|
@ -805,16 +806,14 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot)
|
||||||
if (is_nonblocking ())
|
if (is_nonblocking ())
|
||||||
res = WSARecvFrom (get_socket (),
|
res = WSARecvFrom (get_socket (),
|
||||||
wsabuf, iovcnt, &ret, (DWORD *) &flags,
|
wsabuf, iovcnt, &ret, (DWORD *) &flags,
|
||||||
(struct sockaddr *) msg->msg_name,
|
from, fromlen,
|
||||||
&msg->msg_namelen,
|
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wsock_event wsock_evt;
|
wsock_event wsock_evt;
|
||||||
res = WSARecvFrom (get_socket (),
|
res = WSARecvFrom (get_socket (),
|
||||||
wsabuf, iovcnt, &ret, (DWORD *) &flags,
|
wsabuf, iovcnt, &ret, (DWORD *) &flags,
|
||||||
(struct sockaddr *) msg->msg_name,
|
from, fromlen,
|
||||||
&msg->msg_namelen,
|
|
||||||
wsock_evt.prepare (), NULL);
|
wsock_evt.prepare (), NULL);
|
||||||
|
|
||||||
if (res == SOCKET_ERROR && WSAGetLastError () == WSA_IO_PENDING)
|
if (res == SOCKET_ERROR && WSAGetLastError () == WSA_IO_PENDING)
|
||||||
|
|
Loading…
Reference in New Issue