Print socket error when connection fails

This commit is contained in:
Nicolas Fella 2019-05-26 20:36:35 +02:00 committed by Albert Vaca
parent 781c0004b8
commit 377f478aeb
2 changed files with 3 additions and 2 deletions

View file

@ -215,13 +215,14 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
} }
} }
void LanLinkProvider::connectError() void LanLinkProvider::connectError(QAbstractSocket::SocketError socketError)
{ {
QSslSocket* socket = qobject_cast<QSslSocket*>(sender()); QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
if (!socket) return; if (!socket) return;
disconnect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected); disconnect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected);
disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError()));
qCDebug(KDECONNECT_CORE) << "Socket error" << socketError;
qCDebug(KDECONNECT_CORE) << "Fallback (1), try reverse connection (send udp packet)" << socket->errorString(); qCDebug(KDECONNECT_CORE) << "Fallback (1), try reverse connection (send udp packet)" << socket->errorString();
NetworkPacket np(QLatin1String("")); NetworkPacket np(QLatin1String(""));
NetworkPacket::createIdentityPacket(&np); NetworkPacket::createIdentityPacket(&np);

View file

@ -64,7 +64,7 @@ public Q_SLOTS:
void onStop() override; void onStop() override;
void connected(); void connected();
void encrypted(); void encrypted();
void connectError(); void connectError(QAbstractSocket::SocketError socketError);
private Q_SLOTS: private Q_SLOTS:
void newUdpConnection(); void newUdpConnection();