mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-12-23 04:57:58 +01:00
Make disconnect() not throw NotConnectedException
while disconnect(Presence) still does to notify the user that the unavailable presence was not send.
This commit is contained in:
parent
eb6b8df7c5
commit
fc14962445
1 changed files with 7 additions and 7 deletions
|
@ -643,10 +643,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* the XMPP server. The XMPPConnection can still be used for connecting to the server
|
||||
* again.
|
||||
*
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public void disconnect() throws NotConnectedException {
|
||||
disconnect(new Presence(Presence.Type.unavailable));
|
||||
public void disconnect() {
|
||||
try {
|
||||
disconnect(new Presence(Presence.Type.unavailable));
|
||||
}
|
||||
catch (NotConnectedException e) {
|
||||
LOGGER.log(Level.FINEST, "Connection is already disconnected", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -661,10 +665,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* @throws NotConnectedException
|
||||
*/
|
||||
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
||||
if (!isConnected()) {
|
||||
throw new NotConnectedException();
|
||||
}
|
||||
|
||||
sendPacket(unavailablePresence);
|
||||
shutdown();
|
||||
callConnectionClosedListener();
|
||||
|
|
Loading…
Reference in a new issue