From b12bd3ac52a4a3f1807154259237262f28c8f085 Mon Sep 17 00:00:00 2001 From: John Starks Date: Tue, 15 Mar 2016 10:40:31 -0700 Subject: [PATCH] Let clients set pipe buffer sizes --- pipe.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pipe.go b/pipe.go index 2b9c0cb..82db283 100644 --- a/pipe.go +++ b/pipe.go @@ -230,7 +230,7 @@ func makeServerPipeHandle(path string, securityDescriptor []byte, c *PipeConfig, if securityDescriptor != nil { sa.SecurityDescriptor = &securityDescriptor[0] } - h, err := createNamedPipe(path, flags, mode, cPIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, &sa) + h, err := createNamedPipe(path, flags, mode, cPIPE_UNLIMITED_INSTANCES, uint32(c.OutputBufferSize), uint32(c.InputBufferSize), 0, &sa) if err != nil { return 0, &os.PathError{Op: "open", Path: path, Err: err} } @@ -302,6 +302,12 @@ type PipeConfig struct { // transferred to the reader (and returned as io.EOF in this implementation) // when the pipe is in message mode. MessageMode bool + + // InputBufferSize specifies the size the input buffer, in bytes. + InputBufferSize int32 + + // OutputBufferSize specifies the size the input buffer, in bytes. + OutputBufferSize int32 } // ListenPipe creates a listener on a Windows named pipe path, e.g. \\.\pipe\mypipe.