From c20c288565b6172e113d4e1e96495d48084b8ab3 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 31 Jan 2013 21:57:13 -0700 Subject: [PATCH] Bug 3687: unhandled exception: c when using interception and peers --- src/peer_select.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/peer_select.cc b/src/peer_select.cc index d412f61d2c..fb3f20d775 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -243,15 +243,18 @@ peerSelectDnsPaths(ps_state *psstate) const bool useOriginalDst = Config.onoff.client_dst_passthru || !req->flags.hostVerified; const bool choseDirect = fs && fs->code == HIER_DIRECT; if (isIntercepted && useOriginalDst && choseDirect) { - // construct a "result" adding the ORIGINAL_DST to the set instead of DIRECT - Comm::ConnectionPointer p = new Comm::Connection(); - p->remote = req->clientConnectionManager->clientConnection->local; - p->peerType = fs->code; - p->setPeer(fs->_peer); - - // check for a configured outgoing address for this destination... - getOutgoingAddress(psstate->request, p); - psstate->paths->push_back(p); + // check the client is still around before using any of its details + if (req->clientConnectionManager.valid()) { + // construct a "result" adding the ORIGINAL_DST to the set instead of DIRECT + Comm::ConnectionPointer p = new Comm::Connection(); + p->remote = req->clientConnectionManager->clientConnection->local; + p->peerType = fs->code; + p->setPeer(fs->_peer); + + // check for a configured outgoing address for this destination... + getOutgoingAddress(psstate->request, p); + psstate->paths->push_back(p); + } // clear the used fs and continue psstate->servers = fs->next; -- 2.47.2