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