Opened 14 years ago

Closed 14 years ago

#2865 closed Bugs (wontfix)

asio::ip::tcp::socket::is_open returns true while connecting asynchronously

Reported by: Benjamin Carlyle <ben.carlyle@…> Owned by: chris_kohlhoff
Milestone: Boost 1.39.0 Component: asio
Version: Boost 1.38.0 Severity: Problem
Keywords: Cc:

Description

I am using boost 1.38.0 on Linux, and am finding that calls to is_open on an ip::tcp::socket return true as soon as async_connect is called and before the handler for the connection is invoked. This is relatively straightforward to work around, but annoying.

boost/asio/detail/reactive_socket_service.hpp line 216:

bool is_open(const implementation_type& impl) const {

return impl.socket_ != invalid_socket;

}

boost/asio/detail/reactive_socket_service.hpp line 182:

impl.socket_ = sock.release(); (an async_connect is still happening at this time)

Change History (1)

comment:1 by chris_kohlhoff, 14 years ago

Resolution: wontfix
Status: newclosed

This is the intended behaviour. The socket has to be open or otherwise you wouldn't be able to cancel the asynchronous connect operation.

Note: See TracTickets for help on using tickets.