If get_availability gives an error, treat the stream as unavailable
This commit is contained in:
parent
fbb11d78c7
commit
bb26b5372a
2 changed files with 13 additions and 8 deletions
|
@ -249,13 +249,18 @@ export let FileActions = React.createClass({
|
|||
this._isMounted = true;
|
||||
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate);
|
||||
lbry.getStreamAvailability(this.props.streamName, (availability) => {
|
||||
if (!this._isMounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._isMounted) {
|
||||
this.setState({
|
||||
available: availability > 0,
|
||||
});
|
||||
}
|
||||
}, () => {
|
||||
// Take any error to mean the file is unavailable
|
||||
if (this._isMounted) {
|
||||
this.setState({
|
||||
available: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
componentWillUnmount: function() {
|
||||
|
|
|
@ -207,8 +207,8 @@ lbry.getPeersForBlobHash = function(blobHash, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
lbry.getStreamAvailability = function(name, callback) {
|
||||
lbry.call('get_availability', {name: name}, callback);
|
||||
lbry.getStreamAvailability = function(name, callback, errorCallback) {
|
||||
lbry.call('get_availability', {name: name}, callback, errorCallback);
|
||||
}
|
||||
|
||||
lbry.getCostInfoForName = function(name, callback, errorCallback) {
|
||||
|
|
Loading…
Reference in a new issue