1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-05 09:28:35 +00:00

Cache the remote address string in the client.

This is because we need to use it as the client's name even after
the client has been disconnected and the socket is closed.

svn path=/trunk/KDE/kdenetwork/krfb/; revision=1195307
This commit is contained in:
George Kiagiadakis 2010-11-10 19:47:36 +00:00
parent bed6c11c35
commit 7bd681fd44

View File

@ -37,11 +37,15 @@ struct RfbClient::Private
bool controlEnabled;
rfbClientPtr client;
QSocketNotifier *notifier;
QString remoteAddressString;
};
RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
: QObject(parent), d(new Private(client))
{
d->remoteAddressString = peerAddress(d->client->sock) + ":" +
QString::number(peerPort(d->client->sock));
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
d->notifier->setEnabled(false);
connect(d->notifier, SIGNAL(activated(int)), this, SLOT(onSocketActivated()));
@ -55,7 +59,7 @@ RfbClient::~RfbClient()
QString RfbClient::name() const
{
return peerAddress(d->client->sock) + ":" + QString::number(peerPort(d->client->sock));
return d->remoteAddressString;
}
//static