Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-08-08 21:59:55


Author: chris_kohlhoff
Date: 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
New Revision: 48040
URL: http://svn.boost.org/trac/boost/changeset/48040

Log:
Merge critical bug fixes from trunk.

........
  r48031 | chris_kohlhoff | 2008-08-09 00:47:58 +1000 (Sat, 09 Aug 2008) | 4 lines
  
  Fix a tight spin on epoll (or /dev/poll) that occurs when the EPOLLERR and
  EPOLLHUP events are reported for a descriptor and there are no pending
  operations.
........
  r48032 | chris_kohlhoff | 2008-08-09 00:48:24 +1000 (Sat, 09 Aug 2008) | 2 lines
  
  Fix memory leak in use_tmp_dh_file().
........
  r48033 | chris_kohlhoff | 2008-08-09 00:49:23 +1000 (Sat, 09 Aug 2008) | 2 lines
  
  QNX defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but does not implement them.
........
  r48039 | chris_kohlhoff | 2008-08-09 11:47:11 +1000 (Sat, 09 Aug 2008) | 2 lines
  
  Include CREAD and CLOCAL in the default flags for serial ports.
........

Properties modified:
   branches/release/ (props changed)
Text files modified:
   branches/release/boost/asio/detail/dev_poll_reactor.hpp | 15 ++++++++-------
   branches/release/boost/asio/detail/epoll_reactor.hpp | 15 ++++++++-------
   branches/release/boost/asio/detail/reactive_serial_port_service.hpp | 1 +
   branches/release/boost/asio/ip/resolver_query_base.hpp | 8 +++++---
   branches/release/boost/asio/ssl/detail/openssl_context_service.hpp | 2 +-
   5 files changed, 23 insertions(+), 18 deletions(-)

Modified: branches/release/boost/asio/detail/dev_poll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/dev_poll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/dev_poll_reactor.hpp 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
@@ -423,14 +423,15 @@
         else
           more_writes = write_op_queue_.has_operation(descriptor);
 
- if ((events[i].events == POLLHUP)
- && !more_except && !more_reads && !more_writes)
+ if ((events[i].events & (POLLERR | POLLHUP)) != 0
+ && (events[i].events & ~(POLLERR | POLLHUP)) == 0
+ && !more_except && !more_reads && !more_writes)
         {
- // If we have only an POLLHUP event and no operations associated
- // with the descriptor then we need to delete the descriptor from
- // /dev/poll. The poll operation might produce POLLHUP events even
- // if they are not specifically requested, so if we do not remove the
- // descriptor we can end up in a tight polling loop.
+ // If we have an event and no operations associated with the
+ // descriptor then we need to delete the descriptor from /dev/poll.
+ // The poll operation can produce POLLHUP or POLLERR events when there
+ // is no operation pending, so if we do not remove the descriptor we
+ // can end up in a tight polling loop.
           ::pollfd ev = { 0 };
           ev.fd = descriptor;
           ev.events = POLLREMOVE;

Modified: branches/release/boost/asio/detail/epoll_reactor.hpp
==============================================================================
--- branches/release/boost/asio/detail/epoll_reactor.hpp (original)
+++ branches/release/boost/asio/detail/epoll_reactor.hpp 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
@@ -497,14 +497,15 @@
         else
           more_writes = write_op_queue_.has_operation(descriptor);
 
- if ((events[i].events == EPOLLHUP)
- && !more_except && !more_reads && !more_writes)
+ if ((events[i].events & (EPOLLERR | EPOLLHUP)) != 0
+ && (events[i].events & ~(EPOLLERR | EPOLLHUP)) == 0
+ && !more_except && !more_reads && !more_writes)
         {
- // If we have only an EPOLLHUP event and no operations associated
- // with the descriptor then we need to delete the descriptor from
- // epoll. The epoll_wait system call will produce EPOLLHUP events
- // even if they are not specifically requested, so if we do not
- // remove the descriptor we can end up in a tight loop of repeated
+ // If we have an event and no operations associated with the
+ // descriptor then we need to delete the descriptor from epoll. The
+ // epoll_wait system call can produce EPOLLHUP or EPOLLERR events
+ // when there is no operation pending, so if we do not remove the
+ // descriptor we can end up in a tight loop of repeated
           // calls to epoll_wait.
           epoll_event ev = { 0, { 0 } };
           epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev);

Modified: branches/release/boost/asio/detail/reactive_serial_port_service.hpp
==============================================================================
--- branches/release/boost/asio/detail/reactive_serial_port_service.hpp (original)
+++ branches/release/boost/asio/detail/reactive_serial_port_service.hpp 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
@@ -120,6 +120,7 @@
       ios.c_cflag |= CS8;
 #endif
       ios.c_iflag |= IGNPAR;
+ ios.c_cflag |= CREAD | CLOCAL;
       descriptor_ops::clear_error(ec);
       s = descriptor_ops::error_wrapper(::tcsetattr(fd, TCSANOW, &ios), ec);
     }

Modified: branches/release/boost/asio/ip/resolver_query_base.hpp
==============================================================================
--- branches/release/boost/asio/ip/resolver_query_base.hpp (original)
+++ branches/release/boost/asio/ip/resolver_query_base.hpp 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
@@ -70,17 +70,19 @@
 # else
   BOOST_STATIC_CONSTANT(int, numeric_service = 0);
 # endif
-# if defined(AI_V4MAPPED)
+ // Note: QNX Neutrino 6.3 defines AI_V4MAPPED, AI_ALL and AI_ADDRCONFIG but
+ // does not implement them. Therefore they are specifically excluded here.
+# if defined(AI_V4MAPPED) && !defined(__QNXNTO__)
   BOOST_STATIC_CONSTANT(int, v4_mapped = AI_V4MAPPED);
 # else
   BOOST_STATIC_CONSTANT(int, v4_mapped = 0);
 # endif
-# if defined(AI_ALL)
+# if defined(AI_ALL) && !defined(__QNXNTO__)
   BOOST_STATIC_CONSTANT(int, all_matching = AI_ALL);
 # else
   BOOST_STATIC_CONSTANT(int, all_matching = 0);
 # endif
-# if defined(AI_ADDRCONFIG)
+# if defined(AI_ADDRCONFIG) && !defined(__QNXNTO__)
   BOOST_STATIC_CONSTANT(int, address_configured = AI_ADDRCONFIG);
 # else
   BOOST_STATIC_CONSTANT(int, address_configured = 0);

Modified: branches/release/boost/asio/ssl/detail/openssl_context_service.hpp
==============================================================================
--- branches/release/boost/asio/ssl/detail/openssl_context_service.hpp (original)
+++ branches/release/boost/asio/ssl/detail/openssl_context_service.hpp 2008-08-08 21:59:54 EDT (Fri, 08 Aug 2008)
@@ -309,9 +309,9 @@
 
     ::BIO_free(bio);
     int result = ::SSL_CTX_set_tmp_dh(impl, dh);
+ ::DH_free(dh);
     if (result != 1)
     {
- ::DH_free(dh);
       ec = boost::asio::error::invalid_argument;
       return ec;
     }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk