Opened 6 years ago

#12545 new Bugs

stream_socket_service forcibly takes responsibility for closing the native_handle

Reported by: Adrien CLERC <adrien.clerc@…> Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.61.0 Severity: Problem
Keywords: native_handle close Cc:

Description

When using the basic_stream_socket constructor with a native_handle_type, it seems that the service will call close() on it upon destruction.

I have no expectation on this behavior, but this should be stressed in the documentation. Using this constructor (or the assign() method) is very handy when dealing with third-parties, but those very same third-parties can have the same policy of auto-closing.

This will lead to double closing, which is the best way for data corruption in a process that constantly opens and closes files.

I will go for a call to dup() before using the ip::tcp::socket for now.

Change History (0)

Note: See TracTickets for help on using tickets.