Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
main: resilience on decodeSuccess, add more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioribeiro committed Oct 24, 2014
1 parent 6521510 commit 4c5cd3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ class P2PHLS extends HLS {
}

onDecodeSuccess() {
this.resourceRequester.decodingError = false
this.storage.setItem(this.currentUrl, this.currentChunk)
this.currentUrl = null
this.currentChunk = null
if (this.currentUrl) {
this.resourceRequester.decodingError = false
this.storage.setItem(this.currentUrl, this.currentChunk)
this.currentUrl = null
this.currentChunk = null
}
}

requestResource(url) {
Expand Down
3 changes: 2 additions & 1 deletion src/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Peer extends BaseObject {

sendSatisfy(resource) {
if (this.uploadHandler.getSlot(this.ident)) {
log.warn("sending chunk")
this.send('satisfy', resource, this.storage.getItem(resource))
this.playbackInfo.updateChunkStats('p2psent')
} else {
Expand Down Expand Up @@ -61,7 +62,7 @@ class Peer extends BaseObject {
break
case 'satisfy':
if (content.length > 0) {
log.debug('received _satisfy_ ' + content.length)
log.debug('received _satisfy_ ')
this.swarm.satisfyReceived(this, resource, content)
}
break
Expand Down
1 change: 0 additions & 1 deletion src/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class Swarm extends BaseObject {
var successPeer = this.utils.findPeer(this.satisfyElected)
var goodPeers = _.union([successPeer], this.satisfyCandidates)
var badPeers = _.difference(this.contributors, goodPeers)
log.info("contributors good: " + goodPeers.length)
this.utils.incrementScore(goodPeers)
this.utils.incrementScore([successPeer]) //double satisfyElected score gain :)
this.utils.decrementScore(badPeers)
Expand Down

0 comments on commit 4c5cd3d

Please sign in to comment.