Skip to content

Commit

Permalink
Update wxmpp.js
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandruradovici committed Aug 16, 2014
1 parent b8a1811 commit bfac62a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions wxmpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ function connect()
}
connection.ping = true;
connecting = false;
connection.reconnect = true;
loadSettings ();
connection.on ('error', function(error)
{
console.log ('XMPP error');
console.log (error);
if (!connecting)
if (!connecting && connection.reconnect)
{
connection.reconnect = false;
clearInterval (connection.interval);
reconnect ();
console.error (error);
Expand All @@ -73,7 +75,7 @@ function connect()
if (!connecting)
{
clearInterval (connection.interval);
reconnect ();
// reconnect ();
console.error ('disconnect');
isConnected = false;
}
Expand All @@ -83,8 +85,9 @@ function connect()
connection.on ('close', function()
{
console.log ('XMPP close');
if (!connecting)
if (!connecting && connection.reconnect)
{
connection.reconnect = false;
clearInterval (connection.interval);
reconnect ();
console.error ('disconnect');
Expand Down Expand Up @@ -116,7 +119,7 @@ function connect()
try
{
connection.nr = 0;
connection.disconnect ();
connection.end ();
}
catch (e)
{
Expand Down

0 comments on commit bfac62a

Please sign in to comment.