Skip to content

Commit

Permalink
correctly set CBS parameters on talker, not listener port
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Dec 19, 2024
1 parent ad9fa0e commit cbc81a3
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Sources/MRP/Applications/MSRP/MSRPApplication.swift
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ extension MSRPApplication {
}

private func _updateDynamicReservationEntries(
participant: Participant<MSRPApplication>,
port: P,
portState: MSRPPortState<P>,
streamID: MSRPStreamID,
declarationType: MSRPDeclarationType?,
Expand All @@ -962,20 +962,20 @@ extension MSRPApplication {
try await bridge.register(
macAddress: talkerRegistration.dataFrameParameters.destinationAddress,
vlan: talkerRegistration.dataFrameParameters.vlanIdentifier,
on: [participant.port]
on: [port]
)
} else {
_logger.debug("MSRP: deregistering FDB entries for \(talkerRegistration.dataFrameParameters)")
try? await bridge.deregister(
macAddress: talkerRegistration.dataFrameParameters.destinationAddress,
vlan: talkerRegistration.dataFrameParameters.vlanIdentifier,
from: [participant.port]
from: [port]
)
}
}

private func _updateOperIdleSlope(
participant: Participant<MSRPApplication>,
port: P,
portState: MSRPPortState<P>,
streamID: MSRPStreamID,
talkerRegistration: any MSRPTalkerValue
Expand All @@ -984,6 +984,11 @@ extension MSRPApplication {
return
}

guard let participant = try? findParticipant(port: port) else {
_logger.info("MSRP: failed to find participant for port \(port)")
return
}

let talkers = await participant.findAttributes(
attributeType: MSRPAttributeType.talkerAdvertise.rawValue,
matching: .matchAny
Expand All @@ -1002,11 +1007,11 @@ extension MSRPApplication {
}
}

_logger.debug("MSRP: adjusting idle slope, port \(participant.port), streams \(streams)")
_logger.debug("MSRP: adjusting idle slope, port \(port), streams \(streams)")

try await bridge.adjustCreditBasedShaper(
application: self,
port: participant.port,
port: port,
portState: portState,
streams: streams
)
Expand Down Expand Up @@ -1038,22 +1043,22 @@ extension MSRPApplication {
if mergedDeclarationType == .listenerReady || mergedDeclarationType == .listenerReadyFailed {
// increase (if necessary) bandwidth first before updating dynamic reservation entries
try await _updateOperIdleSlope(
participant: talkerRegistration.0,
port: port,
portState: portState,
streamID: streamID,
talkerRegistration: talkerRegistration.1
)
}
try await _updateDynamicReservationEntries(
participant: talkerRegistration.0,
port: port,
portState: portState,
streamID: streamID,
declarationType: mergedDeclarationType,
talkerRegistration: talkerRegistration.1
)
if mergedDeclarationType == nil || mergedDeclarationType == .listenerAskingFailed {
try await _updateOperIdleSlope(
participant: talkerRegistration.0,
port: port,
portState: portState,
streamID: streamID,
talkerRegistration: talkerRegistration.1
Expand Down

0 comments on commit cbc81a3

Please sign in to comment.