void RPCServer::onClientDisconnected(quint64 client){ qDebug("Peer %llu disconnected",client); if(m_clientKeyMap.contains(client)){ emit clientFinished(client,keyFromClient(client)); m_clientKeyMap.remove(client); } }
void TcpServerListener::handlingClient(int socketDescriptor) #endif { TcpListener * listener = new(std::nothrow) TcpListener(socketDescriptor); if (listener != NULL) { // qDebug() << "Listener created" << listener; listener->setDecodeinput(decodeInput); listener->setEncodeOutput(encodeOutput); clients.append(listener); listener->moveToThread(workerThread); connect(listener, SIGNAL(blockReceived(Block)), SLOT(onClientReceivedBlock(Block))); connect(listener, SIGNAL(stopped()), SLOT(clientFinished())); connect(listener, SIGNAL(error(QString,QString)), SIGNAL(error(QString,QString))); connect(listener, SIGNAL(status(QString,QString)), SIGNAL(status(QString,QString))); QTimer::singleShot(0,listener,SLOT(startListening())); } else { qFatal("Cannot allocate memory for TcpListener X{"); } }
void TcpServerListener::handlingClient(int socketDescriptor) #endif { TcpListener * listener = new(std::nothrow) TcpListener(socketDescriptor); if (listener != NULL) { // qDebug() << "Listener created" << listener; listener->setDecodeinput(decodeInput); listener->setEncodeOutput(encodeOutput); int cid = BlocksSource::newSourceID(this); clientsList.insert(listener, cid); clientsID.insert(cid, listener); listener->moveToThread(workerThread); connect(listener, SIGNAL(blockReceived(Block *)), SLOT(onClientReceivedBlock(Block *))); connect(listener, SIGNAL(stopped()), SLOT(clientFinished())); connect(listener, SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL)), SIGNAL(log(QString,QString,Pip3lineConst::LOGLEVEL))); connect(this, SIGNAL(shutdownAllClient()), listener, SLOT(stopListening()),Qt::QueuedConnection); QTimer::singleShot(0,listener,SLOT(startListening())); } else { qFatal("Cannot allocate memory for TcpListener X{"); } }