diff options
author | Anton Tananaev <anton@traccar.org> | 2024-02-08 17:49:28 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-02-08 17:49:28 -0800 |
commit | 0c8b5c1ab1f83cc0fc6d2f17cdf808388b383e14 (patch) | |
tree | 86d2b534a6e642cc461dad64685f35203b1c5850 /src/main/java/org/traccar | |
parent | fe771851995da97ffa2fb50e21bd437bca208eac (diff) | |
download | trackermap-server-0c8b5c1ab1f83cc0fc6d2f17cdf808388b383e14.tar.gz trackermap-server-0c8b5c1ab1f83cc0fc6d2f17cdf808388b383e14.tar.bz2 trackermap-server-0c8b5c1ab1f83cc0fc6d2f17cdf808388b383e14.zip |
Handle no remote address
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/session/ConnectionManager.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/session/ConnectionManager.java b/src/main/java/org/traccar/session/ConnectionManager.java index 1461c66ea..121b876c5 100644 --- a/src/main/java/org/traccar/session/ConnectionManager.java +++ b/src/main/java/org/traccar/session/ConnectionManager.java @@ -188,17 +188,19 @@ public class ConnectionManager implements BroadcastInterface { public void deviceDisconnected(Channel channel, boolean supportsOffline) { SocketAddress remoteAddress = channel.remoteAddress(); - Map<String, DeviceSession> endpointSessions = sessionsByEndpoint.remove(remoteAddress); - if (endpointSessions != null) { - for (DeviceSession deviceSession : endpointSessions.values()) { - if (supportsOffline) { - updateDevice(deviceSession.getDeviceId(), Device.STATUS_OFFLINE, null); + if (remoteAddress != null) { + Map<String, DeviceSession> endpointSessions = sessionsByEndpoint.remove(remoteAddress); + if (endpointSessions != null) { + for (DeviceSession deviceSession : endpointSessions.values()) { + if (supportsOffline) { + updateDevice(deviceSession.getDeviceId(), Device.STATUS_OFFLINE, null); + } + sessionsByDeviceId.remove(deviceSession.getDeviceId()); + cacheManager.removeDevice(deviceSession.getDeviceId()); } - sessionsByDeviceId.remove(deviceSession.getDeviceId()); - cacheManager.removeDevice(deviceSession.getDeviceId()); } + unknownByEndpoint.remove(remoteAddress); } - unknownByEndpoint.remove(remoteAddress); } public void deviceUnknown(long deviceId) { |