void
comm_lingering_close(int fd)
{
- Security::SessionClose(fd_table[fd].ssl);
+ Security::SessionSendGoodbye(fd_table[fd].ssl);
if (shutdown(fd, 1) < 0) {
comm_close(fd);
void
commStartTlsClose(const FdeCbParams ¶ms)
{
- Security::SessionClose(fd_table[params.fd].ssl);
+ Security::SessionSendGoodbye(fd_table[params.fd].ssl);
}
void
// the recepient before the fd-closure notification), but we would rather
// minimize the number of fd-closure notifications and let the recepient
// manage the TCP state of the connection.
-
- // but we should release the TLS session (if any)
- const int fd = serverConnection()->fd;
- Security::SessionClose(fd_table[fd].ssl, fd);
}
void
}
void
-Security::SessionClose(const Security::SessionPointer &s, const int fdOnError)
+Security::SessionSendGoodbye(const Security::SessionPointer &s)
{
debugs(83, 5, "session=" << (void*)s.get());
- if (s && fdOnError == -1) {
+ if (s) {
#if USE_OPENSSL
SSL_shutdown(s.get());
#elif USE_GNUTLS
gnutls_bye(s.get(), GNUTLS_SHUT_RDWR);
- }
-
- // XXX: should probably be done for OpenSSL too, but that needs testing.
- if (fdOnError != -1) {
- debugs(83, 5, "unlink FD " << fdOnError << " from TLS session=" << (void*)fd_table[fdOnError].ssl.get());
- fd_table[fdOnError].ssl.reset();
- fd_table[fdOnError].read_method = &default_read_method;
- fd_table[fdOnError].write_method = &default_write_method;
- fd_note(fdOnError, "TLS error");
#endif
}
}
#endif
-/// close an active TLS session.
-/// set fdOnError to the connection FD when the session is being closed
-/// due to an encryption error, otherwise omit.
-void SessionClose(const Security::SessionPointer &, int fdOnError = -1);
+/// send the shutdown/bye notice for an active TLS session.
+void SessionSendGoodbye(const Security::SessionPointer &);
/// whether the session is a resumed one
bool SessionIsResumed(const Security::SessionPointer &);
namespace Security {
bool CreateClientSession(const Security::ContextPointer &, const Comm::ConnectionPointer &, const char *) STUB_RETVAL(false)
bool CreateServerSession(const Security::ContextPointer &, const Comm::ConnectionPointer &, const char *) STUB_RETVAL(false)
-void SessionClose(const Security::SessionPointer &) STUB
-void SessionClose(const Security::SessionPointer &, int) STUB
+void SessionSendGoodbye(const Security::SessionPointer &) STUB
bool SessionIsResumed(const Security::SessionPointer &) STUB_RETVAL(false)
void MaybeGetSessionResumeData(const Security::SessionPointer &, Security::SessionStatePointer &) STUB
void SetSessionResumeData(const Security::SessionPointer &, const Security::SessionStatePointer &) STUB