Author: toad
Date: 2007-04-18 18:31:09 +0000 (Wed, 18 Apr 2007)
New Revision: 12781
Modified:
trunk/freenet/src/freenet/io/comm/Message.java
Log:
Minor refactoring
Modified: trunk/freenet/src/freenet/io/comm/Message.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/Message.java 2007-04-18 18:28:35 UTC
(rev 12780)
+++ trunk/freenet/src/freenet/io/comm/Message.java 2007-04-18 18:31:09 UTC
(rev 12781)
@@ -45,6 +45,10 @@
DataInputStream dis
= new DataInputStream(new ByteArrayInputStream(buf,
offset, length));
+ return decodeMessage(dis, peer, length + overhead);
+ }
+
+ public static Message decodeMessage(DataInputStream dis, PeerContext
peer, int recvByteCount) {
MessageType mspec;
try {
mspec = MessageType.getSpec(new Integer(dis.readInt()));
@@ -58,7 +62,7 @@
}
if(mspec.isInternalOnly())
return null; // silently discard internal-only messages
- Message m = new Message(mspec, peer, length + overhead);
+ Message m = new Message(mspec, peer, recvByteCount);
try {
for (Iterator i = mspec.getOrderedFields().iterator();
i.hasNext();) {
String name = (String) i.next();