mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-04 19:56:49 +02:00
Fix race condition - if the device manager is not ready when a packet arrives, drop it rather than NPE
Change-Id: I601b4ce1d449b169059a3390441dcfa58b800db3
This commit is contained in:
parent
0b80972fa9
commit
2c142c5248
@ -61,6 +61,10 @@ public class PacketDriverProvider extends AbstractProvider implements PacketProv
|
||||
}
|
||||
|
||||
private PacketProgrammable getPacketProgrammable(DeviceId deviceId) {
|
||||
if (deviceService == null) {
|
||||
log.debug("Packet encountered but device service is not ready, dropping");
|
||||
return null;
|
||||
}
|
||||
Device device = deviceService.getDevice(deviceId);
|
||||
if (device.is(PacketProgrammable.class)) {
|
||||
return device.as(PacketProgrammable.class);
|
||||
|
||||
@ -130,8 +130,8 @@ public class PacketManager
|
||||
appId = coreService.getAppId(CoreService.CORE_APP_NAME);
|
||||
store.setDelegate(delegate);
|
||||
deviceService.addListener(deviceListener);
|
||||
store.existingRequests().forEach(this::pushToAllDevices);
|
||||
defaultProvider.init(deviceService);
|
||||
store.existingRequests().forEach(this::pushToAllDevices);
|
||||
log.info("Started");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user