syncthing/cmd
Jakob Borg 44d30c83bf lib/config, cmd/syncthing: Handle committing configuration better (fixes #3077)
This slightly changes the interface used for committing configuration
changes. The two parts are now:

 - VerifyConfiguration, which runs synchronously and locked, and can
   abort the config change. These callbacks shouldn't *do* anything
   apart from looking at the config changes and saying yes or no. No
   change from previously.

 - CommitConfiguration, which runs asynchronously (one goroutine per
   call) *after* replacing the config and releasing any locks. Returning
   false from these methods sets the "requires restart" flag, which now
   lives in the config.Wrapper.

This should be deadlock free as the CommitConfiguration calls can take
as long as they like and can wait for locks to be released when they
need to tweak things. I think this should be safe compared to before as
the CommitConfiguration calls were always made from a random background
goroutine (typically one from the HTTP server), so it was always
concurrent with everything else anyway.

Hence the CommitResponse type is gone, instead you get an error back on
verification failure only, and need to explicitly check
w.RequiresRestart() afterwards if you care.

As an added bonus this fixes a bug where we would reset the "requires
restart" indicator if a config that did not require restart was saved,
even if we already were in the requires-restart state.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3386
2016-07-04 20:32:34 +00:00
..
stbench cmd/stbench: Add utility to run benchmark tests 2016-03-25 20:52:20 +00:00
stcompdirs mv internal lib 2015-08-09 09:35:26 +02:00
stdisco lib/protocol, lib/discover, lib/db: Use protocol buffer serialization (fixes #3080) 2016-07-04 10:40:29 +00:00
stdiscosrv build, cmd/stdiscosrv, cmd/strelaysrv: Rename binaries to add "st" prefix 2016-07-04 10:51:22 +00:00
stevents Change (default) GUI port from 8080 to 8384 ('ST' in ascii values) 2015-03-26 21:36:06 +01:00
stfileinfo Fix import paths 2015-09-22 19:38:46 +02:00
stfinddevice lib/connections: Refactor 2016-05-04 19:38:12 +00:00
stgenfiles cmd/stgenfiles: Add utility for generating test data 2016-03-25 20:50:48 +00:00
stindex lib/protocol, lib/discover, lib/db: Use protocol buffer serialization (fixes #3080) 2016-07-04 10:40:29 +00:00
strelaypoolsrv cmd/strelaypoolsrv: Remove unused var (metalint) 2016-07-04 21:22:53 +02:00
strelaysrv build, cmd/stdiscosrv, cmd/strelaysrv: Rename binaries to add "st" prefix 2016-07-04 10:51:22 +00:00
stsigtool cmd/stsigtool: Sign stdin when not given a file to sign, or when given "-" 2016-05-05 19:05:45 +00:00
stvanity cmd/stvanity: x509.GenerateCertificate requires pointer for public key 2016-04-28 22:22:33 +00:00
stwatchfile Add stwatchfile 2015-07-27 19:00:22 +01:00
syncthing lib/config, cmd/syncthing: Handle committing configuration better (fixes #3077) 2016-07-04 20:32:34 +00:00
todos MPLv2 2015-03-17 16:02:27 +01:00
.gitignore Remove reprecated st* utils 2014-07-01 12:20:25 +02:00