Skip to content

Commit

Permalink
Merge #1876
Browse files Browse the repository at this point in the history
1876: Use sensible buffer sizes for Windows named pipes r=dcoutts a=dcoutts

When creating a Windows named pipe one has to specify the buffer sizes. Previously we were specifying the maximum size, however this is unwise:

The MSDN docs say:

> The input and output buffer sizes are advisory. The actual buffer size reserved for each end of the named pipe is either the system default, the system minimum or maximum, or the specified size rounded up to the next allocation boundary. The buffer size specified should be small enough that your process will not run out of nonpaged pool, but large enough to accommodate typical requests.

So this changes the values to 64k outbound and 16k inbound.

Co-authored-by: Duncan Coutts <[email protected]>
  • Loading branch information
iohk-bors[bot] and dcoutts authored Mar 31, 2020
2 parents e9c9f99 + 43bc7d1 commit 9e9de91
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ouroboros-network-framework/src/Ouroboros/Network/Snocket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ namedPipeSnocket ioManager path = Snocket {
(Win32.pIPE_ACCESS_DUPLEX .|. Win32.fILE_FLAG_OVERLAPPED)
(Win32.pIPE_TYPE_BYTE .|. Win32.pIPE_READMODE_BYTE)
Win32.pIPE_UNLIMITED_INSTANCES
maxBound
maxBound
0
Nothing
65536 -- outbound pipe size
16384 -- inbound pipe size
0 -- default timeout
Nothing -- default security
associateWithIOManager ioManager (Left hpipe)
`catch` \(e :: IOException) -> do
Win32.closeHandle hpipe
Expand Down Expand Up @@ -363,10 +363,10 @@ namedPipeSnocket ioManager path = Snocket {
(Win32.pIPE_ACCESS_DUPLEX .|. Win32.fILE_FLAG_OVERLAPPED)
(Win32.pIPE_TYPE_BYTE .|. Win32.pIPE_READMODE_BYTE)
Win32.pIPE_UNLIMITED_INSTANCES
maxBound
maxBound
0
Nothing
65536 -- outbound pipe size
16384 -- inbound pipe size
0 -- default timeout
Nothing -- default security
`catch` \(e :: IOException) -> do
putStrLn $ "accept: " ++ show e
throwIO e
Expand Down

0 comments on commit 9e9de91

Please sign in to comment.