/* Destroy the DHCP service. The Dhcp4 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as so in case the destroy failed and being called again later. */
EFI_STATUS Dhcp4CloseService(IN DHCP_SERVICE *DhcpSb)
/* Destroy the DHCP service. The Dhcp4 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as so in case the destroy failed and being called again later. */
EFI_STATUS Dhcp4CloseService(IN DHCP_SERVICE *DhcpSb)
{
  DhcpCleanLease (DhcpSb);
  if (DhcpSb->UdpIo != NULL) {
    UdpIoFreeIo (DhcpSb->UdpIo);
    DhcpSb->UdpIo = NULL;
  }
  if (DhcpSb->Timer != NULL) {
    gBS->SetTimer (DhcpSb->Timer, TimerCancel, 0);
    gBS->CloseEvent (DhcpSb->Timer);
    DhcpSb->Timer = NULL;
  }
  return EFI_SUCCESS;
}