mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Fix random bugs
This commit is contained in:
@@ -60,7 +60,7 @@ namespace VRCX
|
||||
}
|
||||
catch
|
||||
{
|
||||
IPCServer.Clients.Remove(this);
|
||||
IPCServer.Clients.TryRemove(this, out _);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace VRCX
|
||||
|
||||
if (bytesRead <= 0)
|
||||
{
|
||||
IPCServer.Clients.Remove(this);
|
||||
IPCServer.Clients.TryRemove(this, out _);
|
||||
_ipcServer.Close();
|
||||
return;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ namespace VRCX
|
||||
|
||||
#if !LINUX
|
||||
if (MainForm.Instance?.Browser != null && !MainForm.Instance.Browser.IsLoading && MainForm.Instance.Browser.CanExecuteJavascriptInMainFrame)
|
||||
MainForm.Instance.Browser.ExecuteScriptAsync("$pinia.vrcx.ipcEvent", packet);
|
||||
MainForm.Instance.Browser.ExecuteScriptAsync("window?.$pinia.vrcx.ipcEvent", packet);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Pipes;
|
||||
using System.Threading.Tasks;
|
||||
@@ -14,7 +15,7 @@ namespace VRCX
|
||||
public class IPCServer
|
||||
{
|
||||
public static readonly IPCServer Instance;
|
||||
public static readonly List<IPCClient> Clients = new List<IPCClient>();
|
||||
public static readonly ConcurrentDictionary<IPCClient, byte> Clients = new();
|
||||
|
||||
static IPCServer()
|
||||
{
|
||||
@@ -30,7 +31,7 @@ namespace VRCX
|
||||
{
|
||||
foreach (var client in Clients)
|
||||
{
|
||||
client?.Send(ipcPacket);
|
||||
client.Key?.Send(ipcPacket);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ namespace VRCX
|
||||
}
|
||||
|
||||
var ipcClient = new IPCClient(ipcServer);
|
||||
Clients.Add(ipcClient);
|
||||
Clients.TryAdd(ipcClient, 0);
|
||||
ipcClient.BeginRead();
|
||||
CreateIPCServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user