public void onTimeout(Interest interest) { string trackId = interest.getName().get(consumerOuterInstance.producerNameComponents.trackIdOffset).toEscapedString(); try { Track track; try { track = consumerOuterInstance.activeTracks [trackId]; } catch (KeyNotFoundException) { track = consumerOuterInstance.pendingTracks [trackId]; } int timeoutCnt = track.incTimeoutCnt(); if (timeoutCnt <= consumerOuterInstance.config.trackTimeoutCntThreshold) { consumerOuterInstance.face.expressInterest(interest, this, this); } else { consumerOuterInstance.deactivateTrack(trackId); } } catch (KeyNotFoundException) { Debug.Log("Unexectedly adding track " + trackId + " because of expressed interest"); // this shouldn't happen but lets add the track just in case // if we are here its probably because trackIDs are being mangled somehow consumerOuterInstance.addPendingTrack(trackId); } }
public void onData(Interest interest, Data data) { JSONNode parsedHint = JSON.Parse(data.getContent().toString()); foreach (JSONNode track in parsedHint["tracks"].AsArray) { string trackID = track ["id"]; // The consumer ignores the sequence number field in the hint for now; // As the consumer assumes it's getting the latest via outstanding interest. // Right now the consumer does not stop fetching tracks that have become inactive. // WHAT!!!!! EGM TODO!!!! if (!consumerOuterInstance.activeTracks.ContainsKey(trackID)) { if (!consumerOuterInstance.pendingTracks.ContainsKey(trackID)) // if new track { consumerOuterInstance.addPendingTrack(trackID); } } } consumerOuterInstance.expressHintInterest(data.getName().get(-1)); //exclues this interest }