Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bugfix : do not delete NetServerClient from itself

  • Loading branch information...
commit d1c905ddb30b332db2d3748c00cf1abd82744a05 1 parent f5e8877
Sébastien Escudier authored
View
4 network/server/NetServer.cpp
@@ -118,7 +118,7 @@ void NetServer::incomingClient()
//if freeIndex == 0 && !adminPasswd, this client will be the admin of the server
NetServerClient *client = new NetServerClient(clientConnection,udpSocket,freeIndex, freeIndex == 0 && adminPasswd.isEmpty(), maxNbPlayers, maxWins, this);
- connect(client, SIGNAL(disconected(NetServerClient*)), this, SLOT(clientDisconected(NetServerClient*)));
+ connect(client, SIGNAL(disconected(NetServerClient*)), this, SLOT(clientDisconected(NetServerClient*)), Qt::QueuedConnection);
connect(client, SIGNAL(sigUpdatePlayerData(qint8,QString)), this, SLOT(slotUpdatePlayerData(qint8,QString)));
clients.insert(freeIndex,client);
@@ -325,7 +325,7 @@ void NetServer::kickPlayer(qint8 id)
for (QList<NetServerClient*>::iterator i = clients.begin(); i != clients.end(); ++i) {
if((*i)->getId() == id)
{
- clientDisconected(*i);
+ (*i)->clientDisconected(); //force the deconnection of this client
break;
}
}
View
2  network/server/NetServerClient.cpp
@@ -321,6 +321,6 @@ void NetServerClient::sendTcpBlock(const QByteArray& block) {
NetServerClient::~NetServerClient()
{
- tcpSocket->deleteLater();
+ delete tcpSocket;
}
View
4 network/server/NetServerClient.h
@@ -82,9 +82,11 @@ class NetServerClient : public QObject
quint16 blockSize; //size of the current message
+public slots:
+ void clientDisconected();
+
private slots:
void incomingTcpData();
- void clientDisconected();
signals:
void disconected(NetServerClient*);
Please sign in to comment.
Something went wrong with that request. Please try again.