Use get_availability to determine stream availability
More info than peer_count, and now has built-in timeout
This commit is contained in:
parent
d904744a31
commit
c209c1f84f
2 changed files with 6 additions and 2 deletions
|
@ -248,13 +248,13 @@ export let FileActions = React.createClass({
|
|||
componentDidMount: function() {
|
||||
this._isMounted = true;
|
||||
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate);
|
||||
lbry.getPeersForBlobHash(this.props.sdHash, (peers) => {
|
||||
lbry.getStreamAvailability(this.props.streamName, (availability) => {
|
||||
if (!this._isMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
available: peers.length > 0,
|
||||
available: availability > 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -207,6 +207,10 @@ lbry.getPeersForBlobHash = function(blobHash, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
lbry.getStreamAvailability = function(name, callback) {
|
||||
lbry.call('get_availability', {name: name}, callback);
|
||||
}
|
||||
|
||||
lbry.getCostInfoForName = function(name, callback, errorCallback) {
|
||||
/**
|
||||
* Takes a LBRY name; will first try and calculate a total cost using
|
||||
|
|
Loading…
Reference in a new issue