Skip to content

Commit

Permalink
fixed #8 多服务器模式下,服务器地址无法连接时,无法继续切换服务器
Browse files Browse the repository at this point in the history
  • Loading branch information
iccfish committed Mar 1, 2016
1 parent 5bd6d6c commit 06dd1db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
16 changes: 4 additions & 12 deletions SimpleUpdater/FSLib.App.SimpleUpdater/MultiServerUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,14 @@ bool PeekNextServer()
/// </summary>
protected override void OnError()
{
var ex = Context.Exception;

if (ex is WebException)
if (PeekNextServer())
{
if (PeekNextServer())
{
Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。");
}
else
{
Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl);
base.BeginCheckUpdateInProcess();
}
Trace.TraceWarning("尝试更新时出现服务器错误。正尝试自动切换至其它的服务器节点。已切换至 " + Context.UpdateDownloadUrl);
base.BeginCheckUpdateInProcess();
}
else
{
Trace.TraceWarning("尝试更新时出现服务器错误,且服务器已遍历完成。");
base.OnError();
}
}
Expand Down
4 changes: 2 additions & 2 deletions SimpleUpdater/FSLib.App.SimpleUpdater/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e)
//等待下载完成
wHandler.WaitOne();
}
if (ex != null) throw ex;

Trace.TraceInformation("服务器返回数据----->" + (data == null ? "<null>" : data.Length.ToString() + "字节"));
if (data != null && data.Length > 0x10)
{
Expand All @@ -267,8 +269,6 @@ void DownloadUpdateInfoInternal(object sender, RunworkEventArgs e)
throw new ApplicationException("服务器返回了不正确的更新结果");
}


if (ex != null) throw ex;
}
e.PostEvent(OnDownloadUpdateInfoFinished);
if ((Context.UpdateInfo = XMLSerializeHelper.XmlDeserializeFromString<UpdateInfo>(Context.UpdateInfoTextContent)) == null)
Expand Down

0 comments on commit 06dd1db

Please sign in to comment.