void
Security::PeerConnector::NegotiateSsl(int, void *data)
{
- PeerConnector *pc = static_cast<Security::PeerConnector *>(data);
+ const auto pc = static_cast<PeerConnector::Pointer*>(data);
+ if (pc->valid())
+ (*pc)->negotiateSsl();
+ delete pc;
+}
+
+/// Comm::SetSelect() callback. Direct calls tickle/resume negotiations.
+void
+Security::PeerConnector::negotiateSsl()
+{
// Use job calls to add done() checks and other job logic/protections.
- CallJobHere(83, 7, pc, Security::PeerConnector, negotiate);
+ CallJobHere(83, 7, this, Security::PeerConnector, negotiate);
}
void
srvBio->holdRead(false);
// schedule a negotiateSSl to allow openSSL parse received data
- Security::PeerConnector::NegotiateSsl(fd, this);
+ negotiateSsl();
return;
} else if (srvBio->gotHelloFailed()) {
srvBio->holdRead(false);
debugs(83, DBG_IMPORTANT, "Error parsing SSL Server Hello Message on FD " << fd);
// schedule a negotiateSSl to allow openSSL parse received data
- Security::PeerConnector::NegotiateSsl(fd, this);
+ negotiateSsl();
return;
}
}
#endif
setReadTimeout();
- Comm::SetSelect(fd, COMM_SELECT_READ, &NegotiateSsl, this, 0);
+ Comm::SetSelect(fd, COMM_SELECT_READ, &NegotiateSsl, new Pointer(this), 0);
}
void
{
const int fd = serverConnection()->fd;
debugs(83, 5, serverConnection());
- Comm::SetSelect(fd, COMM_SELECT_WRITE, &NegotiateSsl, this, 0);
+ Comm::SetSelect(fd, COMM_SELECT_WRITE, &NegotiateSsl, new Pointer(this), 0);
return;
}
}
srvBio->holdRead(false);
- Security::PeerConnector::NegotiateSsl(serverConnection()->fd, this);
+ negotiateSsl();
}
bool
CBDATA_CLASS(PeerConnector);
public:
+ typedef CbcPointer<PeerConnector> Pointer;
+
/// Callback dialer API to allow PeerConnector to set the answer.
class CbDialer
{
Security::CertErrors *sslCrtvdCheckForErrors(Ssl::CertValidationResponse const &, Ssl::ErrorDetail *&);
#endif
- /// A wrapper function for negotiateSsl for use with Comm::SetSelect
static void NegotiateSsl(int fd, void *data);
+ void negotiateSsl();
/// The maximum allowed missing certificates downloads.
static const unsigned int MaxCertsDownloads = 10;