Skip to content

Commit

Permalink
Use Win32NamedPipeServerSocket constructor that accepts useJNI arg (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarchambault authored Dec 2, 2021
1 parent 8824199 commit 9266e0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion library/src/libdaemonjvm/internal/SocketMaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.scalasbt.ipcsocket.UnixDomainSocket;
import org.scalasbt.ipcsocket.Win32NamedPipeServerSocket;
import org.scalasbt.ipcsocket.Win32NamedPipeSocket;
import org.scalasbt.ipcsocket.Win32SecurityLevel;

public final class SocketMaker {
private static boolean isWin = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
Expand All @@ -16,7 +17,7 @@ public static Socket client(String path) throws IOException {
else return new UnixDomainSocket(path, true);
}
public static ServerSocket server(String path) throws IOException {
if (isWin) return new Win32NamedPipeServerSocket(path, true);
if (isWin) return new Win32NamedPipeServerSocket(path, true, Win32SecurityLevel.LOGON_DACL);
else return new UnixDomainServerSocket(path, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.graalvm.nativeimage.Platforms;
import org.scalasbt.ipcsocket.Win32NamedPipeServerSocket;
import org.scalasbt.ipcsocket.Win32NamedPipeSocket;
import org.scalasbt.ipcsocket.Win32SecurityLevel;

@TargetClass(className = "libdaemonjvm.internal.SocketMaker")
@Platforms({Platform.WINDOWS.class})
Expand All @@ -19,6 +20,6 @@ public static Socket client(String path) throws IOException {
}
@Substitute
public static ServerSocket server(String path) throws IOException {
return new Win32NamedPipeServerSocket(path, true);
return new Win32NamedPipeServerSocket(path, true, Win32SecurityLevel.LOGON_DACL);
}
}

0 comments on commit 9266e0b

Please sign in to comment.