Handling lack of WiFi gracefully (while "power napping" / sleep under OSX)

Hi,

I’m evaluating Duplicacy for our office backups (10 laptops) and have come across my first issue… I came back to my laptop after leaving it for a while and I had a series of “ERROR Failed to load the SFTP storage” messages, with an error of “dial tcp 192.168.1.7: connect: network is unreachable”.

This seems like something that could be left quietly appending to the log and not bringing up quite so intrusively.

Less important, but I had to hardcode the IP address. Your app doesn’t seem to be using the host’s resolver and hence doesn’t see .local addresses. This might lead to a variety of connection/authentication errors, and it would be nice if they were silently logged as well.

Seems to be working nicely otherwise so far! Seems to have good performance with nice small deltas!

Thanks,
Sam

The problem is that Duplicacy attempted to run an overdue backup operation immediately after the computer woke up from sleep. I think adding a delay like 30 seconds should be enough for the network to become available/stable.

Duplicacy can’t take .local addresses because the CLI version (which does all the work in the background) is written in Go and it seems that Go doesn’t use the Bonjour service on OSX to resolve addresses. I need to figure out a way to work around this issue.

Hi,
Sorry for the delay…

I’ve seen several attempts at backing up while the computer was “asleep”. I think having powernap lets the computer wake up periodically and allows most programs some cpu time.

A related issue is that the laptop may, or may not, be around wifi at the time (these are laptops that people take home) and hence the backup target isn’t always available on the network they’re connected to. In this case, I’d just like messages to be logged and not displayed to the user. Is there any chance of it doing this by default, or introducing an option to control this behaviour?

The Bonjour issue is trivial to us, but somewhat annoying. Not done much Go development before, but the docs:

https://golang.org/pkg/net/#hdr-Name_Resolution

suggest it just works, so I must be missing something.

Sorry I just saw your reply.

I’ve released version 2.0.0 which adds a minute delay before starting the backup when the computer is just returning from sleep. This could get rid of some failures caused by temporary network unavailability. For the next update I’ll add a check to see if the SFTP server is online before running the backup.

I’ll also fix the .local resolution issue in the next update.

The OSX version of Duplicacy is cross-built, so the cgo resolver isn’t available. The solution I’m thinking of is to let the GUI version do the name resolution (it needs to check the availability of the server anyway). The GUI version is written in C++ so the call to the Bonjour service should be easy. And then the GUI version will use an environment variable to override the server address passed to the CLI version.

Does this sound good to you?