mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
microslop made async await deadlocks; try make list sessions work; update libomv
This commit is contained in:
@@ -89,7 +89,7 @@ namespace osWebRtcVoice
|
||||
JanusRoom ret = null;
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeCreateRoomReq(pRoomId, pSpatial, pRoomDesc));
|
||||
JanusMessageResp resp = await SendPluginMsg(new AudioBridgeCreateRoomReq(pRoomId, pSpatial, pRoomDesc)).ConfigureAwait(false);
|
||||
AudioBridgeResp abResp = new(resp);
|
||||
|
||||
m_log.Debug($"{LogHeader} CreateRoom. ReturnCode: '{abResp.AudioBridgeReturnCode}'");
|
||||
@@ -202,7 +202,7 @@ namespace osWebRtcVoice
|
||||
|
||||
// The room doesn't exist. Create it.
|
||||
string roomDesc = pRegionId + "/" + pChannelType + "/" + pParcelLocalID + "/" + pChannelID;
|
||||
JanusRoom ret = await CreateRoom(roomNumber, pSpatial, roomDesc);
|
||||
JanusRoom ret = await CreateRoom(roomNumber, pSpatial, roomDesc).ConfigureAwait(false);
|
||||
|
||||
JanusRoom existingRoom = null;
|
||||
if (ret is not null)
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace osWebRtcVoice
|
||||
public AudioBridgeAgentJoinRoomReq(int pRoomId, UUID Agent) : base(new OSDMap() {
|
||||
{ "request", "join" },
|
||||
{ "room", pRoomId },
|
||||
{ "id", new OSDNLong(Math.Abs((long)(Agent.ulonga ^ Agent.ulongb)))},
|
||||
{ "id", new OSDLong(Math.Abs((long)(Agent.ulonga ^ Agent.ulongb)))},
|
||||
{ "display", Agent.ToString() }
|
||||
})
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace osWebRtcVoice
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await _JanusSession.SendToSession(new AttachPluginReq(PluginName));
|
||||
JanusMessageResp resp = await _JanusSession.SendToSession(new AttachPluginReq(PluginName)).ConfigureAwait(false);
|
||||
if (resp is not null && resp.isSuccess)
|
||||
{
|
||||
AttachPluginResp handleResp = new(resp);
|
||||
@@ -126,7 +126,7 @@ namespace osWebRtcVoice
|
||||
_JanusSession.OnEvent -= Handle_Event;
|
||||
_JanusSession.OnMessage -= Handle_Message;
|
||||
// We send the 'detach' message to the plugin URI
|
||||
JanusMessageResp resp = await _JanusSession.SendToJanus(new DetachPluginReq(), PluginUri);
|
||||
JanusMessageResp resp = await _JanusSession.SendToJanus(new DetachPluginReq(), PluginUri).ConfigureAwait(false);
|
||||
if (resp is not null && resp.isSuccess)
|
||||
{
|
||||
m_log.DebugFormat("{0} Detach. Detached", LogHeader);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace osWebRtcVoice
|
||||
// joinReq.SetJsep("offer", cleanSdp);
|
||||
joinReq.SetJsep("offer", pVSession.Offer);
|
||||
|
||||
JanusMessageResp resp = await _AudioBridge.SendPluginMsg(joinReq);
|
||||
JanusMessageResp resp = await _AudioBridge.SendPluginMsg(joinReq).ConfigureAwait(false);
|
||||
AudioBridgeJoinRoomResp joinResp = new(resp);
|
||||
|
||||
if (joinResp is not null && joinResp.AudioBridgeReturnCode == "joined" && joinResp.ParticipantId > 0)
|
||||
@@ -86,12 +86,12 @@ namespace osWebRtcVoice
|
||||
{
|
||||
m_log.Warn($"{LogHeader} JoinRoom. Already in a room for agent {pVSession.AgentId}. Attempting recovery.");
|
||||
|
||||
bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString());
|
||||
bool recovered = await RecoverAlreadyInRoomAndLeave(pVSession.AgentId.ToString()).ConfigureAwait(false);
|
||||
if (recovered)
|
||||
{
|
||||
AudioBridgeAgentJoinRoomReq retryJoinReq = new(RoomId, pVSession.AgentId);
|
||||
retryJoinReq.SetJsep("offer", pVSession.Offer);
|
||||
JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq);
|
||||
JanusMessageResp retryResp = await _AudioBridge.SendPluginMsg(retryJoinReq).ConfigureAwait(false);
|
||||
AudioBridgeJoinRoomResp retryJoinResp = new(retryResp);
|
||||
|
||||
if (retryJoinResp is not null && retryJoinResp.AudioBridgeReturnCode == "joined" && retryJoinResp.ParticipantId > 0)
|
||||
@@ -138,7 +138,7 @@ namespace osWebRtcVoice
|
||||
{
|
||||
try
|
||||
{
|
||||
JanusMessageResp listRoomsRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeListRoomsReq());
|
||||
JanusMessageResp listRoomsRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeListRoomsReq()).ConfigureAwait(false);
|
||||
AudioBridgeResp listRoomsResp = new AudioBridgeResp(listRoomsRespRaw);
|
||||
if (listRoomsResp?.PluginRespData is null ||
|
||||
!listRoomsResp.PluginRespData.TryGetValue("list", out OSD roomListNode) ||
|
||||
@@ -157,7 +157,7 @@ namespace osWebRtcVoice
|
||||
// if (roomId <= 0)
|
||||
// continue;
|
||||
|
||||
JanusMessageResp listParticipantsRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeListParticipantsReq(roomId));
|
||||
JanusMessageResp listParticipantsRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeListParticipantsReq(roomId)).ConfigureAwait(false);
|
||||
AudioBridgeResp listParticipantsResp = new AudioBridgeResp(listParticipantsRespRaw);
|
||||
if (listParticipantsResp?.PluginRespData is null ||
|
||||
!listParticipantsResp.PluginRespData.TryGetValue("participants", out OSD participantsNode) ||
|
||||
@@ -177,7 +177,7 @@ namespace osWebRtcVoice
|
||||
if (participantId <= 0)
|
||||
continue;
|
||||
|
||||
JanusMessageResp leaveRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeLeaveRoomReq(roomId, participantId));
|
||||
JanusMessageResp leaveRespRaw = await _AudioBridge.SendPluginMsg(new AudioBridgeLeaveRoomReq(roomId, participantId)).ConfigureAwait(false);
|
||||
AudioBridgeResp leaveResp = new(leaveRespRaw);
|
||||
|
||||
if (leaveResp is not null)
|
||||
@@ -226,7 +226,7 @@ namespace osWebRtcVoice
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await _AudioBridge.SendPluginMsg(
|
||||
new AudioBridgeLeaveRoomReq(RoomId, pAttendeeSession.ParticipantId));
|
||||
new AudioBridgeLeaveRoomReq(RoomId, pAttendeeSession.ParticipantId)).ConfigureAwait(false);
|
||||
|
||||
if (resp is null)
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace osWebRtcVoice
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await SendToJanus(new CreateSessionReq());
|
||||
JanusMessageResp resp = await SendToJanus(new CreateSessionReq()).ConfigureAwait(false);
|
||||
if (resp is not null && resp.isSuccess)
|
||||
{
|
||||
CreateSessionResp sessionResp = new(resp);
|
||||
@@ -132,7 +132,7 @@ namespace osWebRtcVoice
|
||||
bool ret = false;
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await SendToSession(new DestroySessionReq());
|
||||
JanusMessageResp resp = await SendToSession(new DestroySessionReq()).ConfigureAwait(false);
|
||||
if (resp is not null && resp.isSuccess)
|
||||
{
|
||||
// Note that setting IsConnected to false will cause the long poll to exit
|
||||
@@ -185,11 +185,11 @@ namespace osWebRtcVoice
|
||||
// if the audiobridge is active, the trickle message is sent to it
|
||||
if (pVSession.AudioBridge is null)
|
||||
{
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession, pCandidates));
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession, pCandidates)).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession, pCandidates), pVSession.AudioBridge.PluginUri);
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession, pCandidates), pVSession.AudioBridge.PluginUri).ConfigureAwait(false);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -200,11 +200,11 @@ namespace osWebRtcVoice
|
||||
// if the audiobridge is active, the trickle message is sent to it
|
||||
if (pVSession.AudioBridge is null)
|
||||
{
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession));
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession)).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession), pVSession.AudioBridge.PluginUri);
|
||||
ret = await SendToJanusNoWait(new TrickleReq(pVSession), pVSession.AudioBridge.PluginUri).ConfigureAwait(false);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -286,11 +286,11 @@ namespace osWebRtcVoice
|
||||
reqMsg.Content = new StringContent(reqStr, System.Text.Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
reqMsg.Headers.TryAddWithoutValidation("Accept", "application/json");
|
||||
// HttpResponseMessage response = await httpClient.SendAsync(reqMsg, _CancelTokenSource.Token);
|
||||
HttpResponseMessage response = await httpClient.SendAsync(reqMsg);
|
||||
HttpResponseMessage response = await httpClient.SendAsync(reqMsg).ConfigureAwait(false);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string respStr = await response.Content.ReadAsStringAsync();
|
||||
string respStr = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
ret = JanusMessageResp.FromJson(respStr);
|
||||
if (ret.CheckReturnCode("ack"))
|
||||
{
|
||||
@@ -356,8 +356,8 @@ namespace osWebRtcVoice
|
||||
string reqStr = pReq.ToJson();
|
||||
reqMsg.Content = new StringContent(reqStr, System.Text.Encoding.UTF8, MediaTypeNames.Application.Json);
|
||||
reqMsg.Headers.TryAddWithoutValidation("Accept", "application/json");
|
||||
HttpResponseMessage response = await httpClient.SendAsync(reqMsg);
|
||||
string respStr = await response.Content.ReadAsStringAsync();
|
||||
HttpResponseMessage response = await httpClient.SendAsync(reqMsg).ConfigureAwait(false);
|
||||
string respStr = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
ret = JanusMessageResp.FromJson(respStr);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -399,12 +399,12 @@ namespace osWebRtcVoice
|
||||
// The following two are required for the WebSocket interface. They are optional for the
|
||||
// HTTP interface since the session and plugin handle are in the URL.
|
||||
// SessionId is added to the message if not already there
|
||||
if (!pReq.hasSessionId && !string.IsNullOrEmpty(SessionId))
|
||||
if (!admin && !pReq.hasSessionId && !string.IsNullOrEmpty(SessionId))
|
||||
{
|
||||
pReq.AddSessionId(SessionId);
|
||||
}
|
||||
// HandleId connects to the plugin
|
||||
if (!pReq.hasHandleId && !string.IsNullOrEmpty(PluginId))
|
||||
if (!admin && !pReq.hasHandleId && !string.IsNullOrEmpty(PluginId))
|
||||
{
|
||||
pReq.AddHandleId(PluginId);
|
||||
}
|
||||
@@ -564,7 +564,7 @@ namespace osWebRtcVoice
|
||||
{
|
||||
try
|
||||
{
|
||||
JanusMessageResp resp = await GetFromJanus(SessionUri, 60000);
|
||||
JanusMessageResp resp = await GetFromJanus(SessionUri, 60000).ConfigureAwait(false);
|
||||
if (resp is not null)
|
||||
{
|
||||
//_ = Task.Run(() =>
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace osWebRtcVoice
|
||||
{ "sdpMLineIndex", candidate.ContainsKey("sdpMLineIndex") ? candidate["sdpMLineIndex"].AsLong() : 0 }
|
||||
}
|
||||
];
|
||||
resp = await viewerSession.Session.TrickleCandidates(viewerSession, candidatesArray);
|
||||
resp = await viewerSession.Session.TrickleCandidates(viewerSession, candidatesArray).ConfigureAwait(false);
|
||||
_log.Debug($"{LogHeader} VoiceSignalingRequest: single candidate");
|
||||
}
|
||||
}
|
||||
@@ -752,7 +752,7 @@ namespace osWebRtcVoice
|
||||
if (_ViewerSession is null || _ViewerSession.Session is null)
|
||||
return;
|
||||
|
||||
JanusMessageResp resp = await _ViewerSession.Session.SendToJanusAdmin(new JanusMessageReq("list_sessions"));
|
||||
JanusMessageResp resp = await _ViewerSession.Session.SendToJanusAdmin(new JanusMessageReq("list_sessions")).ConfigureAwait(false);
|
||||
if (resp is null)
|
||||
{
|
||||
WriteOut("Failed to get sessions (no response)");
|
||||
@@ -816,7 +816,7 @@ namespace osWebRtcVoice
|
||||
}
|
||||
|
||||
JanusAudioBridge ab = _ViewerSession.AudioBridge;
|
||||
AudioBridgeResp roomsResp = await ab.SendAudioBridgeMsg(new AudioBridgeListRoomsReq());
|
||||
AudioBridgeResp roomsResp = await ab.SendAudioBridgeMsg(new AudioBridgeListRoomsReq()).ConfigureAwait(false);
|
||||
if (roomsResp is null || !roomsResp.isSuccess || roomsResp.PluginRespData is null)
|
||||
{
|
||||
WriteOut("Failed to get room list");
|
||||
@@ -853,7 +853,7 @@ namespace osWebRtcVoice
|
||||
WriteOut(" Spatial : {0}", GetMapString(foundRoom, "spatial_audio"));
|
||||
WriteOut(" Recording : {0}", GetMapString(foundRoom, "record"));
|
||||
|
||||
AudioBridgeResp participantResp = await ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomId));
|
||||
AudioBridgeResp participantResp = await ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomId)).ConfigureAwait(false);
|
||||
if (participantResp is null || participantResp.PluginRespData is null ||
|
||||
!participantResp.PluginRespData.TryGetValue("participants", out OSD participantsNode) ||
|
||||
participantsNode is not OSDArray participants)
|
||||
|
||||
Reference in New Issue
Block a user