[lanlinkprovider] Improve method names
This commit is contained in:
parent
ac2ac5ba20
commit
aff3d20e7e
2 changed files with 10 additions and 10 deletions
|
@ -56,7 +56,7 @@ LanLinkProvider::LanLinkProvider(bool testMode)
|
||||||
m_combineBroadcastsTimer.setSingleShot(true);
|
m_combineBroadcastsTimer.setSingleShot(true);
|
||||||
connect(&m_combineBroadcastsTimer, &QTimer::timeout, this, &LanLinkProvider::broadcastToNetwork);
|
connect(&m_combineBroadcastsTimer, &QTimer::timeout, this, &LanLinkProvider::broadcastToNetwork);
|
||||||
|
|
||||||
connect(&m_udpSocket, &QIODevice::readyRead, this, &LanLinkProvider::newUdpConnection);
|
connect(&m_udpSocket, &QIODevice::readyRead, this, &LanLinkProvider::udpBroadcastReceived);
|
||||||
|
|
||||||
m_server->setProxy(QNetworkProxy::NoProxy);
|
m_server->setProxy(QNetworkProxy::NoProxy);
|
||||||
connect(m_server,&QTcpServer::newConnection,this, &LanLinkProvider::newConnection);
|
connect(m_server,&QTcpServer::newConnection,this, &LanLinkProvider::newConnection);
|
||||||
|
@ -164,8 +164,8 @@ void LanLinkProvider::broadcastToNetwork()
|
||||||
}
|
}
|
||||||
|
|
||||||
//I'm the existing device, a new device is kindly introducing itself.
|
//I'm the existing device, a new device is kindly introducing itself.
|
||||||
//I will create a TcpSocket and try to connect. This can result in either connected() or connectError().
|
//I will create a TcpSocket and try to connect. This can result in either tcpSocketConnected() or connectError().
|
||||||
void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
|
void LanLinkProvider::udpBroadcastReceived()
|
||||||
{
|
{
|
||||||
while (m_udpSocket.hasPendingDatagrams()) {
|
while (m_udpSocket.hasPendingDatagrams()) {
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void LanLinkProvider::newUdpConnection() //udpBroadcastReceived
|
||||||
socket->setProxy(QNetworkProxy::NoProxy);
|
socket->setProxy(QNetworkProxy::NoProxy);
|
||||||
m_receivedIdentityPackets[socket].np = receivedPacket;
|
m_receivedIdentityPackets[socket].np = receivedPacket;
|
||||||
m_receivedIdentityPackets[socket].sender = sender;
|
m_receivedIdentityPackets[socket].sender = sender;
|
||||||
connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::connected);
|
connect(socket, &QAbstractSocket::connected, this, &LanLinkProvider::tcpSocketConnected);
|
||||||
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), this, &LanLinkProvider::connectError);
|
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error), this, &LanLinkProvider::connectError);
|
||||||
socket->connectToHost(sender, tcpPort);
|
socket->connectToHost(sender, tcpPort);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void LanLinkProvider::connectError()
|
||||||
}
|
}
|
||||||
|
|
||||||
//We received a UDP packet and answered by connecting to them by TCP. This gets called on a successful connection.
|
//We received a UDP packet and answered by connecting to them by TCP. This gets called on a successful connection.
|
||||||
void LanLinkProvider::connected()
|
void LanLinkProvider::tcpSocketConnected()
|
||||||
{
|
{
|
||||||
QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
|
QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ void LanLinkProvider::connected()
|
||||||
|
|
||||||
NetworkPacket* receivedPacket = m_receivedIdentityPackets[socket].np;
|
NetworkPacket* receivedPacket = m_receivedIdentityPackets[socket].np;
|
||||||
const QString& deviceId = receivedPacket->get<QString>(QStringLiteral("deviceId"));
|
const QString& deviceId = receivedPacket->get<QString>(QStringLiteral("deviceId"));
|
||||||
//qCDebug(KDECONNECT_CORE) << "Connected" << socket->isWritable();
|
//qCDebug(KDECONNECT_CORE) << "tcpSocketConnected" << socket->isWritable();
|
||||||
|
|
||||||
// If network is on ssl, do not believe when they are connected, believe when handshake is completed
|
// If network is on ssl, do not believe when they are connected, believe when handshake is completed
|
||||||
NetworkPacket np2(QLatin1String(""));
|
NetworkPacket np2(QLatin1String(""));
|
||||||
|
@ -305,7 +305,7 @@ void LanLinkProvider::encrypted()
|
||||||
|
|
||||||
addLink(deviceId, socket, receivedPacket, connectionOrigin);
|
addLink(deviceId, socket, receivedPacket, connectionOrigin);
|
||||||
|
|
||||||
// Copied from connected slot, now delete received packet
|
// Copied from tcpSocketConnected slot, now delete received packet
|
||||||
delete m_receivedIdentityPackets.take(socket).np;
|
delete m_receivedIdentityPackets.take(socket).np;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ void LanLinkProvider::dataReceived()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Needed in "encrypted" if ssl is used, similar to "connected"
|
// Needed in "encrypted" if ssl is used, similar to "tcpSocketConnected"
|
||||||
m_receivedIdentityPackets[socket].np = np;
|
m_receivedIdentityPackets[socket].np = np;
|
||||||
|
|
||||||
const QString& deviceId = np->get<QString>(QStringLiteral("deviceId"));
|
const QString& deviceId = np->get<QString>(QStringLiteral("deviceId"));
|
||||||
|
|
|
@ -61,12 +61,12 @@ public Q_SLOTS:
|
||||||
void onNetworkChange() override;
|
void onNetworkChange() override;
|
||||||
void onStart() override;
|
void onStart() override;
|
||||||
void onStop() override;
|
void onStop() override;
|
||||||
void connected();
|
void tcpSocketConnected();
|
||||||
void encrypted();
|
void encrypted();
|
||||||
void connectError();
|
void connectError();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void newUdpConnection();
|
void udpBroadcastReceived();
|
||||||
void newConnection();
|
void newConnection();
|
||||||
void dataReceived();
|
void dataReceived();
|
||||||
void deviceLinkDestroyed(QObject* destroyedDeviceLink);
|
void deviceLinkDestroyed(QObject* destroyedDeviceLink);
|
||||||
|
|
Loading…
Reference in a new issue