feat(config): p2p replication client and server separate for performance optimization
This commit is contained in:
@ -219,6 +219,20 @@ export default class ConfigPage extends Page {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className='column w100p'>
|
||||
<Toggle
|
||||
style={{marginTop: '10px'}}
|
||||
label={__('P2P torrents replication server')}
|
||||
toggled={this.options.p2pReplicationServer}
|
||||
onToggle={(e, checked) => {
|
||||
this.options.p2pReplicationServer = checked
|
||||
if(!checked)
|
||||
this.options.p2pReplication = false
|
||||
this.forceUpdate()
|
||||
}}
|
||||
/>
|
||||
<div className='fs0-75' style={{color: 'grey'}}>* {__('Enable torrents replication server for other rats clients (required for replication)')}.</div>
|
||||
</div>
|
||||
<div className='column w100p'>
|
||||
<Toggle
|
||||
style={{marginTop: '10px'}}
|
||||
@ -226,6 +240,8 @@ export default class ConfigPage extends Page {
|
||||
toggled={this.options.p2pReplication}
|
||||
onToggle={(e, checked) => {
|
||||
this.options.p2pReplication = checked
|
||||
if(checked)
|
||||
this.options.p2pReplicationServer = true
|
||||
this.forceUpdate()
|
||||
}}
|
||||
/>
|
||||
|
@ -163,8 +163,8 @@ export default class Torrent extends Component {
|
||||
downloaded: false,
|
||||
startingDownloading: false,
|
||||
downloadProgress: {},
|
||||
downloadRemoveOnDone: false,
|
||||
downloadPaused: false,
|
||||
downloadRemoveOnDone: false,
|
||||
downloadPaused: false,
|
||||
}
|
||||
constructor(props)
|
||||
{
|
||||
@ -179,8 +179,8 @@ export default class Torrent extends Component {
|
||||
}
|
||||
this.state.downloading = progress < 1
|
||||
this.state.downloaded = progress === 1
|
||||
this.state.downloadRemoveOnDone = removeOnDone
|
||||
this.state.downloadPaused = paused
|
||||
this.state.downloadRemoveOnDone = removeOnDone
|
||||
this.state.downloadPaused = paused
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,8 +226,8 @@ export default class Torrent extends Component {
|
||||
return;
|
||||
|
||||
this.setState({
|
||||
downloadRemoveOnDone: options.removeOnDone,
|
||||
downloadPaused: options.paused
|
||||
downloadRemoveOnDone: options.removeOnDone,
|
||||
downloadPaused: options.paused
|
||||
})
|
||||
}
|
||||
window.torrentSocket.on('downloadUpdate', this.downloadUpdate);
|
||||
@ -253,8 +253,8 @@ export default class Torrent extends Component {
|
||||
if(torrent.good > 0 || torrent.bad > 0)
|
||||
torrentRating = Math.round(rating(torrent.good, torrent.bad) * 100);
|
||||
|
||||
const canDeleteDownloadAfterFinish = (this.state.downloading || this.state.startingDownloading) && !this.state.downloaded
|
||||
const canPause = (this.state.downloading || this.state.startingDownloading)
|
||||
const canDeleteDownloadAfterFinish = (this.state.downloading || this.state.startingDownloading) && !this.state.downloaded
|
||||
const canPause = (this.state.downloading || this.state.startingDownloading)
|
||||
|
||||
return (
|
||||
<div>
|
||||
@ -359,7 +359,7 @@ export default class Torrent extends Component {
|
||||
leftIcon={contentIcon(torrent.contentType, torrent.contentCategory, torrent.contentCategory != 'xxx' ? (torrent.peer ? '#6f5ee0' : 'grey') : (torrent.peer ? '#9083e2' : '#d3d3d3'))}
|
||||
rightIcon={
|
||||
<div className='row inline' style={{width: 63 + (canDeleteDownloadAfterFinish ? 40 : 0) + (canPause ? 40 : 0)}}>
|
||||
{
|
||||
{
|
||||
// mark delete after finish
|
||||
canPause
|
||||
&&
|
||||
@ -374,14 +374,14 @@ export default class Torrent extends Component {
|
||||
e.stopPropagation();
|
||||
window.torrentSocket.emit('downloadUpdate', torrent.hash, {pause: 'switch'})
|
||||
}} viewBox="0 0 438.536 438.536">
|
||||
<g>
|
||||
<path d="M164.453,0H18.276C13.324,0,9.041,1.807,5.425,5.424C1.808,9.04,0.001,13.322,0.001,18.271v401.991
|
||||
c0,4.948,1.807,9.233,5.424,12.847c3.619,3.617,7.902,5.428,12.851,5.428h146.181c4.949,0,9.231-1.811,12.847-5.428
|
||||
c3.617-3.613,5.424-7.898,5.424-12.847V18.271c0-4.952-1.807-9.231-5.428-12.847C173.685,1.807,169.402,0,164.453,0z"/>
|
||||
<path d="M433.113,5.424C429.496,1.807,425.215,0,420.267,0H274.086c-4.949,0-9.237,1.807-12.847,5.424
|
||||
c-3.621,3.615-5.432,7.898-5.432,12.847v401.991c0,4.948,1.811,9.233,5.432,12.847c3.609,3.617,7.897,5.428,12.847,5.428h146.181
|
||||
c4.948,0,9.229-1.811,12.847-5.428c3.614-3.613,5.421-7.898,5.421-12.847V18.271C438.534,13.319,436.73,9.04,433.113,5.424z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path d="M164.453,0H18.276C13.324,0,9.041,1.807,5.425,5.424C1.808,9.04,0.001,13.322,0.001,18.271v401.991
|
||||
c0,4.948,1.807,9.233,5.424,12.847c3.619,3.617,7.902,5.428,12.851,5.428h146.181c4.949,0,9.231-1.811,12.847-5.428
|
||||
c3.617-3.613,5.424-7.898,5.424-12.847V18.271c0-4.952-1.807-9.231-5.428-12.847C173.685,1.807,169.402,0,164.453,0z"/>
|
||||
<path d="M433.113,5.424C429.496,1.807,425.215,0,420.267,0H274.086c-4.949,0-9.237,1.807-12.847,5.424
|
||||
c-3.621,3.615-5.432,7.898-5.432,12.847v401.991c0,4.948,1.811,9.233,5.432,12.847c3.609,3.617,7.897,5.428,12.847,5.428h146.181
|
||||
c4.948,0,9.229-1.811,12.847-5.428c3.614-3.613,5.421-7.898,5.421-12.847V18.271C438.534,13.319,436.73,9.04,433.113,5.424z"/>
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</ToolTip>
|
||||
|
Reference in New Issue
Block a user