Skip to content
Snippets Groups Projects
Commit b4ffc568 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Protocols.HTTP.Query: Do not wait for close() to complete.

Do not wait for SSL.File()->close() to complete when called
from the destruct() callback.

Potential fix for [PIKE-84].
parent 8e06a314
No related branches found
No related tags found
No related merge requests found
...@@ -168,12 +168,28 @@ protected int ponder_answer( int|void start_position ) ...@@ -168,12 +168,28 @@ protected int ponder_answer( int|void start_position )
return 1; return 1;
} }
protected void close_connection() protected void close_connection(int|void terminate_now)
{ {
Stdio.File con = this::con; object(Stdio.File)|SSL.File con = this::con;
if (!con) return; if (!con) return;
this::con = 0; this::con = 0;
con->set_callbacks(0, 0, 0, 0, 0); // Clear any remaining callbacks. con->set_callbacks(0, 0, 0, 0, 0); // Clear any remaining callbacks.
if (terminate_now) {
// We don't want to wait for the close() to complete...
con->set_nonblocking();
con->close();
if (!con->shutdown) return;
// Probably SSL.
//
// Force the connection to shutdown.
con = con->shutdown();
if (!con) return;
}
con->close(); con->close();
} }
...@@ -1199,8 +1215,12 @@ protected void destroy() ...@@ -1199,8 +1215,12 @@ protected void destroy()
remove_call_out(async_id); remove_call_out(async_id);
} }
async_id = 0; async_id = 0;
if(async_dns) {
async_dns->close();
async_dns = 0;
}
catch(close()); catch(close_connection(1));
} }
//! Close all associated file descriptors. //! Close all associated file descriptors.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment