Start the fs watch after the VPN directory has been created - Use finally and not then

This commit is contained in:
Praneeth Bodduluri 2015-09-01 17:56:25 +05:30 committed by Pablo Carranza Vélez
parent ac545ccc52
commit 7b8ca9fd73

View File

@ -74,6 +74,7 @@ disableConnectivityCheck = false
checkHost = (options) -> checkHost = (options) ->
if disableConnectivityCheck or pauseConnectivityCheck if disableConnectivityCheck or pauseConnectivityCheck
return true return true
else
return networkCheck.checkHost(options) return networkCheck.checkHost(options)
# Custom monitor that uses checkHost function above. # Custom monitor that uses checkHost function above.
@ -103,6 +104,8 @@ exports.connectivityCheck = _.once ->
parsedUrl = url.parse(config.apiEndpoint) parsedUrl = url.parse(config.apiEndpoint)
fs.mkdirAsync(config.vpnStatusPath) fs.mkdirAsync(config.vpnStatusPath)
.then -> .then ->
console.log('Creating directory for watching VPN status...')
.finally ->
fs.watch(config.vpnStatusPath, vpnStatusInotifyCallback) fs.watch(config.vpnStatusPath, vpnStatusInotifyCallback)
.catch EEXIST, (err) -> .catch EEXIST, (err) ->