Re: Logout problem
From: "Anatoly Gutnick" <anatolyg@xxxxxxxxx>
Date: Thu, 17 May 2007 08:16:07 +0200 (CEST)
Hi,



I have additional problem with client->disconnect();



1) I am using gloox 0.8.6 with w32gnutls.dll



2) Problem: Sometime (not always) client->disconnect()is hang up



Then the last message I see in log is  "</stream:stream>".

Sometime disconnect close connection properly.

Looks like thread synchronization problem.



I have one thread that call client->connect(false) and than wait on select.

Another thread call client->disconnect();



Is it not safe to call connect() and disconnect() from different threads?



I would like to avoid polling in ReaderThread so it is blocked on select.

Then I need to call disconnect() from WriterThread.

What is alternative?



To clarify the question here is pseudo code. Please correct



ReaderThread()

{

     do{

           client->connect(false); //Non block connect

           select(...);//block on select till data available or closed

           CriticalSection

           client->idle(-1);



     }while(true);

}



WriterThread()

{

    //WaitForWriteCommand like "send" or "disconnect"



    do{

           CriticalSection

           if(command="disconnect")

             client->disconnect(); //May release select. Sometime -NOT

           if(command="send")

             client->send();

    }

    while(true);

}



Thanks,

Anatoly













2007/2/6, Jakob Schroeter <js@xxxxxxxxxx>:

Hi,

On Tue Feb 6 2007, Petr Mensik wrote:
> Hello,
>
> i have problem with logging out on ejabberd server. I made simple robot
> to print server/component version and disco, then quit. Problem is, it
> does call client->disconnect(), but does not finish and does not
> disconnect from server. Can anyone help me with that problem?

This is most likely related to the fact that disconnect() didn't close the
stream properly in 0.8.4. This is fixed in 0.8.6.

cheers,
Jakob

--
gloox-dev mailing list
to unsubscribe:
send a message with subject 'unsubscribe gloox-dev' to
minimalist@xxxxxxxxxx