aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-16 14:25:37 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-16 14:25:37 +0200
commit0dd079da272df8d532f0086d7c91597b43e7a143 (patch)
tree93fb2a1a063f7e70ad233117efbc52812858ad05 /server
parent3758da9489b636997a3a4fad7fc1a6081737bbe0 (diff)
downloadPeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.tar.gz
PeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.tar.zst
PeerTube-0dd079da272df8d532f0086d7c91597b43e7a143.zip
Update standard -> 10
Diffstat (limited to 'server')
-rw-r--r--server/helpers/peertube-crypto.js14
-rw-r--r--server/lib/base-request-scheduler.js8
-rw-r--r--server/tests/real-world/real-world.js6
3 files changed, 18 insertions, 10 deletions
diff --git a/server/helpers/peertube-crypto.js b/server/helpers/peertube-crypto.js
index ef6808d5c..55ae6fab3 100644
--- a/server/helpers/peertube-crypto.js
+++ b/server/helpers/peertube-crypto.js
@@ -74,7 +74,9 @@ function comparePassword (plainPassword, hashPassword, callback) {
74} 74}
75 75
76function createCertsIfNotExist (callback) { 76function createCertsIfNotExist (callback) {
77 certsExist(function (exist) { 77 certsExist(function (err, exist) {
78 if (err) return callback(err)
79
78 if (exist === true) { 80 if (exist === true) {
79 return callback(null) 81 return callback(null)
80 } 82 }
@@ -113,13 +115,17 @@ module.exports = peertubeCrypto
113 115
114function certsExist (callback) { 116function certsExist (callback) {
115 const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME) 117 const certPath = pathUtils.join(constants.CONFIG.STORAGE.CERT_DIR, constants.PRIVATE_CERT_NAME)
116 fs.exists(certPath, function (exists) { 118 fs.access(certPath, function (err) {
117 return callback(exists) 119 // If there is an error the certificates do not exist
120 const exists = !err
121 return callback(null, exists)
118 }) 122 })
119} 123}
120 124
121function createCerts (callback) { 125function createCerts (callback) {
122 certsExist(function (exist) { 126 certsExist(function (err, exist) {
127 if (err) return callback(err)
128
123 if (exist === true) { 129 if (exist === true) {
124 const string = 'Certs already exist.' 130 const string = 'Certs already exist.'
125 logger.warning(string) 131 logger.warning(string)
diff --git a/server/lib/base-request-scheduler.js b/server/lib/base-request-scheduler.js
index 4709c7960..7378971c8 100644
--- a/server/lib/base-request-scheduler.js
+++ b/server/lib/base-request-scheduler.js
@@ -66,10 +66,10 @@ module.exports = class BaseRequestScheduler {
66 err = err ? err.message : 'Status code not 20x : ' + res.statusCode 66 err = err ? err.message : 'Status code not 20x : ' + res.statusCode
67 logger.error('Error sending secure request to %s pod.', toPod.host, { error: err }) 67 logger.error('Error sending secure request to %s pod.', toPod.host, { error: err })
68 68
69 return callback(false) 69 return callback(err)
70 } 70 }
71 71
72 return callback(true) 72 return callback(null)
73 }) 73 })
74 } 74 }
75 75
@@ -99,8 +99,8 @@ module.exports = class BaseRequestScheduler {
99 const requestToMake = requestsToMakeGrouped[hashKey] 99 const requestToMake = requestsToMakeGrouped[hashKey]
100 const toPod = requestToMake.toPod 100 const toPod = requestToMake.toPod
101 101
102 this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (success) => { 102 this.makeRequest(toPod, requestToMake.endpoint, requestToMake.datas, (err) => {
103 if (success === false) { 103 if (err) {
104 badPods.push(requestToMake.toPod.id) 104 badPods.push(requestToMake.toPod.id)
105 return callbackEach() 105 return callbackEach()
106 } 106 }
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index 21f0732d0..3ac13f053 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -102,7 +102,9 @@ runServers(numberOfPods, function (err, servers) {
102 checking = true 102 checking = true
103 103
104 const waitingInterval = setInterval(function () { 104 const waitingInterval = setInterval(function () {
105 isThereAwaitingRequests(servers, function (res) { 105 isThereAwaitingRequests(servers, function (err, res) {
106 if (err) throw err
107
106 if (res === true) { 108 if (res === true) {
107 console.log('A server has awaiting requests, waiting...') 109 console.log('A server has awaiting requests, waiting...')
108 return 110 return
@@ -360,6 +362,6 @@ function isThereAwaitingRequests (servers, callback) {
360 }, function (err) { 362 }, function (err) {
361 if (err) throw err 363 if (err) throw err
362 364
363 return callback(noRequests === false) 365 return callback(null, noRequests === false)
364 }) 366 })
365} 367}