CA-227631: License Manager doesn't respond immediately to disconnected host

Fixed the bug that caused a disconnected host to appear as if it was still connected in the License Manager. After this commit, if a host get disconnected in the background its row will be disabled and will be unselectable.

(Note that when the connection resumes, the user will still have to click on a different row to have the disabled state (and the buttons) fixed, but that is a Won't fix bug (CA-115261) that I couldn't fix right now.)

Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
Gabor Apati-Nagy 2017-02-10 15:55:09 +00:00
parent ce48a73e6d
commit b8b8e846f5

View File

@ -97,14 +97,30 @@ namespace XenAdmin.Dialogs
SetDefaultOptions();
XenObject = xo;
if (xo is Host)
LicencedHost = xo as Host;
if (xo is Pool)
if (XenObject is Host)
LicencedHost = XenObject as Host;
if (XenObject is Pool)
{
Pool pool = xo as Pool;
Pool pool = XenObject as Pool;
SetMinimumLicenseValueHost(pool);
}
serverTime.ServerTimeObtained -= ServerTimeUpdatedEventHandler;
serverTime.ServerTimeObtained += ServerTimeUpdatedEventHandler;
if (XenObject != null)
{
XenObject.Connection.ConnectionStateChanged -= Connection_ConnectionStateChanged;
XenObject.Connection.ConnectionStateChanged += Connection_ConnectionStateChanged;
}
}
void Connection_ConnectionStateChanged(object sender, EventArgs e)
{
if (LicencedHost != null)
{
TriggerStatusUpdatedEvent();
}
}
private void SetMinimumLicenseValueHost(Pool pool)
@ -397,6 +413,12 @@ namespace XenAdmin.Dialogs
{
if(disposing)
{
if (serverTime != null)
serverTime.ServerTimeObtained -= ServerTimeUpdatedEventHandler;
if (XenObject != null && XenObject.Connection != null)
XenObject.Connection.ConnectionStateChanged -= Connection_ConnectionStateChanged;
Events.Dispose();
}
disposed = true;