mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-13 02:09:24 -04:00
Add corrupted data exception handling
This commit is contained in:
parent
ec63bc40f8
commit
96fce3b5b4
2 changed files with 6 additions and 2 deletions
|
@ -6,6 +6,7 @@ public enum CloseConnectionReason {
|
|||
RESET(false, false),
|
||||
SOCKET_TIMEOUT(false, false),
|
||||
TERMINATED(false, false), // EOFException
|
||||
CORRUPTED_DATA(false, false),
|
||||
UNKNOWN_EXCEPTION(false, false),
|
||||
|
||||
// Planned
|
||||
|
|
|
@ -540,8 +540,10 @@ public class Connection implements MessageListener {
|
|||
} else if (e instanceof SocketTimeoutException || e instanceof TimeoutException) {
|
||||
closeConnectionReason = CloseConnectionReason.SOCKET_TIMEOUT;
|
||||
log.debug("SocketTimeoutException at socket " + socket.toString() + "\n\tconnection={}" + this);
|
||||
} else if (e instanceof EOFException || e instanceof StreamCorruptedException) {
|
||||
} else if (e instanceof EOFException) {
|
||||
closeConnectionReason = CloseConnectionReason.TERMINATED;
|
||||
} else if (e instanceof OptionalDataException || e instanceof StreamCorruptedException) {
|
||||
closeConnectionReason = CloseConnectionReason.CORRUPTED_DATA;
|
||||
} else {
|
||||
// TODO sometimes we get StreamCorruptedException, OptionalDataException, IllegalStateException
|
||||
closeConnectionReason = CloseConnectionReason.UNKNOWN_EXCEPTION;
|
||||
|
@ -788,7 +790,8 @@ public class Connection implements MessageListener {
|
|||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
if (!(t instanceof OptionalDataException))
|
||||
t.printStackTrace();
|
||||
stop();
|
||||
sharedModel.handleConnectionException(new Exception(t));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue