зеркало из https://github.com/microsoft/scalar.git
Making max pipe length platform-dependant
This commit is contained in:
Родитель
09decc7ba5
Коммит
0ee99fa889
|
@ -138,6 +138,7 @@ namespace GVFS.Common
|
|||
public abstract class GVFSPlatformConstants
|
||||
{
|
||||
public static readonly char PathSeparator = Path.DirectorySeparatorChar;
|
||||
public abstract int MaxPipePathLength { get; }
|
||||
public abstract string ExecutableExtension { get; }
|
||||
public abstract string InstallerExtension { get; }
|
||||
|
||||
|
|
|
@ -22,10 +22,6 @@ namespace GVFS.Common.NamedPipes
|
|||
/// </summary>
|
||||
public class NamedPipeServer : IDisposable
|
||||
{
|
||||
// TODO(Mac) the limit is much shorter on macOS
|
||||
// Tests show that 250 is the max supported pipe name length
|
||||
private const int MaxPipeNameLength = 250;
|
||||
|
||||
private bool isStopping;
|
||||
private string pipeName;
|
||||
private Action<Connection> handleConnection;
|
||||
|
@ -43,9 +39,9 @@ namespace GVFS.Common.NamedPipes
|
|||
|
||||
public static NamedPipeServer StartNewServer(string pipeName, ITracer tracer, Action<ITracer, string, Connection> handleRequest)
|
||||
{
|
||||
if (pipeName.Length > MaxPipeNameLength)
|
||||
if (pipeName.Length > GVFSPlatform.Instance.Constants.MaxPipePathLength)
|
||||
{
|
||||
throw new PipeNameLengthException(string.Format("The pipe name ({0}) exceeds the max length allowed({1})", pipeName, MaxPipeNameLength));
|
||||
throw new PipeNameLengthException(string.Format("The pipe name ({0}) exceeds the max length allowed({1})", pipeName, GVFSPlatform.Instance.Constants.MaxPipePathLength));
|
||||
}
|
||||
|
||||
NamedPipeServer pipeServer = new NamedPipeServer(pipeName, tracer, connection => HandleConnection(tracer, connection, handleRequest));
|
||||
|
|
|
@ -167,6 +167,8 @@ namespace GVFS.Platform.Mac
|
|||
{
|
||||
get { return "vfsforgit"; }
|
||||
}
|
||||
|
||||
public override int MaxPipePathLength => 104;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,6 +298,8 @@ namespace GVFS.Platform.POSIX
|
|||
}
|
||||
|
||||
public override bool SupportsUpgradeWhileRunning => true;
|
||||
|
||||
public override int MaxPipePathLength => 108;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -490,6 +490,8 @@ namespace GVFS.Platform.Windows
|
|||
{
|
||||
get { return new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "GVFS", "GVFS.Mount", "git", "ssh-agent", "wish", "bash" }; }
|
||||
}
|
||||
|
||||
public override int MaxPipePathLength => 250;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,6 +235,8 @@ namespace GVFS.UnitTests.Mock.Common
|
|||
}
|
||||
|
||||
public override bool SupportsUpgradeWhileRunning => false;
|
||||
|
||||
public override int MaxPipePathLength => 250;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче