Move timerID to pit entry; implement basic pipeline code
diff --git a/js/WebSocketTransport.js b/js/WebSocketTransport.js
index b40176e..594aff4 100644
--- a/js/WebSocketTransport.js
+++ b/js/WebSocketTransport.js
@@ -143,7 +143,7 @@
var currentClosure = pitEntry.closure;
// Cancel interest timer
- clearTimeout(currentClosure.timerID);
+ clearTimeout(pitEntry.timerID);
//console.log("Clear interest timer");
//console.log(currentClosure.timerID);
@@ -316,6 +316,7 @@
if (closure != null) {
var pitEntry = new PITEntry(interest, closure);
NDN.PITTable.push(pitEntry);
+ closure.pitEntry = pitEntry;
}
this.ws.send(bytearray.buffer);
@@ -323,7 +324,7 @@
// Set interest timer
if (closure != null) {
- closure.timerID = setTimeout(function() {
+ pitEntry.timerID = setTimeout(function() {
if (LOG > 3) console.log("Interest time out.");
// Remove PIT entry from NDN.PITTable
@@ -332,6 +333,8 @@
if (index >= 0)
NDN.PITTable.splice(index, 1);
//console.log(NDN.PITTable);
+ //console.log(pitEntry.interest.name.getName());
+
// Raise closure callback
closure.upcall(Closure.UPCALL_INTEREST_TIMED_OUT, new UpcallInfo(ndn, interest, 0, null));
}, interest.interestLifetime); // interestLifetime is in milliseconds.