void QXmppTransferIncomingJob::connectToNextHost() { bool check; Q_UNUSED(check); if (m_streamCandidates.isEmpty()) { // could not connect to any stream host QXmppByteStreamIq response; response.setId(m_streamOfferId); response.setTo(m_streamOfferFrom); QXmppStanza::Error error(QXmppStanza::Error::Cancel, QXmppStanza::Error::ItemNotFound); error.setCode(404); response.setType(QXmppIq::Error); response.setError(error); d->client->sendPacket(response); terminate(QXmppTransferJob::ProtocolError); return; } // try next host m_candidateHost = m_streamCandidates.takeFirst(); info(QString("Connecting to streamhost: %1 (%2 %3)").arg( m_candidateHost.jid(), m_candidateHost.host(), QString::number(m_candidateHost.port()))); const QString hostName = streamHash(d->sid, d->jid, d->client->configuration().jid()); // try to connect to stream host m_candidateClient = new QXmppSocksClient(m_candidateHost.host(), m_candidateHost.port(), this); m_candidateTimer = new QTimer(this); check = connect(m_candidateClient, SIGNAL(disconnected()), this, SLOT(_q_candidateDisconnected())); Q_ASSERT(check); check = connect(m_candidateClient, SIGNAL(ready()), this, SLOT(_q_candidateReady())); Q_ASSERT(check); check = connect(m_candidateTimer, SIGNAL(timeout()), this, SLOT(_q_candidateDisconnected())); Q_ASSERT(check); m_candidateTimer->setSingleShot(true); m_candidateTimer->start(socksTimeout); m_candidateClient->connectToHost(hostName, 0); }