Skip to content

Commit

Permalink
hotfix: mqtt webrtc - wrong session key
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Oct 24, 2023
1 parent 6a44498 commit c4b9610
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion machinery/src/routers/mqtt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ func HandleReceiveHDCandidates(mqttClient mqtt.Client, hubKey string, payload mo

if receiveHDCandidatesPayload.Timestamp != 0 {
if communication.CameraConnected {
channel := webrtc.CandidateArrays[receiveHDCandidatesPayload.SessionID]
key := configuration.Config.Key + "/" + receiveHDCandidatesPayload.SessionID
channel := webrtc.CandidateArrays[key]
if channel == nil {
channel = make(chan string)
webrtc.CandidateArrays[key] = channel
}
log.Log.Info("HandleReceiveHDCandidates: " + receiveHDCandidatesPayload.Candidate)
channel <- receiveHDCandidatesPayload.Candidate
} else {
Expand Down
5 changes: 3 additions & 2 deletions machinery/src/webrtc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati
Credential: w.TurnServersCredential,
},
},
ICETransportPolicy: pionWebRTC.ICETransportPolicyRelay,
},
)

Expand Down Expand Up @@ -215,7 +216,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati
payload, err := models.PackageMQTTMessage(configuration, message)
if err == nil {
log.Log.Info("InitializeWebRTCConnection:" + string(candateBinary))
token := mqttClient.Publish("kerberos/hub/"+hubKey, 0, false, payload)
token := mqttClient.Publish("kerberos/hub/"+hubKey, 2, false, payload)
token.Wait()
} else {
log.Log.Info("HandleRequestConfig: something went wrong while sending acknowledge config to hub: " + string(payload))
Expand All @@ -241,7 +242,7 @@ func InitializeWebRTCConnection(configuration *models.Configuration, communicati
}
payload, err := models.PackageMQTTMessage(configuration, message)
if err == nil {
token := mqttClient.Publish("kerberos/hub/"+hubKey, 0, false, payload)
token := mqttClient.Publish("kerberos/hub/"+hubKey, 2, false, payload)
token.Wait()
} else {
log.Log.Info("HandleRequestConfig: something went wrong while sending acknowledge config to hub: " + string(payload))
Expand Down

0 comments on commit c4b9610

Please sign in to comment.