新增tcps swarm模式的lua事件绑定
parent
6e80dda35b
commit
c33530ce1d
|
@ -17,7 +17,6 @@ NetworkController::NetworkController(NetworkController::NetworkType type,
|
|||
{
|
||||
mType = type;
|
||||
if(_checkType(type) == TYPE_UNKOWN){
|
||||
|
||||
}
|
||||
if(type == NetworkType::TYPE_TCP_CLIENT){
|
||||
mTcp = new QTcpSocket();
|
||||
|
@ -178,11 +177,11 @@ void NetworkController::on_server_accept()
|
|||
QObject::connect(pClientConnection, SIGNAL(readyRead()), this, SLOT(on_ready_read()));
|
||||
QObject::connect(pClientConnection, SIGNAL(disconnected()), this, SLOT(on_disconect()));
|
||||
}
|
||||
mTcp = pClientConnection;
|
||||
mCnn = mTcp;
|
||||
qDebug()<<pClientConnection->socketDescriptor();
|
||||
// mTcp = pClientConnection;
|
||||
// mCnn = mTcp;
|
||||
mState = true;
|
||||
emit(on_connected());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <QThread>
|
||||
#include <QTcpServer>
|
||||
#include <QNetworkDatagram>
|
||||
#include <QMap>
|
||||
|
||||
// this is not a thread-safe class,any interface invoked in multi-thread maybe will cause unkown falut
|
||||
class NetworkController : public QObject
|
||||
|
@ -57,7 +58,7 @@ private:
|
|||
QTcpSocket *mTcp;
|
||||
QTcpServer *mTcpServer;
|
||||
QIODevice *mCnn;
|
||||
|
||||
QMap<qintptr,QTcpSocket *> m_clients;
|
||||
QThread mThread;
|
||||
bool mState;
|
||||
};
|
||||
|
|
|
@ -73,7 +73,6 @@ int TcpSwarmClientLibevent::addConection(evutil_socket_t fd,struct bufferevent*
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int TcpSwarmClientLibevent::removeConection(evutil_socket_t fd){
|
||||
m_clients.erase(fd);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue