Hello community, here is the log from the commit of package nanomsg for openSUSE:Factory checked in at 2017-11-10 14:57:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nanomsg (Old) and /work/SRC/openSUSE:Factory/.nanomsg.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nanomsg" Fri Nov 10 14:57:25 2017 rev:3 rq:540154 version:1.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/nanomsg/nanomsg.changes 2017-10-23 16:53:00.473482082 +0200 +++ /work/SRC/openSUSE:Factory/.nanomsg.new/nanomsg.changes 2017-11-10 14:57:37.891570073 +0100 @@ -1,0 +2,16 @@ +Tue Nov 7 15:19:02 UTC 2017 - mar...@gmx.de + +- update to version 1.1.2 + This is a bug fix release for 1.1.0. + Two main issues are resolved: + * nanomsg no longer wakes up every 100 msec even when no I/O is + pending + * Some users noticed that nanomsg was performing wakeups + regardless of whether I/O was available or not. + This had a detrimental effect on power usage. + * In some circumstances an outstanding accept() operation that + got aborted (for example due to the socket closing) could wind + up crashing the application. + This was a race, and it is closed now. + +------------------------------------------------------------------- Old: ---- nanomsg-1.1.0.tar.gz New: ---- nanomsg-1.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nanomsg.spec ++++++ --- /var/tmp/diff_new_pack.O7Hdx8/_old 2017-11-10 14:57:39.771502074 +0100 +++ /var/tmp/diff_new_pack.O7Hdx8/_new 2017-11-10 14:57:39.775501930 +0100 @@ -18,7 +18,7 @@ %define sover 5_1_0 Name: nanomsg -Version: 1.1.0 +Version: 1.1.2 Release: 0 Summary: Socket library providing several common communication patterns License: MIT ++++++ nanomsg-1.1.0.tar.gz -> nanomsg-1.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/.version new/nanomsg-1.1.2/.version --- old/nanomsg-1.1.0/.version 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/.version 2017-11-07 01:06:34.000000000 +0100 @@ -1 +1 @@ -1.1.0 +1.1.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/aio/usock_win.inc new/nanomsg-1.1.2/src/aio/usock_win.inc --- old/nanomsg-1.1.0/src/aio/usock_win.inc 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/aio/usock_win.inc 2017-11-07 01:06:34.000000000 +0100 @@ -998,6 +998,17 @@ return; + case NN_WORKER_OP_ERROR: + nn_usock_close(usock->asock); + usock->asock->state = NN_USOCK_STATE_DONE; + nn_fsm_raise (&usock->asock->fsm, &usock->asock->event_error, + NN_USOCK_ERROR); + usock->asock->asock = NULL; + usock->asock = NULL; + /* Wait till the user starts accepting once again. */ + usock->state = NN_USOCK_STATE_LISTENING; + return; + default: nn_fsm_bad_action (usock->state, src, type); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/core/sock.c new/nanomsg-1.1.2/src/core/sock.c --- old/nanomsg-1.1.0/src/core/sock.c 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/core/sock.c 2017-11-07 01:06:34.000000000 +0100 @@ -1,7 +1,8 @@ /* Copyright (c) 2012-2014 Martin Sustrik All rights reserved. Copyright (c) 2013 GoPivotal, Inc. All rights reserved. - Copyright 2016 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Capitar IT Group BV <i...@capitar.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -223,6 +224,14 @@ /* At this point, we can be reasonably certain that no other thread has any references to the socket. */ + /* Close the event FDs entirely. */ + if (!(self->socktype->flags & NN_SOCKTYPE_FLAG_NORECV)) { + nn_efd_term (&self->rcvfd); + } + if (!(self->socktype->flags & NN_SOCKTYPE_FLAG_NOSEND)) { + nn_efd_term (&self->sndfd); + } + nn_fsm_stopped_noevent (&self->fsm); nn_fsm_term (&self->fsm); nn_sem_term (&self->termsem); @@ -904,14 +913,6 @@ sock->sockbase->vfptr->destroy (sock->sockbase); sock->state = NN_SOCK_STATE_FINI; - /* Close the event FDs entirely. */ - if (!(sock->socktype->flags & NN_SOCKTYPE_FLAG_NORECV)) { - nn_efd_term (&sock->rcvfd); - } - if (!(sock->socktype->flags & NN_SOCKTYPE_FLAG_NOSEND)) { - nn_efd_term (&sock->sndfd); - } - /* Now we can unblock the application thread blocked in the nn_close() call. */ nn_sem_post (&sock->termsem); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/chunk.c new/nanomsg-1.1.2/src/utils/chunk.c --- old/nanomsg-1.1.0/src/utils/chunk.c 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/chunk.c 2017-11-07 01:06:34.000000000 +0100 @@ -140,7 +140,7 @@ the tag and prefix. */ empty = (uint8_t *)new_ptr - (uint8_t *)self - hdr_size; nn_putl ((uint8_t*) (((uint32_t*) new_ptr) - 1), NN_CHUNK_TAG); - nn_putl ((uint8_t*) (((uint32_t*) new_ptr) - 2), empty); + nn_putl ((uint8_t*) (((uint32_t*) new_ptr) - 2), (uint32_t) empty); *chunk = p; return (0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/efd.c new/nanomsg-1.1.2/src/utils/efd.c --- old/nanomsg-1.1.0/src/utils/efd.c 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/efd.c 2017-11-07 01:06:34.000000000 +0100 @@ -1,7 +1,9 @@ /* Copyright (c) 2012-2013 Martin Sustrik All rights reserved. - Copyright 2016 Garrett D'Amore <garr...@damore.org> Copyright (c) 2015-2016 Jack R. Dunaway. All rights reserved. + Copyright 2017 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Capitar IT Group BV <i...@capitar.com> + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -45,60 +47,20 @@ { int rc; struct pollfd pfd; - uint64_t expire; - - if (timeout > 0) { - expire = nn_clock_ms() + timeout; - } else { - expire = timeout; - } - /* In order to solve a problem where the poll call doesn't wake up - when a file is closed, we sleep a maximum of 100 msec. This is - a somewhat unfortunate band-aid to prevent hangs caused by a race - condition involving nn_close. In the future this code should be - replaced by a simpler design using condition variables. */ - for (;;) { - pfd.fd = nn_efd_getfd (self); - pfd.events = POLLIN; - if (nn_slow (pfd.fd < 0)) - return -EBADF; - - switch (expire) { - case 0: - /* poll once */ - timeout = 0; - break; - - case (uint64_t)-1: - /* infinite wait */ - timeout = 100; - break; - - default: - /* bounded wait */ - timeout = (int)(expire - nn_clock_ms()); - if (timeout < 0) { - return -ETIMEDOUT; - } - if (timeout > 100) { - timeout = 100; - } - } - rc = poll (&pfd, 1, timeout); - if (nn_slow (rc < 0 && errno == EINTR)) - return -EINTR; - errno_assert (rc >= 0); - if (nn_slow (rc == 0)) { - if (expire == 0) - return -ETIMEDOUT; - if ((expire != (uint64_t)-1) && (expire < nn_clock_ms())) { - return -ETIMEDOUT; - } - continue; - } - return 0; + pfd.fd = nn_efd_getfd (self); + pfd.events = POLLIN; + if (pfd.fd < 0) + return -EBADF; + + rc = poll (&pfd, 1, timeout); + switch (rc) { + case 0: + return -ETIMEDOUT; + case -1: + return (-errno); } + return 0; } #elif defined NN_HAVE_WINDOWS @@ -106,68 +68,31 @@ int nn_efd_wait (struct nn_efd *self, int timeout) { int rc; - struct timeval tv; - SOCKET fd = self->r; - uint64_t expire; - - if (timeout > 0) { - expire = nn_clock_ms() + timeout; - tv.tv_sec = timeout / 1000; - tv.tv_usec = timeout % 1000 * 1000; - } else { - expire = timeout; + WSAPOLLFD pfd; + + pfd.fd = self->r; + if (nn_slow (pfd.fd == INVALID_SOCKET)) { + return -EBADF; } + pfd.events = POLLIN; + rc = WSAPoll(&pfd, 1, timeout); - for (;;) { - if (nn_slow (fd == INVALID_SOCKET)) { - return -EBADF; - } - FD_SET (fd, &self->fds); - switch (expire) { - case 0: - tv.tv_sec = 0; - tv.tv_usec = 0; - break; - case (uint64_t)-1: - tv.tv_sec = 0; - tv.tv_usec = 100000; - break; - default: - timeout = (int)(expire - nn_clock_ms()); - if (timeout < 0) { - return -ETIMEDOUT; - } - if (timeout > 100) { - tv.tv_sec = 0; - tv.tv_usec = 100000; - } else { - tv.tv_sec = timeout / 1000; - tv.tv_usec = timeout % 1000 * 1000; - } + switch (rc) { + case 0: + return -ETIMEDOUT; + case SOCKET_ERROR: + rc = nn_err_wsa_to_posix (WSAGetLastError ()); + errno = rc; + + /* Treat these as a non-fatal errors, typically occuring when the + socket is being closed from a separate thread during a blocking + I/O operation. */ + if (rc == EINTR || rc == ENOTSOCK) { + return self->r == INVALID_SOCKET ? -EBADF : -EINTR; } - rc = select (0, &self->fds, NULL, NULL, &tv); - - if (nn_slow (rc == SOCKET_ERROR)) { - rc = nn_err_wsa_to_posix (WSAGetLastError ()); - errno = rc; - - /* Treat these as a non-fatal errors, typically occuring when the - socket is being closed from a separate thread during a blocking - I/O operation. */ - if (rc == EINTR || rc == ENOTSOCK) - return self->r == INVALID_SOCKET ? -EBADF : -EINTR; - } else if (rc == 0) { - if (expire == 0) - return -ETIMEDOUT; - if ((expire != (uint64_t)-1) && (expire < nn_clock_ms())) { - return -ETIMEDOUT; - } - continue; - } - - wsa_assert (rc >= 0); - return 0; + return (-rc); } + return (0); } #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/efd_win.h new/nanomsg-1.1.2/src/utils/efd_win.h --- old/nanomsg-1.1.0/src/utils/efd_win.h 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/efd_win.h 2017-11-07 01:06:34.000000000 +0100 @@ -1,5 +1,7 @@ /* Copyright (c) 2012-2013 Martin Sustrik All rights reserved. + Copyright 2017 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Capitar IT Group BV <i...@capitar.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -25,6 +27,5 @@ struct nn_efd { SOCKET r; SOCKET w; - fd_set fds; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/efd_win.inc new/nanomsg-1.1.2/src/utils/efd_win.inc --- old/nanomsg-1.1.0/src/utils/efd_win.inc 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/efd_win.inc 2017-11-07 01:06:34.000000000 +0100 @@ -1,6 +1,8 @@ /* Copyright (c) 2012-2013 Martin Sustrik All rights reserved. - Copyright 2015 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Capitar IT Group BV <i...@capitar.com> + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -186,9 +188,6 @@ rc = ioctlsocket (self->r, FIONBIO, &nonblock); wsa_assert (rc != SOCKET_ERROR); - /* Initialise the pre-allocated pollset. */ - FD_ZERO (&self->fds); - return 0; wsafail: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/strcasestr.c new/nanomsg-1.1.2/src/utils/strcasestr.c --- old/nanomsg-1.1.0/src/utils/strcasestr.c 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/strcasestr.c 2017-11-07 01:06:34.000000000 +0100 @@ -28,7 +28,7 @@ const char * nn_strcasestr(const char *str, const char *key) { - int len = strlen(key); + size_t len = strlen(key); while (*str != '\0') { if (nn_strncasecmp(str, key, len) == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/strncasecmp.c new/nanomsg-1.1.2/src/utils/strncasecmp.c --- old/nanomsg-1.1.0/src/utils/strncasecmp.c 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/strncasecmp.c 2017-11-07 01:06:34.000000000 +0100 @@ -1,5 +1,5 @@ /* - Copyright 2016 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Garrett D'Amore <garr...@damore.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -24,10 +24,10 @@ #include "strncasecmp.h" int -nn_strncasecmp(const char *a, const char *b, int len) +nn_strncasecmp(const char *a, const char *b, size_t len) { int rv; - int count; + size_t count; for (count = 0; count < len; count++) { if ((*a == 0) && (*b == 0)) { return (0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nanomsg-1.1.0/src/utils/strncasecmp.h new/nanomsg-1.1.2/src/utils/strncasecmp.h --- old/nanomsg-1.1.0/src/utils/strncasecmp.h 2017-10-18 03:17:21.000000000 +0200 +++ new/nanomsg-1.1.2/src/utils/strncasecmp.h 2017-11-07 01:06:34.000000000 +0100 @@ -1,5 +1,5 @@ /* - Copyright 2016 Garrett D'Amore <garr...@damore.org> + Copyright 2017 Garrett D'Amore <garr...@damore.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -23,6 +23,8 @@ #ifndef NN_STRNCASECMP_INCLUDED #define NN_STRNCASECMP_INCLUDED -extern int nn_strncasecmp(const char *, const char *, int); +#include <stdlib.h> + +extern int nn_strncasecmp(const char *, const char *, size_t); #endif /* NN_STRNCASECMP_INCLUDED */