Skip to content

Commit 27fb75f

Browse files
committed
more cleanup
1 parent 5bdfd73 commit 27fb75f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/replicator.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,13 +1830,15 @@ module.exports = class Replicator {
18301830
const allowPush = this.isAllowingPush()
18311831
const linger = this._notDownloadingLinger
18321832

1833-
clearTimeout(this._notDownloadingTimer)
1834-
this._notDownloadingTimer = null
1833+
if (this._notDownloadingTimer) {
1834+
clearTimeout(this._notDownloadingTimer)
1835+
this._notDownloadingTimer = null
1836+
}
18351837

18361838
if (this.destroyed) return
18371839

18381840
if (downloading || linger === 0) {
1839-
if (!this.setDownloadingNow(downloading)) this.signalAllowPush(allowPush)
1841+
if (!this._setDownloadingNow(downloading)) this.signalAllowPush(allowPush)
18401842
return
18411843
}
18421844

@@ -1850,10 +1852,12 @@ module.exports = class Replicator {
18501852
for (const peer of this.peers) peer.signalUpgrade()
18511853
}
18521854

1853-
setDownloadingNow(downloading) {
1855+
_setDownloadingNow(downloading) {
18541856
this._notDownloadingTimer = null
1857+
18551858
if (this.downloading === downloading) return false
18561859
this.downloading = downloading
1860+
18571861
if (!downloading && this.isDownloading()) return false
18581862

18591863
for (const peer of this.peers) peer.signalUpgrade()
@@ -3074,7 +3078,7 @@ function onwireextension(m, c) {
30743078
}
30753079

30763080
function setNotDownloadingLater(repl, session) {
3077-
repl.setDownloadingNow(false, session)
3081+
repl._setDownloadingNow(false, session)
30783082
}
30793083

30803084
function isBlockRequest(req) {

0 commit comments

Comments
 (0)