Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xabber-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
xabber-android
Commits
4070b26c
Commit
4070b26c
authored
Aug 10, 2015
by
Grigory Fedorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PingManager ping failed listener registration moved from ConnectionManager to ConnectionThread.
parent
5dcc24e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
ConnectionManager.java
...com/xabber/android/data/connection/ConnectionManager.java
+0
-8
ConnectionThread.java
.../com/xabber/android/data/connection/ConnectionThread.java
+13
-4
No files found.
app/src/main/java/com/xabber/android/data/connection/ConnectionManager.java
View file @
4070b26c
...
@@ -209,14 +209,6 @@ public class ConnectionManager implements OnInitializedListener, OnCloseListener
...
@@ -209,14 +209,6 @@ public class ConnectionManager implements OnInitializedListener, OnCloseListener
for
(
OnConnectedListener
listener
:
Application
.
getInstance
().
getManagers
(
OnConnectedListener
.
class
))
{
for
(
OnConnectedListener
listener
:
Application
.
getInstance
().
getManagers
(
OnConnectedListener
.
class
))
{
listener
.
onConnected
(
connectionThread
.
getConnectionItem
());
listener
.
onConnected
(
connectionThread
.
getConnectionItem
());
}
}
org
.
jivesoftware
.
smackx
.
ping
.
PingManager
.
getInstanceFor
(
connectionThread
.
getXMPPConnection
()).
registerPingFailedListener
(
new
PingFailedListener
()
{
@Override
public
void
pingFailed
()
{
LogManager
.
i
(
this
,
"pingFailed for "
+
connectionThread
.
getConnectionItem
().
getRealJid
());
connectionThread
.
getConnectionItem
().
forceReconnect
();
}
});
}
}
public
void
onAuthorized
(
ConnectionThread
connectionThread
)
{
public
void
onAuthorized
(
ConnectionThread
connectionThread
)
{
...
...
app/src/main/java/com/xabber/android/data/connection/ConnectionThread.java
View file @
4070b26c
...
@@ -14,8 +14,6 @@
...
@@ -14,8 +14,6 @@
*/
*/
package
com
.
xabber
.
android
.
data
.
connection
;
package
com
.
xabber
.
android
.
data
.
connection
;
import
android.os.Build
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.Application
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.LogManager
;
import
com.xabber.android.data.NetworkException
;
import
com.xabber.android.data.NetworkException
;
...
@@ -26,7 +24,9 @@ import com.xabber.android.data.account.OAuthManager;
...
@@ -26,7 +24,9 @@ import com.xabber.android.data.account.OAuthManager;
import
com.xabber.android.data.account.OAuthResult
;
import
com.xabber.android.data.account.OAuthResult
;
import
org.jivesoftware.smack.AbstractXMPPConnection
;
import
org.jivesoftware.smack.AbstractXMPPConnection
;
import
org.jivesoftware.smack.ConnectionListener
;
import
org.jivesoftware.smack.SmackException
;
import
org.jivesoftware.smack.SmackException
;
import
org.jivesoftware.smack.StanzaListener
;
import
org.jivesoftware.smack.XMPPConnection
;
import
org.jivesoftware.smack.XMPPConnection
;
import
org.jivesoftware.smack.XMPPException
;
import
org.jivesoftware.smack.XMPPException
;
import
org.jivesoftware.smack.filter.StanzaFilter
;
import
org.jivesoftware.smack.filter.StanzaFilter
;
...
@@ -37,6 +37,7 @@ import org.jivesoftware.smack.roster.Roster;
...
@@ -37,6 +37,7 @@ import org.jivesoftware.smack.roster.Roster;
import
org.jivesoftware.smack.tcp.XMPPTCPConnection
;
import
org.jivesoftware.smack.tcp.XMPPTCPConnection
;
import
org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration
;
import
org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration
;
import
org.jivesoftware.smackx.iqregister.AccountManager
;
import
org.jivesoftware.smackx.iqregister.AccountManager
;
import
org.jivesoftware.smackx.ping.PingFailedListener
;
import
org.xbill.DNS.Record
;
import
org.xbill.DNS.Record
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -64,8 +65,8 @@ import de.duenndns.ssl.MemorizingTrustManager;
...
@@ -64,8 +65,8 @@ import de.duenndns.ssl.MemorizingTrustManager;
* @author alexander.ivanov
* @author alexander.ivanov
*/
*/
public
class
ConnectionThread
implements
public
class
ConnectionThread
implements
org
.
jivesoftware
.
smack
.
ConnectionListener
,
ConnectionListener
,
org
.
jivesoftware
.
smack
.
Stanza
Listener
{
StanzaListener
,
PingFailed
Listener
{
private
static
Pattern
ADDRESS_AND_PORT
=
Pattern
.
compile
(
"^(.*):(\\d+)$"
);
private
static
Pattern
ADDRESS_AND_PORT
=
Pattern
.
compile
(
"^(.*):(\\d+)$"
);
...
@@ -372,6 +373,8 @@ public class ConnectionThread implements
...
@@ -372,6 +373,8 @@ public class ConnectionThread implements
xmppConnection
.
addAsyncStanzaListener
(
this
,
ACCEPT_ALL
);
xmppConnection
.
addAsyncStanzaListener
(
this
,
ACCEPT_ALL
);
xmppConnection
.
addConnectionListener
(
this
);
xmppConnection
.
addConnectionListener
(
this
);
org
.
jivesoftware
.
smackx
.
ping
.
PingManager
.
getInstanceFor
(
xmppConnection
).
registerPingFailedListener
(
this
);
// We use own roster management.
// We use own roster management.
Roster
.
getInstanceFor
(
xmppConnection
).
setRosterLoadedAtLogin
(
false
);
Roster
.
getInstanceFor
(
xmppConnection
).
setRosterLoadedAtLogin
(
false
);
...
@@ -728,6 +731,12 @@ public class ConnectionThread implements
...
@@ -728,6 +731,12 @@ public class ConnectionThread implements
});
});
}
}
@Override
public
void
pingFailed
()
{
LogManager
.
i
(
this
,
"pingFailed for "
+
getConnectionItem
().
getRealJid
());
getConnectionItem
().
forceReconnect
();
}
/**
/**
* Filter to accept all packets.
* Filter to accept all packets.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment