raykichi / jabber-net

Automatically exported from code.google.com/p/jabber-net
Other
0 stars 0 forks source link

JabberClient does not reconnect when network connectivity connection to the server is lost. #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I had an OnError event get fired when what appears to be a connection issue
occurred between the JabberClient and server. It looks like I lost network
connectivity for a short while and the JabberClient did not reconnect to
the JabberServer. 

** What steps will reproduce the problem?
1. Connect to Jabber server using JabberClient with AutoReconnect set to
the default 30 seconds.
2. Disable the client machine's network adapter.
3. Re-enable the network adapter.

What is the expected output? What do you see instead?

I expected the JabberClient to reconnect to the server.

Attached is a log file with details of the error thrown during the network
disconnection.

** What version of the product are you using? On what operating system?

Revision 667

I think the issue I am seeing is related to the XmppStream.FireOnError
method. m_reconnect is set to false during the error handling. Preventing
server re-connections to be tried. 

I do not yet understand the code well enough to recommend a patch. 

** Please provide any additional information below.

My interest is in a service that has no user interaction so I cannot prompt
the user when connectivity is lost. I assumed that the client would
reconnect due to lost connectivity. What usage scenarios is the
AutoReconnection feature targeted for? 

A possible workaround I can think up would be to have the OnError handle
attempt to create a new JabberClient.

Original issue reported on code.google.com by scound...@gmail.com on 21 Apr 2008 at 8:03

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like I am wrong. It is attempting to reconnect just failing when the host
cannot be reached. Hence this error:

2008-04-21 14:39:37,995 [5] ERROR Dovetail.Twitter.JabberClientFactory - Jabber
Client Error event fired. bedrock.net.AsyncSocketConnectionException: Bad host:
jabber80.com

It also looks like Trying to create a new JabberClient in the OnError has 
problems.
So my workaround did not work.

Original comment by scound...@gmail.com on 21 Apr 2008 at 10:52

GoogleCodeExporter commented 9 years ago
From the mailing list at google groups. It looks like a solution to this 
problem is
to turn off autoreconnect and attempt a reconnect after the OnDisconnected 
event. I
have not tried this as I have moved to use agXmpp for now.

Original comment by scound...@gmail.com on 15 May 2008 at 1:20

GoogleCodeExporter commented 9 years ago
The Example client seems to do the right thing at the moment, with rev 673.  
Can you
please test again?

Original comment by hil...@gmail.com on 11 Jun 2008 at 11:35

GoogleCodeExporter commented 9 years ago
I have the same problem. I'm trying to connect with the network card 
disconnected,
and I receive this error:
bedrock.net.AsyncSocketConnectionException: Bad host: gmail.com

At the moment I'm using OnError handler to fix this:

if ((ex is bedrock.net.AsyncSocketConnectionException) && 
ex.Message.StartsWith("Bad host"))
{
// special case, when I connect with disconnected NIC. JabberClient sets 
m_reconnect
to false
  JabberClient c = (JabberClient)sender;
  Timer t = new Timer( 
    delegate {c.Connect();} , c, (long) (1000*c.AutoReconnect), Timeout.Infinite);
}

Original comment by tomislav...@gmail.com on 4 Nov 2008 at 10:38

GoogleCodeExporter commented 9 years ago
Handling OnError does not help me.

I think to fix this issue without changing anything in core would be make one 
timer to check connectivity and restart service with parameters given at login 
time.

In my case I am developing jabber component run as service and putting another 
service to watch this process and start when not available.

Original comment by sunnyrajwadi@gmail.com on 14 Sep 2011 at 10:40