Merge pull request #8613 from SeppoTakalo/tls_fix

Make sure that TLSSocketWrapper::close() is called before the transport is destroyed.
pull/8692/head
Martin Kojtal 2018-11-05 17:17:36 +01:00 committed by GitHub
commit d55c0da61e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -35,4 +35,13 @@ nsapi_error_t TLSSocket::connect(const char *host, uint16_t port)
return TLSSocketWrapper::do_handshake();
}
TLSSocket::~TLSSocket()
{
/* Transport is a member of TLSSocket which is derived from TLSSocketWrapper.
* Make sure that TLSSocketWrapper::close() is called before the transport is
* destroyed.
*/
close();
}
#endif // MBEDTLS_SSL_CLI_C

View File

@ -41,6 +41,10 @@ public:
*/
TLSSocket() : TLSSocketWrapper(&tcp_socket) {}
/** Destroy the TLSSocket and closes the transport.
*/
virtual ~TLSSocket();
/** Create a socket on a network interface
*
* Creates and opens a socket on the network stack of the given