minor cleanup

This commit is contained in:
zzz
2015-04-26 17:46:14 +00:00
parent f89bf32390
commit 6dbbb6b61b
4 changed files with 7 additions and 7 deletions

View File

@@ -96,7 +96,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
int size = 2 + 4 + 4 + _payload.getSize();
try {
DataHelper.writeLong(out, 4, size);
DataHelper.writeLong(out, 1, getType());
DataHelper.writeLong(out, 1, MESSAGE_TYPE);
DataHelper.writeLong(out, 2, _sessionId);
DataHelper.writeLong(out, 4, _messageId);
DataHelper.writeLong(out, 4, _payload.getSize());

View File

@@ -308,7 +308,7 @@ public class MessageStatusMessage extends I2CPMessageImpl {
try {
DataHelper.writeLong(out, 4, len);
DataHelper.writeLong(out, 1, getType());
DataHelper.writeLong(out, 1, MESSAGE_TYPE);
DataHelper.writeLong(out, 2, _sessionId);
DataHelper.writeLong(out, 4, _messageId);
DataHelper.writeLong(out, 1, _status);

View File

@@ -76,7 +76,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
try {
DataHelper.writeLong(out, 4, len);
DataHelper.writeLong(out, 1, getType());
DataHelper.writeLong(out, 1, MESSAGE_TYPE);
DataHelper.writeLong(out, 2, _sessionId);
DataHelper.writeLong(out, 4, _messageId);
} catch (DataFormatException dfe) {

View File

@@ -74,7 +74,7 @@ public class SendMessageMessage extends I2CPMessageImpl {
@Override
protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException {
if (true) throw new IllegalStateException("wtf, do not run me");
throw new UnsupportedOperationException();
}
/**
@@ -84,8 +84,8 @@ public class SendMessageMessage extends I2CPMessageImpl {
*/
@Override
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
if (type != getType())
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
if (type != MESSAGE_TYPE)
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + MESSAGE_TYPE
+ " class: " + getClass().getName() + ")");
if (length < 0) throw new IOException("Negative payload size");
@@ -129,7 +129,7 @@ public class SendMessageMessage extends I2CPMessageImpl {
try {
DataHelper.writeLong(out, 4, len);
DataHelper.writeLong(out, 1, getType());
DataHelper.writeLong(out, 1, MESSAGE_TYPE);
_sessionId.writeBytes(out);
_destination.writeBytes(out);
_payload.writeBytes(out);