Skip to content

Commit

Permalink
Merge branch 'release/1.0.25'
Browse files Browse the repository at this point in the history
* release/1.0.25:
  Update version_check.php
  Bump version
  Update changelog
  Update translations
  Be smarter at timing out network operations
  Fix removing 'starting' state from displayed file transfers
  Fix typo, which fixes crash on shutdown
  • Loading branch information
canton7 committed Jun 20, 2015
2 parents 0bff742 + 9b05cf2 commit abc881e
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 96 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

v1.0.25
-------

- Fix crash on shutdown (#117)
- Don't show file tranfers that are 'starting'
- Be smarter about network timeouts when resuming from sleep

v1.0.24
-------

Expand Down
15 changes: 8 additions & 7 deletions server/version_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,22 @@ function get_with_wildcard($src, $value, $default = null)
}

$versions = [
'1.0.24' => [
'1.0.25' => [
'installed' => [
'direct_download_url' => [
'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.24/SyncTrayzorSetup-x64.exe',
'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.24/SyncTrayzorSetup-x86.exe',
'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.25/SyncTrayzorSetup-x64.exe',
'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.25/SyncTrayzorSetup-x86.exe',
],
],
'sha1sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.24/sha1sum.txt.asc',
'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v1.0.24',
'release_notes' => "MANDATORY UPGRADE! Adds support for Syncthing 0.11.10.\nIf you do not upgrade, you may see crashes!\n\n- Support for Syncthing v0.11.10\n- Fix and improve file transfers window (#101, #106)\n- Fix various crashes (#108, #112, #114, #115, #116)\n- Add option to disable hardware rendering (#104)\n- Add Chinese translation (thanks Honpan Lung!)",
'sha1sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.0.25/sha1sum.txt.asc',
'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v1.0.25',
'release_notes' => "MANDATORY UPGRADE! Adds support for Syncthing 0.11.10.\nIf you do not upgrade, you may see crashes!\n\n- Support for Syncthing v0.11.10\n- Fix and improve file transfers window (#101, #106)\n- Fix various crashes (#108, #112, #114, #115, #116)\n- Add option to disable hardware rendering (#104)\n- Add Chinese translation (thanks Honpan Lung!)\n- Fix crash on shutdown (#117)\n- Don't show file tranfers that are 'starting'\n- Be smarter about network timeouts when resuming from sleep",
]
];

$upgrades = [
'1.0.23' => ['to' => 'latest', 'formatter' => '3', 'overrides' => ['release_notes' => "- Fix a couple of crashes (#116)\n- Add Chinese translation (thanks Honpan Lung!)"]],
'1.0.24' => ['to' => 'latest', 'formatter' => '3', 'overrides' => ['release_notes' => "- Fix crash on shutdown (#117)\n- Don't show file tranfers that are 'starting'\n- Be smarter about network timeouts when resuming from sleep"]],
'1.0.23' => ['to' => 'latest', 'formatter' => '3', 'overrides' => ['release_notes' => "- Fix a couple of crashes (#116)\n- Add Chinese translation (thanks Honpan Lung!)\n- Fix crash on shutdown (#117)\n- Don't show file tranfers that are 'starting'\n- Be smarter about network timeouts when resuming from sleep"]],
'1.0.22' => ['to' => 'latest', 'formatter' => '2'],
'1.0.21' => ['to' => 'latest', 'formatter' => '2'],
'1.0.20' => ['to' => 'latest', 'formatter' => '2'],
Expand Down
4 changes: 2 additions & 2 deletions src/ChecksumUtil/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.24.0")]
[assembly: AssemblyFileVersion("1.0.24.0")]
[assembly: AssemblyVersion("1.0.25.0")]
[assembly: AssemblyFileVersion("1.0.25.0")]
4 changes: 2 additions & 2 deletions src/ProcessRunner/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.20.0")]
[assembly: AssemblyVersion("1.0.24.0")]
[assembly: AssemblyFileVersion("1.0.24.0")]
[assembly: AssemblyVersion("1.0.25.0")]
[assembly: AssemblyFileVersion("1.0.25.0")]
16 changes: 5 additions & 11 deletions src/SyncTrayzor/Pages/FileTransfersTrayViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public void UpdateState()
{
switch (this.FileTransfer.Status)
{
case FileTransferStatus.Started:
this.ProgressString = Resources.FileTransfersTrayView_Starting;
this.ProgressPercent = 0;
break;

case FileTransferStatus.InProgress:
if (this.FileTransfer.DownloadBytesPerSecond.HasValue)
{
Expand Down Expand Up @@ -149,7 +144,7 @@ protected override void OnActivate()
this.CompletedTransfers.Add(new FileTransferViewModel(completedTransfer));
}

foreach (var inProgressTranser in this.syncThingManager.TransferHistory.InProgressTransfers.Reverse())
foreach (var inProgressTranser in this.syncThingManager.TransferHistory.InProgressTransfers.Where(x => x.Status == FileTransferStatus.InProgress).Reverse())
{
this.InProgressTransfers.Add(new FileTransferViewModel(inProgressTranser));
}
Expand Down Expand Up @@ -177,12 +172,11 @@ private void TransferStateChanged(object sender, FileTransferChangedEventArgs e)
var transferVm = this.InProgressTransfers.FirstOrDefault(x => x.FileTransfer == e.FileTransfer);
if (transferVm == null)
{
transferVm = new FileTransferViewModel(e.FileTransfer);

if (e.FileTransfer.Status == FileTransferStatus.Completed)
this.CompletedTransfers.Insert(0, transferVm);
else
this.InProgressTransfers.Insert(0, transferVm);
this.CompletedTransfers.Insert(0, new FileTransferViewModel(e.FileTransfer));
else if (e.FileTransfer.Status == FileTransferStatus.InProgress)
this.InProgressTransfers.Insert(0, new FileTransferViewModel(e.FileTransfer));
// We don't care about 'starting' transfers
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/SyncTrayzor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.20.0")]
[assembly: AssemblyVersion("1.0.24.0")]
[assembly: AssemblyFileVersion("1.0.24.0")]
[assembly: AssemblyVersion("1.0.25.0")]
[assembly: AssemblyFileVersion("1.0.25.0")]
11 changes: 1 addition & 10 deletions src/SyncTrayzor/Properties/Strings/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor va a tindre que tancar-se. Disculpe les molèsties.</value>
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Starting...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 day|{} days} ago</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.cs.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ Je nám líto, ale SyncTrayzor se musí ukončit.</value>
<value>Odtud: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Spouštění...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>Před {0:p:1 dnem|{} dny}</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor wird nun geschlossen.</value>
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Startet...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>vor {0:p:1 Tag|{} Tagen}</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.el.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ The menu option "Syncthing -&gt;Kill all Syncthing processes" corresponds to She
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Starting...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 day|{} days} ago</value>
</data>
Expand Down
8 changes: 2 additions & 6 deletions src/SyncTrayzor/Properties/Strings/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@
<comment>Shown within AboutView_SyncthingVersion if Syncthing's version couldn't be determined</comment>
</data>
<data name="Dialog_ConfirmKillAllProcesses_Message" xml:space="preserve">
<value>Are you sure you want to kill all Syncthing processes, even those not managed by SyncTrayzor?
<value>¿Estás seguro de que quieres parar todos los procesos de Syncthing, incluso aquellos no gestionados por SyncTrayzor?

This risks corrupting Syncthing&apos;s database. ONLY do this if you are unable to start Syncthing because another Syncthing process is currently running.</value>
Esto conlleva el riesgo de corromper la base de datos de Syncthing. Haz esto SOLAMENTE si no es posible inciar Syncthing porque hay otro proceso de Syncthing ejecutándose.</value>
<comment>Body for the dialog show when the user clicks on ShellView_Menu_Syncthing_KillAll</comment>
</data>
<data name="Dialog_ConfirmKillAllProcesses_Title" xml:space="preserve">
Expand Down Expand Up @@ -606,10 +606,6 @@ SyncTrayzor se va a cerrar. Lo sentimos.</value>
<value>Salida: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Iniciando...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>Hace {0:p:1 día|{} días}</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor doit se fermer. Veuillez nous excuser.</value>
<value>Sortie : {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Démarrage...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>il y a {0:p:1 jour|{} jours}</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.hu-HU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ A SyncTrayzor ki fog lépni. Bocsánat</value>
<value>Ki: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Indulás...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:1{} napja}</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.it-IT.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor dovrà essere terminato. Ci scusiamo.</value>
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>In Avvio...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 giorno|{} giorni} fa</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor terá de fechar. Sinto muito</value>
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Starting...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 day|{} days} ago</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor is going to have to close. Sorry about that</value>
<value>Out: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Starting...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 day|{} days} ago</value>
</data>
Expand Down
4 changes: 0 additions & 4 deletions src/SyncTrayzor/Properties/Strings/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@ SyncTrayzor закрывается. Извините.</value>
<value>Исх: {0}/сек</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>Запускаю...</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 день|{} дней} назад</value>
</data>
Expand Down
6 changes: 1 addition & 5 deletions src/SyncTrayzor/Properties/Strings/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ The menu option "Syncthing -&gt;Kill all Syncthing processes" corresponds to She
<comment>'Yes' button shown on various dialogs</comment>
</data>
<data name="TranslatorAttributation" xml:space="preserve">
<value>简体中文 翻译由 Honpan Lung 制作</value>
<value>简体中文翻译由 Honpan Lung 制作</value>
<comment>Shown on the 'about' page, this is space for you to attribute yourself. E.g. your local language equivalent of "Kingon translation by My Name". Add yourself to this field if you contribute to the translation for this language.</comment>
</data>
<data name="SettingsView_Section_TrayIcon" xml:space="preserve">
Expand Down Expand Up @@ -606,10 +606,6 @@ The menu option "Syncthing -&gt;Kill all Syncthing processes" corresponds to She
<value>出: {0}/s</value>
<comment>{0}: a value such as '1.2kb'</comment>
</data>
<data name="FileTransfersTrayView_Starting" xml:space="preserve">
<value>启动中…</value>
<comment>Displayed when an item is downloading, but we don't yet any any progress information for it</comment>
</data>
<data name="TimeAgo_Days" xml:space="preserve">
<value>{0:p:1 天|{} 天}前</value>
</data>
Expand Down
17 changes: 13 additions & 4 deletions src/SyncTrayzor/SyncThing/ApiClient/SyncThingApiClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,27 @@ public async Task<ISyncThingApiClient> CreateCorrectApiClientAsync(Uri baseAddre
ISyncThingApiClient client = new SyncThingApiClientV0p11(baseAddress, apiKey);

// We abort because of the CancellationToken or because we take too long, or succeed
var connectionAttemptsStarted = DateTime.UtcNow;
for (int retryCount = 0; true; retryCount++)
// We used to measure absolute time here. However, we can be put to sleep halfway through this operation,
// and so fail the timeout condition without actually trying for the appropriate amount of time.
// Therefore, do it for a num iterations...
var numAttempts = timeout.TotalSeconds; // Delay for 1 second per iteration
bool success = false;
Exception lastException = null;
for (int retryCount = 0; retryCount < numAttempts; retryCount++)
{
try
{
logger.Debug("Attempting to request API using version 0.11.x API client");
await client.FetchVersionAsync();
success = true;
logger.Debug("Success!");
break;
}
catch (HttpRequestException e)
{
logger.Debug("Failed to connect on attempt {0}", retryCount);
// Expected when Syncthing's still starting
if (DateTime.UtcNow - connectionAttemptsStarted > timeout)
throw new SyncThingDidNotStartCorrectlyException(String.Format("Syncthing didn't connect after {0}", timeout), e);
lastException = e;
}
catch (ApiException e)
{
Expand All @@ -51,13 +56,17 @@ public async Task<ISyncThingApiClient> CreateCorrectApiClientAsync(Uri baseAddre
// If we got a 404, then it's definitely communicating
logger.Debug("404 with 0.11.x API client - defaulting to 0.10.x");
client = new SyncThingApiClientV0p10(baseAddress, apiKey);
success = true;
break;
}

await Task.Delay(1000, cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
}

if (!success)
throw new SyncThingDidNotStartCorrectlyException(String.Format("Syncthing didn't connect after {0}", timeout), lastException);

return client;
}
}
Expand Down
14 changes: 8 additions & 6 deletions src/SyncTrayzor/SyncThing/SyncThingFolderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ private async Task<Ignores> FetchFolderIgnoresAsync(string folderId, Cancellatio
throw new InvalidOperationException("ApiClient must not be null");
}

Ignores ignores;
var startedTime = DateTime.UtcNow;
while (true)
Ignores ignores = null;
// We used to time out after an absolute time here. However, there's the possiblity of going to sleep
// halfway through polling, which throws things off. Therefore use a number of iterations
var numRetries = this.ignoresFetchTimeout.TotalSeconds; // Each iteration is a second
for (var retriesCount = 0; retriesCount < numRetries; retriesCount++)
{
try
{
Expand All @@ -145,13 +147,13 @@ private async Task<Ignores> FetchFolderIgnoresAsync(string folderId, Cancellatio
throw;
}

if (DateTime.UtcNow - startedTime > this.ignoresFetchTimeout)
throw new SyncThingDidNotStartCorrectlyException(String.Format("Unable to fetch ignores for folder {0}. Syncthing returned 500 after {1}", folderId, DateTime.UtcNow - startedTime));

await Task.Delay(1000, cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
}

if (ignores == null)
throw new SyncThingDidNotStartCorrectlyException(String.Format("Unable to fetch ignores for folder {0}. Syncthing returned 500 after {1}", folderId, this.ignoresFetchTimeout));

return ignores;
}

Expand Down
2 changes: 1 addition & 1 deletion src/SyncTrayzor/SyncThing/SyncThingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public async Task StopAsync()
public async Task StopAndWaitAsync()
{
var apiClient = this.apiClient.Value;
if (apiClient != null)
if (apiClient == null)
return;

var tcs = new TaskCompletionSource<object>();
Expand Down

0 comments on commit abc881e

Please sign in to comment.