Support null closure
diff --git a/js/tools/build/ndn-js-uncomp.js b/js/tools/build/ndn-js-uncomp.js
index 6f3a295..e4117eb 100644
--- a/js/tools/build/ndn-js-uncomp.js
+++ b/js/tools/build/ndn-js-uncomp.js
@@ -297,7 +297,7 @@
if (LOG > 3) console.log("Fetch key according to keylocator");
var nextClosure = new KeyFetchClosure(co, currentClosure, keylocator.keyName, sigHex, wit);
var interest = new Interest(keylocator.keyName.contentName.getPrefix(4));
- interest.interestLifetime = 4.0;
+ interest.interestLifetime = 4000; // milliseconds
self.expressInterest(ndn, interest, nextClosure);
}
}
@@ -379,26 +379,30 @@
var bytearray = new Uint8Array(binaryInterest.length);
bytearray.set(binaryInterest);
- var pitEntry = new PITEntry(interest, closure);
- NDN.PITTable.push(pitEntry);
+ if (closure != null) {
+ var pitEntry = new PITEntry(interest, closure);
+ NDN.PITTable.push(pitEntry);
+ }
this.ws.send(bytearray.buffer);
if (LOG > 3) console.log('ws.send() returned.');
// Set interest timer
- closure.timerID = setTimeout(function() {
- if (LOG > 3) console.log("Interest time out.");
-
- // Remove PIT entry from NDN.PITTable
- var index = NDN.PITTable.indexOf(pitEntry);
- //console.log(NDN.PITTable);
- if (index >= 0)
- NDN.PITTable.splice(index, 1);
- //console.log(NDN.PITTable);
- // Raise closure callback
- closure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT, new UpcallInfo(ndn, interest, 0, null));
- }, interest.interestLifetime); // interestLifetime is in milliseconds.
- //console.log(closure.timerID);
+ if (closure != null) {
+ closure.timerID = setTimeout(function() {
+ if (LOG > 3) console.log("Interest time out.");
+
+ // Remove PIT entry from NDN.PITTable
+ var index = NDN.PITTable.indexOf(pitEntry);
+ //console.log(NDN.PITTable);
+ if (index >= 0)
+ NDN.PITTable.splice(index, 1);
+ //console.log(NDN.PITTable);
+ // Raise closure callback
+ closure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT, new UpcallInfo(ndn, interest, 0, null));
+ }, interest.interestLifetime); // interestLifetime is in milliseconds.
+ //console.log(closure.timerID);
+ }
}
else
console.log('WebSocket connection is not established.');