I2CP: Write single byte directly

This commit is contained in:
zzz
2019-09-09 15:35:58 +00:00
parent 65698aa0da
commit c99a42f0b1
6 changed files with 7 additions and 5 deletions

View File

@ -163,7 +163,7 @@ public class HostLookupMessage extends I2CPMessageImpl {
_sessionId.writeBytes(os);
DataHelper.writeLong(os, 4, _reqID);
DataHelper.writeLong(os, 4, _timeout);
DataHelper.writeLong(os, 1, _lookupType);
os.write((byte) _lookupType);
if (_lookupType == LOOKUP_HASH) {
_hash.writeBytes(os);
} else {

View File

@ -139,7 +139,7 @@ public class HostReplyMessage extends I2CPMessageImpl {
try {
_sessionId.writeBytes(os);
DataHelper.writeLong(os, 4, _reqID);
DataHelper.writeLong(os, 1, _code);
os.write((byte) _code);
if (_code == RESULT_SUCCESS)
_dest.writeBytes(os);
} catch (DataFormatException dfe) {

View File

@ -112,6 +112,8 @@ public class I2CPMessageHandler {
return new HostReplyMessage();
case CreateLeaseSet2Message.MESSAGE_TYPE:
return new CreateLeaseSet2Message();
case BlindingInfoMessage.MESSAGE_TYPE:
return new BlindingInfoMessage();
default:
throw new I2CPMessageException("The type " + type + " is an unknown I2CP message");
}

View File

@ -122,7 +122,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
try {
_sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _endpoints.size());
os.write((byte) _endpoints.size());
for (int i = 0; i < _endpoints.size(); i++) {
Hash router = getRouter(i);
router.writeBytes(os);

View File

@ -112,7 +112,7 @@ public class RequestVariableLeaseSetMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(256);
try {
_sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _endpoints.size());
os.write((byte) _endpoints.size());
for (int i = 0; i < _endpoints.size(); i++) {
_endpoints.get(i).writeBytes(os);
}

View File

@ -85,7 +85,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(64);
try {
_sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _status);
os.write((byte) _status);
} catch (DataFormatException dfe) {
throw new I2CPMessageException("Error writing out the message data", dfe);
}