flush outputstream on chat connect failures or rejections
This commit is contained in:
@ -72,6 +72,7 @@ class ChatClient implements Closeable {
|
||||
|
||||
if (code == 429) {
|
||||
eventBus.publish(new ChatConnectionEvent(status : ChatConnectionAttemptStatus.REJECTED, persona : host))
|
||||
try { dos.close() } catch (IOException ignore) {}
|
||||
endpoint.close()
|
||||
lastRejectionTime = System.currentTimeMillis()
|
||||
return
|
||||
@ -94,7 +95,10 @@ class ChatClient implements Closeable {
|
||||
connection : connection))
|
||||
} catch (Exception e) {
|
||||
eventBus.publish(new ChatConnectionEvent(status : ChatConnectionAttemptStatus.FAILED, persona : host))
|
||||
endpoint?.close()
|
||||
if (endpoint != null) {
|
||||
try {endpoint.getOutputStream().close() } catch (IOException ignore) {}
|
||||
endpoint.close()
|
||||
}
|
||||
} finally {
|
||||
connectInProgress = false
|
||||
connectThread = null
|
||||
|
@ -109,6 +109,7 @@ class ChatConnection implements ChatLink {
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING,"unhandled exception in reader", e)
|
||||
} finally {
|
||||
try {endpoint.getOutputStream().close()} catch (IOException ignore) {}
|
||||
close()
|
||||
}
|
||||
}
|
||||
@ -123,6 +124,7 @@ class ChatConnection implements ChatLink {
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING,"unhandled exception in writer",e)
|
||||
} finally {
|
||||
try {endpoint.getOutputStream().close()} catch (IOException ignore) {}
|
||||
close()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user