mirror of
https://gitee.com/willfree/min-dev-java.git
synced 2026-10-04 19:42:01 +08:00
恢复被错误覆盖掉的Packet测试代码
This commit is contained in:
1 parent
7529b3e6ac
commit
18dbeb894e
11 files changed
+430
-7
No files matched your search
@@ -1,8 +1,8 @@
|
||||
package logicface;
|
||||
|
||||
import component.ComponentException;
|
||||
import component.Identifier;
|
||||
import encoding.TLV;
|
||||
import encoding.VlIntException;
|
||||
import encoding.*;
|
||||
import jnr.unixsocket.UnixSocketAddress;
|
||||
import jnr.unixsocket.UnixSocketChannel;
|
||||
import mgmt.MgmtException;
|
||||
@@ -248,14 +248,19 @@ public class LogicFace {
|
||||
public Interest receiveInterest(long timeout) throws LogicFaceException {
|
||||
try {
|
||||
while (true){
|
||||
System.out.println("receiveInterest ing...");
|
||||
MINPacket minPacket=this.receivePacket(timeout);
|
||||
System.out.println("minpacket: "+new SelfEncodingBase().selfWireEncode(minPacket).getRaw());
|
||||
int packetType=minPacket.packetType.getVlIntValue2Int();
|
||||
if(packetType == TLV.TlvIdentifierContentInterest){
|
||||
Interest interest=new Interest().createInterestByMINPacket(minPacket);
|
||||
return interest;
|
||||
}else{
|
||||
// System.out.println(new SelfEncodingBase().selfWireEncode(minPacket).getRaw());
|
||||
}
|
||||
System.out.println(new SelfEncodingBase().selfWireEncode(minPacket).getRaw());
|
||||
}
|
||||
} catch (VlIntException | PacketException e) {
|
||||
} catch (VlIntException | PacketException | EncoderException | BlockException | ComponentException | MgmtException e) {
|
||||
throw new LogicFaceException("LogicFace.receiveInterest: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public class StreamTransport extends Transport implements ITransport{
|
||||
public boolean setReadTimeout(long duration) throws LogicFaceException {
|
||||
try {
|
||||
if (duration <= 0) {
|
||||
this.channel.socket().setSoTimeout(0);
|
||||
// this.channel.socket().setSoTimeout(0);
|
||||
return true;
|
||||
}
|
||||
this.channel.socket().setSoTimeout((int)(duration));
|
||||
|
||||
@@ -112,11 +112,16 @@ public class UdpTransport extends Transport implements ITransport{
|
||||
return this.doReceive();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param duration 超时时间 , 以 毫秒 为单位, 小于等于0,表示永不超时
|
||||
* @return
|
||||
* @throws LogicFaceException
|
||||
*/
|
||||
@Override
|
||||
public boolean setReadTimeout(long duration) throws LogicFaceException {
|
||||
try {
|
||||
if (duration <= 0) {
|
||||
this.channel.socket().setSoTimeout(0);
|
||||
// this.channel.socket().setSoTimeout(0);
|
||||
return true;
|
||||
}
|
||||
this.channel.socket().setSoTimeout((int)(duration));
|
||||
|
||||
Reference in new issue
Block a user