/* Compute the lease. If the server grants a permanent lease, just process it as a normal timeout value since the lease will last more than 100 years. */
VOID DhcpComputeLease(IN OUT DHCP_SERVICE *DhcpSb, IN DHCP_PARAMETER *Para)
/* Compute the lease. If the server grants a permanent lease, just process it as a normal timeout value since the lease will last more than 100 years. */
VOID DhcpComputeLease(IN OUT DHCP_SERVICE *DhcpSb, IN DHCP_PARAMETER *Para)
{
  ASSERT (Para != NULL);
  DhcpSb->Lease = Para->Lease;
  DhcpSb->T2    = Para->T2;
  DhcpSb->T1    = Para->T1;
  if (DhcpSb->Lease == 0) {
    DhcpSb->Lease = DHCP_DEFAULT_LEASE;
  }
  if ((DhcpSb->T2 == 0) || (DhcpSb->T2 >= Para->Lease)) {
    DhcpSb->T2 = Para->Lease - (Para->Lease >> 3);
  }
  if ((DhcpSb->T1 == 0) || (DhcpSb->T1 >= Para->T2)) {
    DhcpSb->T1 = DhcpSb->Lease >> 1;
  }
}