🐛 Fix pipe path

This commit is contained in:
2025-09-13 17:59:33 +08:00
parent 787876ab6a
commit be414891ec

View File

@@ -13,7 +13,7 @@ class WindowsIpcServer extends IpcServer {
@override @override
Future<void> start() async { Future<void> start() async {
final pipeName = r'\\.\pipe\discord-ipc'.toNativeUtf16(); final pipeName = r'\\.\pipe\discord-ipc-0'.toNativeUtf16();
try { try {
_pipeHandle = CreateNamedPipe( _pipeHandle = CreateNamedPipe(
pipeName, pipeName,
@@ -32,7 +32,7 @@ class WindowsIpcServer extends IpcServer {
} }
developer.log( developer.log(
'IPC named pipe created at \\\\.\\pipe\\discord-ipc', r'IPC named pipe created at \\.\pipe\discord-ipc-0',
name: kRpcIpcLogPrefix, name: kRpcIpcLogPrefix,
); );
@@ -71,6 +71,7 @@ class WindowsIpcServer extends IpcServer {
await Isolate.spawn(_windowsIpcIsolate, receivePort.sendPort); await Isolate.spawn(_windowsIpcIsolate, receivePort.sendPort);
receivePort.listen((message) { receivePort.listen((message) {
developer.log(message.toString(), name: kRpcIpcLogPrefix);
if (message is int) { if (message is int) {
final socketWrapper = WindowsIpcSocketWrapper(message); final socketWrapper = WindowsIpcSocketWrapper(message);
addSocket(socketWrapper); addSocket(socketWrapper);
@@ -87,7 +88,7 @@ class WindowsIpcServer extends IpcServer {
static void _windowsIpcIsolate(SendPort sendPort) { static void _windowsIpcIsolate(SendPort sendPort) {
while (true) { while (true) {
final pipeHandle = CreateNamedPipe( final pipeHandle = CreateNamedPipe(
r'\\.\pipe\discord-ipc'.toNativeUtf16(), r'\\.\pipe\discord-ipc-0'.toNativeUtf16(),
PIPE_ACCESS_DUPLEX, PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES, PIPE_UNLIMITED_INSTANCES,
@@ -108,7 +109,7 @@ class WindowsIpcServer extends IpcServer {
sendPort.send(pipeHandle); sendPort.send(pipeHandle);
} }
// Avoid tight loop // Avoid tight loop
sleep(Duration(milliseconds: 100)); sleep(Duration(milliseconds: 500));
} }
} }