I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit c99a42f0 authored by zzz's avatar zzz
Browse files

I2CP: Write single byte directly

parent 65698aa0
No related branches found
No related tags found
No related merge requests found
...@@ -163,7 +163,7 @@ public class HostLookupMessage extends I2CPMessageImpl { ...@@ -163,7 +163,7 @@ public class HostLookupMessage extends I2CPMessageImpl {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
DataHelper.writeLong(os, 4, _reqID); DataHelper.writeLong(os, 4, _reqID);
DataHelper.writeLong(os, 4, _timeout); DataHelper.writeLong(os, 4, _timeout);
DataHelper.writeLong(os, 1, _lookupType); os.write((byte) _lookupType);
if (_lookupType == LOOKUP_HASH) { if (_lookupType == LOOKUP_HASH) {
_hash.writeBytes(os); _hash.writeBytes(os);
} else { } else {
......
...@@ -139,7 +139,7 @@ public class HostReplyMessage extends I2CPMessageImpl { ...@@ -139,7 +139,7 @@ public class HostReplyMessage extends I2CPMessageImpl {
try { try {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
DataHelper.writeLong(os, 4, _reqID); DataHelper.writeLong(os, 4, _reqID);
DataHelper.writeLong(os, 1, _code); os.write((byte) _code);
if (_code == RESULT_SUCCESS) if (_code == RESULT_SUCCESS)
_dest.writeBytes(os); _dest.writeBytes(os);
} catch (DataFormatException dfe) { } catch (DataFormatException dfe) {
......
...@@ -112,6 +112,8 @@ public class I2CPMessageHandler { ...@@ -112,6 +112,8 @@ public class I2CPMessageHandler {
return new HostReplyMessage(); return new HostReplyMessage();
case CreateLeaseSet2Message.MESSAGE_TYPE: case CreateLeaseSet2Message.MESSAGE_TYPE:
return new CreateLeaseSet2Message(); return new CreateLeaseSet2Message();
case BlindingInfoMessage.MESSAGE_TYPE:
return new BlindingInfoMessage();
default: default:
throw new I2CPMessageException("The type " + type + " is an unknown I2CP message"); throw new I2CPMessageException("The type " + type + " is an unknown I2CP message");
} }
......
...@@ -122,7 +122,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl { ...@@ -122,7 +122,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(256); ByteArrayOutputStream os = new ByteArrayOutputStream(256);
try { try {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _endpoints.size()); os.write((byte) _endpoints.size());
for (int i = 0; i < _endpoints.size(); i++) { for (int i = 0; i < _endpoints.size(); i++) {
Hash router = getRouter(i); Hash router = getRouter(i);
router.writeBytes(os); router.writeBytes(os);
......
...@@ -112,7 +112,7 @@ public class RequestVariableLeaseSetMessage extends I2CPMessageImpl { ...@@ -112,7 +112,7 @@ public class RequestVariableLeaseSetMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(256); ByteArrayOutputStream os = new ByteArrayOutputStream(256);
try { try {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _endpoints.size()); os.write((byte) _endpoints.size());
for (int i = 0; i < _endpoints.size(); i++) { for (int i = 0; i < _endpoints.size(); i++) {
_endpoints.get(i).writeBytes(os); _endpoints.get(i).writeBytes(os);
} }
......
...@@ -85,7 +85,7 @@ public class SessionStatusMessage extends I2CPMessageImpl { ...@@ -85,7 +85,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(64); ByteArrayOutputStream os = new ByteArrayOutputStream(64);
try { try {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
DataHelper.writeLong(os, 1, _status); os.write((byte) _status);
} catch (DataFormatException dfe) { } catch (DataFormatException dfe) {
throw new I2CPMessageException("Error writing out the message data", dfe); throw new I2CPMessageException("Error writing out the message data", dfe);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment