From: Amos Jeffries Date: Mon, 16 Jan 2017 15:18:07 +0000 (+1300) Subject: Rename SessionClose to SessionSendGoodbye X-Git-Tag: M-staged-PR71~284^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03e0e0e4c72cbaafe1bdbae425ac1c3aaee4f08c;p=thirdparty%2Fsquid.git Rename SessionClose to SessionSendGoodbye ... and remove FD related things, which are no longer needed --- diff --git a/src/comm.cc b/src/comm.cc index dee504e1f2..56f3965f17 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -764,7 +764,7 @@ commLingerTimeout(const FdeCbParams ¶ms) 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); @@ -825,7 +825,7 @@ old_comm_reset_close(int fd) void commStartTlsClose(const FdeCbParams ¶ms) { - Security::SessionClose(fd_table[params.fd].ssl); + Security::SessionSendGoodbye(fd_table[params.fd].ssl); } void diff --git a/src/security/PeerConnector.cc b/src/security/PeerConnector.cc index 194a1bb032..9580891598 100644 --- a/src/security/PeerConnector.cc +++ b/src/security/PeerConnector.cc @@ -551,10 +551,6 @@ Security::PeerConnector::bail(ErrorState *error) // 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 diff --git a/src/security/Session.cc b/src/security/Session.cc index 615a6a935a..b5f2a6d905 100644 --- a/src/security/Session.cc +++ b/src/security/Session.cc @@ -180,23 +180,14 @@ Security::CreateServerSession(const Security::ContextPointer &ctx, const Comm::C } 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 } } diff --git a/src/security/Session.h b/src/security/Session.h index be778ddbdc..6574743679 100644 --- a/src/security/Session.h +++ b/src/security/Session.h @@ -56,10 +56,8 @@ typedef std::unique_ptr SessionStatePointer; #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 &); diff --git a/src/tests/stub_libsecurity.cc b/src/tests/stub_libsecurity.cc index 1c9ec75e17..046656874e 100644 --- a/src/tests/stub_libsecurity.cc +++ b/src/tests/stub_libsecurity.cc @@ -91,8 +91,7 @@ void Security::ServerOptions::updateContextEecdh(Security::ContextPointer &) STU 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