|
|
|
@ -83,6 +83,7 @@ namespace network
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
ensureNoLinger();
|
|
|
|
if (m_socket.is_open()) {
|
|
|
|
if (m_socket.is_open()) {
|
|
|
|
m_socket.close();
|
|
|
|
m_socket.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -90,6 +91,14 @@ namespace network
|
|
|
|
catch(const std::exception&) { /* ignore */ }
|
|
|
|
catch(const std::exception&) { /* ignore */ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>Helper to enable the SO_LINGER socket option during shutdown.</summary>
|
|
|
|
|
|
|
|
void ensureNoLinger()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// enable SO_LINGER timeout 0
|
|
|
|
|
|
|
|
asio::socket_base::linger linger(true, 0);
|
|
|
|
|
|
|
|
m_socket.set_option(linger);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>Perform an synchronous write operation.</summary>
|
|
|
|
/// <summary>Perform an synchronous write operation.</summary>
|
|
|
|
void send(HTTPPayload request)
|
|
|
|
void send(HTTPPayload request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -126,9 +135,7 @@ namespace network
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (ec != asio::error::operation_aborted) {
|
|
|
|
else if (ec != asio::error::operation_aborted) {
|
|
|
|
if (m_socket.is_open()) {
|
|
|
|
stop();
|
|
|
|
m_socket.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|