void Server :: acceptConnection() { clientConnection = sslServer -> getClientConnection(); qDebug() << "New connection received from "<< clientConnection->peerAddress().toString(); connect(clientConnection, SIGNAL(encrypted()), SLOT(connectionAccepted())); connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readDataFromClient())); connect(clientConnection, SIGNAL(disconnected()), clientConnection, SLOT(deleteLater())); connect(clientConnection, SIGNAL(disconnected()), this, SLOT(notifyDisconnect())); connect(clientConnection, SIGNAL(sslErrors(QList<QSslError>)),SLOT(sslErrors(QList<QSslError>)) ); }
int Server::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: readyToSendData(); break; case 1: messageReceived((*reinterpret_cast< QString(*)>(_a[1]))); break; case 2: serverDisconnected(); break; case 3: acceptConnection(); break; case 4: connectionAccepted(); break; case 5: readDataFromClient(); break; case 6: sslErrors((*reinterpret_cast< const QList<QSslError>(*)>(_a[1]))); break; case 7: notifyDisconnect(); break; } _id -= 8; } return _id; }
/** * Function to call with a binary address * * @param peer identity of the peer * @param address binary address (NULL on disconnect) */ void NetworkManager::gotActiveAddress(const struct GNUNET_PeerIdentity *peerIdent, const struct GNUNET_HELLO_Address *address) { if (address == NULL) { qDebug() << tr("Peer removed because dont have an active address"); notifyDisconnect(peerIdent); return; } //We have an address so is connected notifyConnect(peerIdent); if(!theApp->models()->networkModel()) { qWarning() << tr("Got an active address for a peer while the network model was not created"); return; } const char* key = GNUNET_i2s_full (peerIdent); QString peerIdStr(key); Peer* peer = theApp->models()->networkModel()->getPeer(peerIdStr); if(peer == NULL) { qDebug() << "Received a address to a peer that do not exist"; } QString peerTransportName((char *)address->transport_name); peer->setTransportName(peerTransportName); }