Don't start model until services have been added (fixes #1969)

This commit is contained in:
Jakob Borg 2015-06-20 20:04:47 +02:00
parent b5198d8119
commit d347e54acb
4 changed files with 18 additions and 12 deletions

View File

@ -601,7 +601,6 @@ func syncthingMain() {
m := model.NewModel(cfg, myID, myName, "syncthing", Version, ldb) m := model.NewModel(cfg, myID, myName, "syncthing", Version, ldb)
cfg.Subscribe(m) cfg.Subscribe(m)
mainSvc.Add(m)
if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 { if t := os.Getenv("STDEADLOCKTIMEOUT"); len(t) > 0 {
it, err := strconv.Atoi(t) it, err := strconv.Atoi(t)
@ -634,6 +633,8 @@ func syncthingMain() {
} }
} }
mainSvc.Add(m)
// GUI // GUI
setupGUI(mainSvc, cfg, m, apiSub) setupGUI(mainSvc, cfg, m, apiSub)

View File

@ -179,6 +179,7 @@ func (m *Model) StartFolderRW(folder string) {
if !ok { if !ok {
l.Fatalf("Requested versioning type %q that does not exist", cfg.Versioning.Type) l.Fatalf("Requested versioning type %q that does not exist", cfg.Versioning.Type)
} }
versioner := factory(folder, cfg.Path(), cfg.Versioning.Params) versioner := factory(folder, cfg.Path(), cfg.Versioning.Params)
if service, ok := versioner.(suture.Service); ok { if service, ok := versioner.(suture.Service); ok {
// The versioner implements the suture.Service interface, so // The versioner implements the suture.Service interface, so
@ -189,7 +190,7 @@ func (m *Model) StartFolderRW(folder string) {
p.versioner = versioner p.versioner = versioner
} }
go p.Serve() m.Add(p)
} }
// StartFolderRO starts read only processing on the current model. When in // StartFolderRO starts read only processing on the current model. When in

View File

@ -3,31 +3,31 @@
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device>
<device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device> <device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device>
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device>
<versioning type="simple"> <versioning type="trashcan">
<param key="keep" val="5"></param> <param key="cleanoutDays" val="1"></param>
</versioning> </versioning>
<lenientMtimes>false</lenientMtimes>
<copiers>1</copiers> <copiers>1</copiers>
<pullers>16</pullers> <pullers>16</pullers>
<hashers>0</hashers> <hashers>0</hashers>
<order>random</order>
</folder> </folder>
<folder id="s12" path="s12-2" ro="false" rescanIntervalS="15" ignorePerms="false" autoNormalize="true"> <folder id="s12" path="s12-2" ro="false" rescanIntervalS="15" ignorePerms="false" autoNormalize="true">
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device>
<device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device> <device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device>
<versioning></versioning> <versioning></versioning>
<lenientMtimes>false</lenientMtimes>
<copiers>1</copiers> <copiers>1</copiers>
<pullers>16</pullers> <pullers>16</pullers>
<hashers>0</hashers> <hashers>0</hashers>
<order>random</order>
</folder> </folder>
<folder id="s23" path="s23-2" ro="false" rescanIntervalS="15" ignorePerms="false" autoNormalize="true"> <folder id="s23" path="s23-2" ro="false" rescanIntervalS="15" ignorePerms="false" autoNormalize="true">
<device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device> <device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device>
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device>
<versioning></versioning> <versioning></versioning>
<lenientMtimes>false</lenientMtimes>
<copiers>1</copiers> <copiers>1</copiers>
<pullers>16</pullers> <pullers>16</pullers>
<hashers>0</hashers> <hashers>0</hashers>
<order>random</order>
</folder> </folder>
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false"> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false">
<address>127.0.0.1:22001</address> <address>127.0.0.1:22001</address>
@ -57,6 +57,7 @@
<upnpEnabled>true</upnpEnabled> <upnpEnabled>true</upnpEnabled>
<upnpLeaseMinutes>0</upnpLeaseMinutes> <upnpLeaseMinutes>0</upnpLeaseMinutes>
<upnpRenewalMinutes>1</upnpRenewalMinutes> <upnpRenewalMinutes>1</upnpRenewalMinutes>
<upnpTimeoutSeconds>10</upnpTimeoutSeconds>
<urAccepted>-1</urAccepted> <urAccepted>-1</urAccepted>
<urUniqueID></urUniqueID> <urUniqueID></urUniqueID>
<restartOnWakeup>true</restartOnWakeup> <restartOnWakeup>true</restartOnWakeup>
@ -66,5 +67,6 @@
<progressUpdateIntervalS>5</progressUpdateIntervalS> <progressUpdateIntervalS>5</progressUpdateIntervalS>
<symlinksEnabled>true</symlinksEnabled> <symlinksEnabled>true</symlinksEnabled>
<limitBandwidthInLan>false</limitBandwidthInLan> <limitBandwidthInLan>false</limitBandwidthInLan>
<databaseBlockCacheMiB>0</databaseBlockCacheMiB>
</options> </options>
</configuration> </configuration>

View File

@ -1,24 +1,24 @@
<configuration version="9"> <configuration version="10">
<folder id="s23" path="s23-3" ro="false" rescanIntervalS="20" ignorePerms="false" autoNormalize="false"> <folder id="s23" path="s23-3" ro="false" rescanIntervalS="20" ignorePerms="false" autoNormalize="true">
<device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device> <device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device>
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device>
<versioning></versioning> <versioning></versioning>
<lenientMtimes>false</lenientMtimes>
<copiers>1</copiers> <copiers>1</copiers>
<pullers>16</pullers> <pullers>16</pullers>
<hashers>0</hashers> <hashers>0</hashers>
<order>random</order>
</folder> </folder>
<folder id="default" path="s3" ro="false" rescanIntervalS="20" ignorePerms="false" autoNormalize="false"> <folder id="default" path="s3" ro="false" rescanIntervalS="20" ignorePerms="false" autoNormalize="true">
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU"></device>
<device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device> <device id="JMFJCXB-GZDE4BN-OCJE3VF-65GYZNU-AIVJRET-3J6HMRQ-AUQIGJO-FKNHMQU"></device>
<device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device> <device id="373HSRP-QLPNLIE-JYKZVQF-P4PKZ63-R2ZE6K3-YD442U2-JHBGBQG-WWXAHAU"></device>
<versioning type="simple"> <versioning type="simple">
<param key="keep" val="5"></param> <param key="keep" val="5"></param>
</versioning> </versioning>
<lenientMtimes>false</lenientMtimes>
<copiers>1</copiers> <copiers>1</copiers>
<pullers>16</pullers> <pullers>16</pullers>
<hashers>0</hashers> <hashers>0</hashers>
<order>random</order>
</folder> </folder>
<device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false"> <device id="I6KAH76-66SLLLB-5PFXSOA-UFJCDZC-YAOMLEK-CP2GB32-BV5RQST-3PSROAU" name="s1" compression="metadata" introducer="false">
<address>127.0.0.1:22001</address> <address>127.0.0.1:22001</address>
@ -48,6 +48,7 @@
<upnpEnabled>false</upnpEnabled> <upnpEnabled>false</upnpEnabled>
<upnpLeaseMinutes>0</upnpLeaseMinutes> <upnpLeaseMinutes>0</upnpLeaseMinutes>
<upnpRenewalMinutes>30</upnpRenewalMinutes> <upnpRenewalMinutes>30</upnpRenewalMinutes>
<upnpTimeoutSeconds>10</upnpTimeoutSeconds>
<urAccepted>-1</urAccepted> <urAccepted>-1</urAccepted>
<urUniqueID></urUniqueID> <urUniqueID></urUniqueID>
<restartOnWakeup>true</restartOnWakeup> <restartOnWakeup>true</restartOnWakeup>
@ -57,5 +58,6 @@
<progressUpdateIntervalS>5</progressUpdateIntervalS> <progressUpdateIntervalS>5</progressUpdateIntervalS>
<symlinksEnabled>true</symlinksEnabled> <symlinksEnabled>true</symlinksEnabled>
<limitBandwidthInLan>false</limitBandwidthInLan> <limitBandwidthInLan>false</limitBandwidthInLan>
<databaseBlockCacheMiB>0</databaseBlockCacheMiB>
</options> </options>
</configuration> </configuration>