Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
poma #1
Member since Feb 2012 · 8 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: XmppConnectionState is not set to XmppConnectionState.Disconnected after failed DNS lookup
I subscribed to OnXmppConnectionStateChanged event and try to open connection with disabled network (network cable pulled out). XmppClientConnection changes state to XmppConnectionState.Connecting and then throws DNS lookup exception. But it never returns to XmppConnectionState.Disconnected after that (and OnClose event is also not fired).

And IMHO performing DNS request on calling thread synchronously is not correct since this library is meant to be asynchronous.

Update: this bug also present when connection to server timed out.
This post was edited 2 times, last on 2012-02-15, 14:27 by poma.
Avatar
Alex #2
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The XmppConnectionState is meant only for internal state handling only. Your software should not rely on this state. I made this only public because some users use this state for showing progress and status during the login process in their software.

OnClose gets only fired when you were able to login before. This is by design.

Quote by poma:
And IMHO performing DNS request on calling thread synchronously is not correct since this library is meant to be asynchronous.
feel free to provide a patch for this. But I see no advantages of an async dns resolver.

Alex
Avatar
poma #3
Member since Feb 2012 · 8 posts
Group memberships: Members, Premium
Show profile · Link to this post
Then how can I tell after call to 'XmppClientConnection.Open' if it was able to connect successfully or there was an error?

But I see no advantages of an async dns resolver.
'XmppClientConnection.Open' is often called from GUI thread. And it will freeze for some time if there are some problems with network.
Avatar
Alex #4
Member since Feb 2003 · 4322 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by poma:
Then how can I tell after call to 'XmppClientConnection.Open' if it was able to connect successfully or there was an error?

when it succeeds you get an OnLogin event. When it fails you get one of the error events.

Quote by poma:
'XmppClientConnection.Open' is often called from GUI thread. And it will freeze for some time if there are some problems with network.

Its all async, except of the dns resolving. And this shouldn't take that long and block your GUI.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS