Skip to content

Commit

Permalink
server: hbrp: remove double-check for existence
Browse files Browse the repository at this point in the history
  • Loading branch information
USA-RedDragon authored Oct 11, 2023
1 parent 17a7e54 commit 3043850
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions internal/dmr/servers/hbrp/packet_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,17 +326,6 @@ func (s *Server) handleDMRDPacket(ctx context.Context, remoteAddr net.UDPAddr, d
if s.validRepeater(ctx, repeaterID, "YES", remoteAddr) {
s.Redis.UpdateRepeaterPing(ctx, repeaterID)

exists, err := models.RepeaterIDExists(s.DB, repeaterID)
if err != nil {
klog.Errorf("Error checking if repeater exists: %s", err)
return
}

if !exists {
klog.Warningf("Repeater %d does not exist", repeaterID)
return
}

dbRepeater, err := models.FindRepeaterByID(s.DB, repeaterID)
if err != nil {
klog.Errorf("Error finding repeater: %s", err)
Expand All @@ -355,16 +344,16 @@ func (s *Server) handleDMRDPacket(ctx context.Context, remoteAddr net.UDPAddr, d
return
}

if packet.Dst == 0 {
return
}

if config.GetConfig().Debug {
logging.GetLogger(logging.Access).Logf(s.handleDMRDPacket, "DMRD packet: %s", packet.String())
}

isVoice, isData := utils.CheckPacketType(packet)

if packet.Dst == 0 {
return
}

s.TrackCall(ctx, packet, isVoice)

if packet.Dst == dmrconst.ParrotUser && isVoice {
Expand Down

0 comments on commit 3043850

Please sign in to comment.