mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-06-03 16:16:14 +08:00
update some code
This commit is contained in:
@@ -115,6 +115,20 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
this.name = identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用字符串设置兴趣包的名字
|
||||
* @param name
|
||||
* @throws PacketException
|
||||
*/
|
||||
public void setNameByString(String name) throws PacketException {
|
||||
try {
|
||||
Identifier identifier = new Identifier(name);
|
||||
this.setName(identifier);
|
||||
} catch (ComponentException e) {
|
||||
throw new PacketException("Interest.setNameByString: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断一个指定的名字和当前的兴趣包的名字是否匹配
|
||||
*
|
||||
@@ -198,7 +212,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
|
||||
// 填充可变受保护区
|
||||
minPacket.mutableField.mutableProtectField.clearBlocks();
|
||||
|
||||
// CongestionMark
|
||||
Block block = new SelfEncodingBase().selfWireEncode(this.congestionMark);
|
||||
if (block == null) {
|
||||
@@ -206,7 +219,7 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
}
|
||||
minPacket.mutableField.mutableProtectField.addBlock(block);
|
||||
|
||||
// 填充可变非受保护区(无)
|
||||
// 填充可变非受保护区
|
||||
minPacket.mutableField.mutableDangerousField.clearBlocks();
|
||||
// ttl
|
||||
block = new SelfEncodingBase().selfWireEncode(this.ttl);
|
||||
@@ -227,7 +240,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
//// 填充只读区
|
||||
/////////////////////////////////////////////////////////////
|
||||
minPacket.readOnlyField.clearBlocks();
|
||||
|
||||
// CanBePrefix
|
||||
if (this.canBePrefix.getCanBePrefix()) {
|
||||
block = new SelfEncodingBase().selfWireEncode(this.canBePrefix);
|
||||
@@ -236,7 +248,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
}
|
||||
|
||||
// MustBeRefresh
|
||||
if (this.mustBeRefresh.getMustBeRefresh()) {
|
||||
block = new SelfEncodingBase().selfWireEncode(this.mustBeRefresh);
|
||||
@@ -245,7 +256,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
}
|
||||
|
||||
// InterestLifeTime
|
||||
if (!this.interestLifeTime.isInitial()) {
|
||||
// 默认生存期为4s
|
||||
@@ -256,7 +266,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
return false;
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
|
||||
// Nonce
|
||||
if (!this.nonce.isInitial()) {
|
||||
// 如果没有指定随机数,随机生成一个随机数
|
||||
@@ -267,7 +276,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
return false;
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
|
||||
// HopLimit
|
||||
if (this.hopLimit.isInitial()) {
|
||||
block = new SelfEncodingBase().selfWireEncode(this.hopLimit);
|
||||
@@ -276,7 +284,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
}
|
||||
|
||||
// NackHeader
|
||||
if(this.nackHeader.isInitial()){
|
||||
block = new SelfEncodingBase().selfWireEncode(this.nackHeader);
|
||||
@@ -285,7 +292,6 @@ public class Interest implements InteractWithField, IEncodingAble {
|
||||
}
|
||||
minPacket.readOnlyField.addBlock(block);
|
||||
}
|
||||
|
||||
// Payload
|
||||
// if (this.payload.getValue() != null){
|
||||
block = new SelfEncodingBase().selfWireEncode(this.payload);
|
||||
|
||||
Reference in New Issue
Block a user