make sure to properly stop tagwriter
This commit is contained in:
parent
5dde977233
commit
b72d7ec8d0
|
@ -99,6 +99,13 @@ public class TagWriter {
|
||||||
|
|
||||||
public void forceClose() {
|
public void forceClose() {
|
||||||
finish();
|
finish();
|
||||||
|
if (outputStream != null) {
|
||||||
|
try {
|
||||||
|
outputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
//ignoring
|
||||||
|
}
|
||||||
|
}
|
||||||
outputStream = null;
|
outputStream = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class XmlReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throw new IOException("xml parser mishandled "+throwable.getClass().getName(), throwable);
|
throw new IOException("xml parser mishandled "+throwable.getClass().getSimpleName()+"("+throwable.getMessage()+")", throwable);
|
||||||
} finally {
|
} finally {
|
||||||
if (wakeLock.isHeld()) {
|
if (wakeLock.isHeld()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1356,6 +1356,9 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forceCloseSocket() {
|
private void forceCloseSocket() {
|
||||||
|
if (tagWriter != null) {
|
||||||
|
tagWriter.forceClose();
|
||||||
|
}
|
||||||
if (socket != null) {
|
if (socket != null) {
|
||||||
try {
|
try {
|
||||||
socket.close();
|
socket.close();
|
||||||
|
@ -1375,7 +1378,6 @@ public class XmppConnection implements Runnable {
|
||||||
interrupt();
|
interrupt();
|
||||||
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": disconnecting force="+Boolean.valueOf(force));
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": disconnecting force="+Boolean.valueOf(force));
|
||||||
if (force) {
|
if (force) {
|
||||||
tagWriter.forceClose();
|
|
||||||
forceCloseSocket();
|
forceCloseSocket();
|
||||||
} else {
|
} else {
|
||||||
if (tagWriter.isActive()) {
|
if (tagWriter.isActive()) {
|
||||||
|
|
Loading…
Reference in a new issue