Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60725 - trunk/libs/asio/test/ip
From: chris_at_[hidden]
Date: 2010-03-19 19:59:49


Author: chris_kohlhoff
Date: 2010-03-19 19:59:48 EDT (Fri, 19 Mar 2010)
New Revision: 60725
URL: http://svn.boost.org/trac/boost/changeset/60725

Log:
Use cancel() to avoid Windows behaviour where a connection is reset if the
socket is closed while there is a pending read operation.

Text files modified:
   trunk/libs/asio/test/ip/tcp.cpp | 7 ++++++-
   1 files changed, 6 insertions(+), 1 deletions(-)

Modified: trunk/libs/asio/test/ip/tcp.cpp
==============================================================================
--- trunk/libs/asio/test/ip/tcp.cpp (original)
+++ trunk/libs/asio/test/ip/tcp.cpp 2010-03-19 19:59:48 EDT (Fri, 19 Mar 2010)
@@ -13,6 +13,9 @@
 #define BOOST_ALL_NO_LIB 1
 #endif // !defined(BOOST_ALL_NO_LIB)
 
+// Enable cancel() support on Windows.
+#define BOOST_ASIO_ENABLE_CANCELIO 1
+
 // Test that header file is self-contained.
 #include <boost/asio/ip/tcp.hpp>
 
@@ -444,7 +447,7 @@
   ios.poll();
   BOOST_CHECK(!read_cancel_completed);
 
- server_side_socket.close();
+ server_side_socket.cancel();
 
   ios.reset();
   ios.run();
@@ -460,6 +463,8 @@
         boost::asio::placeholders::bytes_transferred,
         &read_eof_completed));
 
+ server_side_socket.close();
+
   ios.reset();
   ios.run();
   BOOST_CHECK(read_eof_completed);


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