Lei Xu
Committed by Gerrit Code Review

[ONOS-3159] fix a concurrency issue in DHCPRelay.java

Change-Id: Ib9bc5d0f0e788ceabc5272a05ac52a6753a3a229
...@@ -384,6 +384,10 @@ public class DhcpRelay { ...@@ -384,6 +384,10 @@ public class DhcpRelay {
384 MacAddress descMac = new MacAddress(dhcpPayload.getClientHardwareAddress()); 384 MacAddress descMac = new MacAddress(dhcpPayload.getClientHardwareAddress());
385 Host host = hostService.getHost(HostId.hostId(descMac, 385 Host host = hostService.getHost(HostId.hostId(descMac,
386 VlanId.vlanId(ethPacket.getVlanID()))); 386 VlanId.vlanId(ethPacket.getVlanID())));
387 + //handle the concurrent host offline scenario
388 + if (host == null) {
389 + return;
390 + }
387 ConnectPoint dhcpRequestor = new ConnectPoint(host.location().elementId(), 391 ConnectPoint dhcpRequestor = new ConnectPoint(host.location().elementId(),
388 host.location().port()); 392 host.location().port());
389 393
...@@ -414,4 +418,4 @@ public class DhcpRelay { ...@@ -414,4 +418,4 @@ public class DhcpRelay {
414 } 418 }
415 } 419 }
416 } 420 }
417 -}
...\ No newline at end of file ...\ No newline at end of file
421 +}
......