"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/aio/usock_posix.inc" between
nanomsg-1.1.4.tar.gz and nanomsg-1.1.5.tar.gz

About: nanomsg is a socket library that provides several common communication patterns. It aims to make the networking layer fast, scalable, and easy to use.

usock_posix.inc  (nanomsg-1.1.4):usock_posix.inc  (nanomsg-1.1.5)
skipping to change at line 1088 skipping to change at line 1088
{ {
size_t sz; size_t sz;
size_t length; size_t length;
ssize_t nbytes; ssize_t nbytes;
struct iovec iov; struct iovec iov;
struct msghdr hdr; struct msghdr hdr;
unsigned char ctrl [256]; unsigned char ctrl [256];
#if defined NN_HAVE_MSG_CONTROL #if defined NN_HAVE_MSG_CONTROL
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
#endif #endif
int fd;
/* If batch buffer doesn't exist, allocate it. The point of delayed /* If batch buffer doesn't exist, allocate it. The point of delayed
deallocation to allow non-receiving sockets, such as TCP listening deallocation to allow non-receiving sockets, such as TCP listening
sockets, to do without the batch buffer. */ sockets, to do without the batch buffer. */
if (nn_slow (!self->in.batch)) { if (nn_slow (!self->in.batch)) {
self->in.batch = nn_alloc (NN_USOCK_BATCH_SIZE, "AIO batch buffer"); self->in.batch = nn_alloc (NN_USOCK_BATCH_SIZE, "AIO batch buffer");
alloc_assert (self->in.batch); alloc_assert (self->in.batch);
} }
/* Try to satisfy the recv request by data from the batch buffer. */ /* Try to satisfy the recv request by data from the batch buffer. */
skipping to change at line 1155 skipping to change at line 1156
/* If the peer closes the connection, return ECONNRESET. */ /* If the peer closes the connection, return ECONNRESET. */
return -ECONNRESET; return -ECONNRESET;
} }
} }
/* Extract the associated file descriptor, if any. */ /* Extract the associated file descriptor, if any. */
if (nbytes > 0) { if (nbytes > 0) {
#if defined NN_HAVE_MSG_CONTROL #if defined NN_HAVE_MSG_CONTROL
cmsg = CMSG_FIRSTHDR (&hdr); cmsg = CMSG_FIRSTHDR (&hdr);
while (cmsg) { while (cmsg) {
if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) if (cmsg->cmsg_level == SOL_SOCKET &&
{ cmsg->cmsg_type == SCM_RIGHTS) {
if (self->in.pfd) { if (self->in.pfd) {
*self->in.pfd = *((int*) CMSG_DATA (cmsg)); memcpy (self->in.pfd, CMSG_DATA (cmsg),
sizeof (*self->in.pfd));
self->in.pfd = NULL; self->in.pfd = NULL;
} }
else { else {
nn_closefd (*((int*) CMSG_DATA (cmsg))); memcpy (&fd, CMSG_DATA (cmsg), sizeof (fd));
nn_closefd (fd);
} }
break; break;
} }
cmsg = CMSG_NXTHDR (&hdr, cmsg); cmsg = CMSG_NXTHDR (&hdr, cmsg);
} }
#else #else
if (hdr.msg_accrightslen > 0) { if (hdr.msg_accrightslen > 0) {
nn_assert (hdr.msg_accrightslen == sizeof (int)); nn_assert (hdr.msg_accrightslen == sizeof (int));
if (self->in.pfd) { if (self->in.pfd) {
*self->in.pfd = *((int*) hdr.msg_accrights); memcpy (self->in.pfd, hdr.msg_accrights,
sizeof (*self->in.pfd));
self->in.pfd = NULL; self->in.pfd = NULL;
} }
else { else {
nn_closefd (*((int*) hdr.msg_accrights)); memcpy (&fd, hdr.msg_accrights, sizeof (fd));
nn_closefd (fd);
} }
} }
#endif #endif
} }
/* If the data were received directly into the place we can return /* If the data were received directly into the place we can return
straight away. */ straight away. */
if (length > NN_USOCK_BATCH_SIZE) { if (length > NN_USOCK_BATCH_SIZE) {
length -= nbytes; length -= nbytes;
*len -= length; *len -= length;
 End of changes. 6 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)