Destroying a socket should not destroy the link.
Also, sockets can be destroyed as soon as the socketreader is deleted.
This commit is contained in:
parent
83a56c47e9
commit
e379fcd69d
3 changed files with 5 additions and 2 deletions
|
@ -39,6 +39,7 @@ LanDeviceLink::LanDeviceLink(const QString& deviceId, LinkProvider* parent, QSsl
|
|||
void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource)
|
||||
{
|
||||
if (mSocketLineReader) {
|
||||
disconnect(mSocketLineReader->mSocket, SIGNAL(disconnected()), this, SLOT(deleteLater()));
|
||||
delete mSocketLineReader;
|
||||
}
|
||||
|
||||
|
@ -51,7 +52,7 @@ void LanDeviceLink::reset(QSslSocket* socket, ConnectionStarted connectionSource
|
|||
//When the link provider destroys us,
|
||||
//the socket (and the reader) will be
|
||||
//destroyed as well
|
||||
socket->setParent(this);
|
||||
socket->setParent(mSocketLineReader);
|
||||
|
||||
mConnectionSource = connectionSource;
|
||||
|
||||
|
|
|
@ -473,6 +473,7 @@ void LanLinkProvider::addLink(const QString& deviceId, QSslSocket* socket, Netwo
|
|||
//Do we have a link for this device already?
|
||||
QMap< QString, LanDeviceLink* >::iterator linkIterator = mLinks.find(deviceId);
|
||||
if (linkIterator != mLinks.end()) {
|
||||
//qCDebug(KDECONNECT_CORE) << "Reusing link to" << deviceId;
|
||||
deviceLink = linkIterator.value();
|
||||
deviceLink->reset(socket, connectionOrigin);
|
||||
} else {
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
QSslCertificate peerCertificate() const { return mSocket->peerCertificate(); }
|
||||
qint64 bytesAvailable() const { return mPackages.size(); }
|
||||
|
||||
QSslSocket* mSocket;
|
||||
|
||||
Q_SIGNALS:
|
||||
void readyRead();
|
||||
|
||||
|
@ -55,7 +57,6 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
QByteArray lastChunk;
|
||||
QSslSocket* mSocket;
|
||||
QQueue<QByteArray> mPackages;
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue