Close the DTLS connection during destruction

Change-Id: Id7bc8ac1506ae543c7964b0bdcacf39588cd7334
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
This commit is contained in:
Sona Kurazyan 2019-03-27 16:41:48 +01:00
parent d1e1548ccf
commit 64b696e517
2 changed files with 11 additions and 0 deletions

View File

@ -164,6 +164,16 @@ QCoapQUdpConnectionPrivate::QCoapQUdpConnectionPrivate(QtCoap::SecurityMode secu
{
}
QCoapQUdpConnectionPrivate::~QCoapQUdpConnectionPrivate()
{
#if QT_CONFIG(dtls)
if (dtls && dtls->isConnectionEncrypted()) {
Q_ASSERT(udpSocket);
dtls->shutdown(udpSocket);
}
#endif
}
/*!
\internal

View File

@ -57,6 +57,7 @@ class Q_AUTOTEST_EXPORT QCoapQUdpConnectionPrivate : public QCoapConnectionPriva
{
public:
QCoapQUdpConnectionPrivate(QtCoap::SecurityMode security = QtCoap::NoSec);
~QCoapQUdpConnectionPrivate() override;
virtual bool bind();