[CA-214653] Code clean-up following code review

Signed-off-by: Frezzle <frederico.mazzone@citrix.com>
This commit is contained in:
Frezzle 2016-10-12 19:25:38 +01:00
parent ec62027342
commit 2f7a938643

View File

@ -131,7 +131,7 @@ namespace XenAdmin.Network
// Now that we've successfully received a heartbeat, reset our 'second chance' for the server to timeout
if (retrying)
log.DebugFormat("Heartbeat for {0} has come back", session == null ? "null" : session.Url);
log.DebugFormat("Heartbeat for {0} has come back", session.Url);
retrying = false;
}
catch (TargetInvocationException exn)
@ -146,16 +146,19 @@ namespace XenAdmin.Network
log.Error(exn);
}
HandleConnectionLoss();
return;
}
catch (WebException exn)
{
log.Error(exn);
if (((HttpWebResponse)exn.Response).StatusCode == HttpStatusCode.ProxyAuthenticationRequired) // work-around for CA-214653
{
log.DebugFormat("Heartbeat for {0} has failed due to {1} credentials; closing the main connection",
session == null ? "null" : session.Url,
session.proxy.Proxy.Credentials == null ? "missing" : "incorrect");
if (session == null)
log.Debug("Heartbeat has failed due to null session; closing the main connection");
else if (session.proxy.Proxy.Credentials == null)
log.DebugFormat("Heartbeat for {0} has failed due to missing credentials; closing the main connection", session.Url);
else
log.DebugFormat("Heartbeat for {0} has failed due to incorrect credentials; closing the main connection", session.Url);
connection.Interrupt();
DropSession();
}
@ -163,13 +166,11 @@ namespace XenAdmin.Network
{
HandleConnectionLoss();
}
return;
}
catch (Exception exn)
{
log.Error(exn);
HandleConnectionLoss();
return;
}
}