Delay in login

Hi all,

We have build a client on smack 2.0.0. Using server Wildfire 2.4.0. We have written our own provider class to Authenticate the client on the server.

The login is not reliable and it take a long time to authenticate the users.

I was wonder is this because of this code in SASLAuthentication.java, authenticate() method

// Wait until SASL negotiation finishes

synchronized (this) {

if (!saslNegotiated && !saslFailed) {

try {

wait(30000);

} catch (InterruptedException e) {

}

}

}[/i]

I am not sure why do we add wait here? Why not use listener or some packet collector? Make it event driven.

I see these lines in bindResourceAndEstablishSession() method

// Wait until server sends response containing the element

synchronized (this) {

if (!resourceBinded) {

try {

wait(30000);

} catch (InterruptedException e) {

}

}

}[/i]

Why can’'t all this be made event driven rather than using timer?

Can someone help what might be goingo on?

Thanks

Mahaveer

Hi,

it is event driven as far as i can tell (looking at 2.1 code):

void authenticated()

{

synchronized (this)

{

saslNegotiated = true;

// Wake up the thread that is waiting

//in the #authenticate method

notify();

}

}

/code

PacketReader.java calls authenticated() as soon as the authentication process has succeeded - if something goes wrong (no reply, timeout) then wait(30000) will wait 30 seconds. But normally it should be notified after 1 second.

LG