Skip to content

Commit

Permalink
Fix bad hub method signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Nov 12, 2020
1 parent d8ae7b8 commit 9b53eb5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Server/Hubs/ViewerHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,23 @@ public Task SendRtcAnswerToAgent(string sdp)
return CasterHubContext.Clients.Client(ScreenCasterID).SendAsync("ReceiveRtcAnswer", sdp, Context.ConnectionId);
}

public async Task<Task> SendScreenCastRequestToDevice(string screenCasterID, string requesterName, int remoteControlMode, string otp)
public async Task SendScreenCastRequestToDevice(string screenCasterID, string requesterName, int remoteControlMode, string otp)
{
if ((RemoteControlMode)remoteControlMode == RemoteControlMode.Normal)
{
if (!CasterHub.SessionInfoList.Any(x => x.Value.AttendedSessionID == screenCasterID))
{
return Clients.Caller.SendAsync("SessionIDNotFound");
await Clients.Caller.SendAsync("SessionIDNotFound");
return;
}

screenCasterID = CasterHub.SessionInfoList.First(x => x.Value.AttendedSessionID == screenCasterID).Value.CasterSocketID;
}

if (!CasterHub.SessionInfoList.TryGetValue(screenCasterID, out var sessionInfo))
{
return Clients.Caller.SendAsync("SessionIDNotFound");
await Clients.Caller.SendAsync("SessionIDNotFound");
return;
}

SessionInfo = sessionInfo;
Expand All @@ -166,7 +168,7 @@ public async Task<Task> SendScreenCastRequestToDevice(string screenCasterID, str
{
await Clients.Caller.SendAsync("ShowMessage", "Max number of concurrent sessions reached.");
Context.Abort();
return Task.CompletedTask;
return;
}
SessionInfo.OrganizationID = orgId;
SessionInfo.RequesterUserName = Context.User.Identity.Name;
Expand Down Expand Up @@ -200,7 +202,7 @@ public async Task<Task> SendScreenCastRequestToDevice(string screenCasterID, str
DataService.DoesUserHaveAccessToDevice(deviceID, Context.UserIdentifier)))
{
var orgName = DataService.GetOrganizationNameById(orgId);
return CasterHubContext.Clients.Client(screenCasterID).SendAsync("GetScreenCast",
await CasterHubContext.Clients.Client(screenCasterID).SendAsync("GetScreenCast",
Context.ConnectionId,
RequesterName,
AppConfig.RemoteControlNotifyUser,
Expand All @@ -209,14 +211,14 @@ public async Task<Task> SendScreenCastRequestToDevice(string screenCasterID, str
}
else
{
return Clients.Caller.SendAsync("Unauthorized");
await Clients.Caller.SendAsync("Unauthorized");
}
}
else
{
SessionInfo.Mode = RemoteControlMode.Normal;
_ = Clients.Caller.SendAsync("RequestingScreenCast");
return CasterHubContext.Clients.Client(screenCasterID).SendAsync("RequestScreenCast", Context.ConnectionId, RequesterName, AppConfig.RemoteControlNotifyUser);
await CasterHubContext.Clients.Client(screenCasterID).SendAsync("RequestScreenCast", Context.ConnectionId, RequesterName, AppConfig.RemoteControlNotifyUser);
}
}

Expand Down

0 comments on commit 9b53eb5

Please sign in to comment.