qxmpp icon indicating copy to clipboard operation
qxmpp copied to clipboard

XMPP Client Problem -> Sometimes when the Socket is connected, the XMPP session does not Start

Open jpancorb opened this issue 7 years ago • 0 comments

Hello:

I'm developing a XMPP Client with your library to connect it with a XMPP OpenFire Server that has a very heavy workload...

I known that when your Client is connecting with the Server and the socket is connected, your Client wait for the first Stanza from the Server to start the XMPP Session. But sometimes the Client is blocked for a very long time, even for days, without my Server sending the Stanza neither closing the connection.

In this case your Client library there isn't a timeout, and the KeepAlive timer won't begin until this first Stanza start the session

I fixed the problem changing your QXmppOutgoingClient Client class as follows:

QXmppOutgoingClient::QXmppOutgoingClient(QObject *parent) : QXmppStream(parent), d(new QXmppOutgoingClientPrivate(this)) { -----------------------------------------

// Begin KeepAlive when the socket is connected and not when the XMPP session is started ->
// There is a problem: sometimes when the socket is connected, the server does not send the first stanza neither broke the connection
// The process can be blocked for days
//
//    check = connect(this, SIGNAL(connected()),
//                    this, SLOT(pingStart()));
//    Q_ASSERT(check);

}

/// \cond void QXmppOutgoingClient::handleStart() {


//JCP *** Begin KeepAlive when the socket is connected and not when the xmpp session is started ->
// There is a problem when the socket is connected and the server does not send the first stanza neither broke the connection

// The process can be blocked for days info(QString("Patch Start keep alive when socket connected")); pingStop(); pingStart(); }

Because the handleStart() slot is called when the socket is connected, now I'm starting the keepAlive timer without waiting for the session starting and It has fixed my problem

What do you think about this approach?. Is there any problem for doing that?. Do you have a better approach for this problem?

Thanks in advanced

Regards:

JCP

jpancorb avatar Dec 01 '16 21:12 jpancorb