From a1fe7379e6b23e864f7c9dbc80d05f18041b760e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sun, 27 Jan 2013 21:17:45 -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 c5eadc030d..add3165ac9 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -239,15 +239,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