Boost logo

Boost-Commit :

From: chris_at_[hidden]
Date: 2008-04-20 21:42:10


Author: chris_kohlhoff
Date: 2008-04-20 21:42:10 EDT (Sun, 20 Apr 2008)
New Revision: 44668
URL: http://svn.boost.org/trac/boost/changeset/44668

Log:
Fix infinite recursion in the ssl::stream's shutdown() implementation.

Text files modified:
   trunk/boost/asio/ssl/detail/openssl_operation.hpp | 9 +++------
   1 files changed, 3 insertions(+), 6 deletions(-)

Modified: trunk/boost/asio/ssl/detail/openssl_operation.hpp
==============================================================================
--- trunk/boost/asio/ssl/detail/openssl_operation.hpp (original)
+++ trunk/boost/asio/ssl/detail/openssl_operation.hpp 2008-04-20 21:42:10 EDT (Sun, 20 Apr 2008)
@@ -169,14 +169,11 @@
       ((::SSL_get_shutdown( session_ ) & SSL_SENT_SHUTDOWN) ==
             SSL_SENT_SHUTDOWN);
 
- if (is_shut_down_sent && is_shut_down_received && is_operation_done)
+ if (is_shut_down_sent && is_shut_down_received && is_operation_done && !is_write_needed)
       // SSL connection is shut down cleanly
       return handler_(boost::system::error_code(), 1);
 
- if (is_shut_down_received && !is_write_needed)
- return handler_(boost::asio::error::eof, 0);
-
- if (is_shut_down_received)
+ if (is_shut_down_received && !is_operation_done)
       // Shutdown has been requested, while we were reading or writing...
       // abort our action...
       return handler_(boost::asio::error::shut_down, 0);
@@ -226,7 +223,7 @@
 
         return start();
       }
- else if (is_read_needed)
+ else if (is_read_needed || (is_shut_down_sent && !is_shut_down_received))
       {
         return read_();
       }


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