From 161595e7c83d4fe66f43e5daf1d351caa6256a25 Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Tue, 1 Oct 2024 04:03:25 -0400 Subject: [PATCH] #1996 P25P1 traffic channel monitor now clears allocated traffic channels each time the control frequency changes, which should be after a lose-sync event. This ensures that none of the traffic channel frequencies get blocked when the monitor thinks that a channel is already allocated. (#1997) Co-authored-by: Dennis Sheirer --- .../decode/p25/P25TrafficChannelManager.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java b/src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java index 8b319643..3406e71e 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/P25TrafficChannelManager.java @@ -70,6 +70,7 @@ import java.util.Queue; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.locks.ReentrantLock; +import java.util.function.BiConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -169,12 +170,22 @@ public class P25TrafficChannelManager extends TrafficChannelManager implements I try { - Channel channel = mAllocatedTrafficChannelMap.get(current); - - if(!parentChannel.equals(channel)) + //Shutdown all existing traffic channels and clear the maps. + mAllocatedTrafficChannelMap.forEach(new BiConsumer() { - broadcast(new ChannelEvent(mAllocatedTrafficChannelMap.get(current), Event.REQUEST_DISABLE)); - } + @Override + public void accept(Long aLong, Channel channel) + { + if(!parentChannel.equals(channel)) + { + broadcast(new ChannelEvent(channel, Event.REQUEST_DISABLE)); + } + } + }); + + mAllocatedTrafficChannelMap.clear(); + mTS1ChannelGrantEventMap.clear(); + mTS2ChannelGrantEventMap.clear(); //Store the control channel in the allocated channel map so that we don't allocate a traffic channel against it mAllocatedTrafficChannelMap.put(current, parentChannel);