void
ConnStateData::unpinConnection()
{
+ debugs(33, 3, HERE << pinning.serverConnection);
+
if (pinning.peer)
cbdataReferenceDone(pinning.peer);
- if (pinning.closeHandler != NULL) {
- comm_remove_close_handler(pinning.serverConnection->fd, pinning.closeHandler);
- pinning.closeHandler = NULL;
- }
- /// also close the server side socket, we should not use it for any future requests...
- if (Comm::IsConnOpen(pinning.serverConnection))
+ if (Comm::IsConnOpen(pinning.serverConnection)) {
+ if (pinning.closeHandler != NULL) {
+ comm_remove_close_handler(pinning.serverConnection->fd, pinning.closeHandler);
+ }
+ /// also close the server side socket, we should not use it for any future requests...
+ // TODO: do not close if called from our close handler?
pinning.serverConnection->close();
+ }
+ pinning.closeHandler = NULL; // ensure it is unset regardless of the above conditionals
+
safe_free(pinning.host);
/* NOTE: pinning.pinned should be kept. This combined with fd == -1 at the end of a request indicates that the host