[Boost-bugs] [Boost C++ Libraries] #12925: boost::asio::ip::tcp::socket::async_read_some() changes socket to non-blocking

Subject: [Boost-bugs] [Boost C++ Libraries] #12925: boost::asio::ip::tcp::socket::async_read_some() changes socket to non-blocking
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-03-23 09:54:12


#12925: boost::asio::ip::tcp::socket::async_read_some() changes socket to non-
blocking
------------------------------------------+----------------------------
 Reporter: yogevch@… | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: asio
  Version: Boost 1.60.0 | Severity: Problem
 Keywords: async_read_some non-blocking |
------------------------------------------+----------------------------
 I'm not sure if it's an issue or not, so I'll try to explain without lots
 of code examples:

 I have a socket:

 {{{
 boost::asio::ip::tcp::socket sock(ioservice);
 sock.open(boost::asio::ip::tcp::v4());
 }}}

 I've connected the socket to external application with a third party API,
 which is a blocking call (for a blocking socket):

 {{{
 third_party_connect(sock.native(), ip);
 }}}

 And waited for some data on this socket:

 {{{
 mSubSock.async_read_some(boost::asio::null_buffers(),
 std::bind(&MyClass::OnData, this, std::placeholders::_1));
 }}}

 When MyClass::OnData got called, I've noticed that the socket turned to
 non blocking socket:
 {{{
 sock.native_non_blocking(); -> returns 'true'
 anotherThirdPartyAPI(sub.native()); -> fails with EAGAIN because socket
 turned to non-blocking
 }}}

 Then another third party API call fails inside the MyClass::OnData
 function with errno: EAGAIN.

 Is this the expected behaviour? why did my socket changed to non-blocking?
 (I've checked before the call to 'async_read_some' and it was blocking).
 I hope I was clear enough.
 Thanks

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12925>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-03-23 09:57:34 UTC