mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-23 19:37:51 +00:00
Revert "Discard unsupported messages instead of disconnecting the peer."
This reverts commit d086ade91f3afd0a72c10ed9b395980884474dad.
This commit is contained in:
parent
d086ade91f
commit
43bfd28bcd
@ -12,7 +12,6 @@ import org.qortal.data.network.PeerData;
|
|||||||
import org.qortal.network.message.ChallengeMessage;
|
import org.qortal.network.message.ChallengeMessage;
|
||||||
import org.qortal.network.message.Message;
|
import org.qortal.network.message.Message;
|
||||||
import org.qortal.network.message.MessageException;
|
import org.qortal.network.message.MessageException;
|
||||||
import org.qortal.network.message.UnsupportedMessageException;
|
|
||||||
import org.qortal.network.task.MessageTask;
|
import org.qortal.network.task.MessageTask;
|
||||||
import org.qortal.network.task.PingTask;
|
import org.qortal.network.task.PingTask;
|
||||||
import org.qortal.settings.Settings;
|
import org.qortal.settings.Settings;
|
||||||
@ -511,13 +510,8 @@ public class Peer {
|
|||||||
ByteBuffer readOnlyBuffer = this.byteBuffer.asReadOnlyBuffer().flip();
|
ByteBuffer readOnlyBuffer = this.byteBuffer.asReadOnlyBuffer().flip();
|
||||||
try {
|
try {
|
||||||
message = Message.fromByteBuffer(readOnlyBuffer);
|
message = Message.fromByteBuffer(readOnlyBuffer);
|
||||||
} catch (UnsupportedMessageException e) {
|
|
||||||
// Unsupported message - discard it without disconnecting
|
|
||||||
LOGGER.debug("[{}] {}, from peer {} - discarding...", this.peerConnectionId, e.getMessage(), this);
|
|
||||||
return;
|
|
||||||
} catch (MessageException e) {
|
} catch (MessageException e) {
|
||||||
// Any other message exception - disconnect the peer
|
LOGGER.debug("[{}] {}, from peer {}", this.peerConnectionId, e.getMessage(), this);
|
||||||
LOGGER.debug("[{}] {}, from peer {} - forcing disconnection...", this.peerConnectionId, e.getMessage(), this);
|
|
||||||
this.disconnect(e.getMessage());
|
this.disconnect(e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public abstract class Message {
|
|||||||
MessageType messageType = MessageType.valueOf(typeValue);
|
MessageType messageType = MessageType.valueOf(typeValue);
|
||||||
if (messageType == null)
|
if (messageType == null)
|
||||||
// Unrecognised message type
|
// Unrecognised message type
|
||||||
throw new UnsupportedMessageException(String.format("Received unknown message type [%d]", typeValue));
|
throw new MessageException(String.format("Received unknown message type [%d]", typeValue));
|
||||||
|
|
||||||
// Optional message ID
|
// Optional message ID
|
||||||
byte hasId = readOnlyBuffer.get();
|
byte hasId = readOnlyBuffer.get();
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
package org.qortal.network.message;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class UnsupportedMessageException extends MessageException {
|
|
||||||
public UnsupportedMessageException() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnsupportedMessageException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnsupportedMessageException(String message, Throwable cause) {
|
|
||||||
super(message, cause);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UnsupportedMessageException(Throwable cause) {
|
|
||||||
super(cause);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user