Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect for named pipes #1881

Merged
merged 7 commits into from
Mar 31, 2020
Merged

connect for named pipes #1881

merged 7 commits into from
Mar 31, 2020

Conversation

coot
Copy link
Contributor

@coot coot commented Mar 31, 2020

connect as designed in
[https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client](MSDN's
named-pipe-client).

  • Win32-netork: do not re-export createFile from NamedPipes module
  • Added System.Win32.NamedPipe.connect
  • Added waitNamedPipe Win32 syscall
  • Modify demo-chain-sync

There's more than needed, I'll need to rebase this branch when #1876 gets
merged to get rid of this patches:

  • Use sensible buffer sizes for Windows named pipes

@coot
Copy link
Contributor Author

coot commented Mar 31, 2020

Fixes #1874.

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connect loop looks good apart from the timeout on exceptions in WaitNamedPipe.

Win32-network/src/System/Win32/NamedPipes.hsc Outdated Show resolved Hide resolved
Win32-network/src/System/Win32/NamedPipes.hsc Outdated Show resolved Hide resolved
Win32-network/src/System/Win32/NamedPipes.hsc Outdated Show resolved Hide resolved
Win32-network/src/System/Win32/NamedPipes.hsc Outdated Show resolved Hide resolved
Win32-network/src/System/Win32/NamedPipes.hsc Outdated Show resolved Hide resolved
This patch makes it much easier to run multiple clients against the same
server.
There is a name clash between windows and posix naming convention, now
we have both `connect` and `connectNamedPipe` (which serves as `accept`
posix call).
It is confusing to export both `connect` and `createFile`.
@coot coot force-pushed the coot/Win32-network-connect branch from 49735ad to e580d3d Compare March 31, 2020 14:28
Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely.

@coot
Copy link
Contributor Author

coot commented Mar 31, 2020

bors merge

iohk-bors bot added a commit that referenced this pull request Mar 31, 2020
1881: connect for named pipes r=coot a=coot

`connect` as designed in
[https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipe-client](MSDN's
named-pipe-client).

- Win32-netork: do not re-export createFile from NamedPipes module
- Added System.Win32.NamedPipe.connect
- Added waitNamedPipe Win32 syscall
- Modify demo-chain-sync

There's more than needed, I'll need to rebase this branch when #1876 gets
merged to get rid of this patches:
- Use sensible buffer sizes for Windows named pipes


Co-authored-by: Marcin Szamotulski <profunctor@pm.me>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 31, 2020

Canceled

@dcoutts
Copy link
Contributor

dcoutts commented Mar 31, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Mar 31, 2020

@iohk-bors iohk-bors bot merged commit 7e89518 into master Mar 31, 2020
@iohk-bors iohk-bors bot deleted the coot/Win32-network-connect branch March 31, 2020 16:15
iohk-bors bot added a commit to IntersectMBO/cardano-node that referenced this pull request Mar 31, 2020
742: Windows fixes from latest network package r=dcoutts a=dcoutts

- [x] sensible pipe buffer size IntersectMBO/ouroboros-network#1876
- [ ] to more reliably connect to the node with multiple clients simultaneously IntersectMBO/ouroboros-network#1881
- [ ] a fix/workaround for the "DNS getting stuck on the second go on windows" problem IntersectMBO/ouroboros-network#1878
- [x] a timeout in the wait case of chain sync IntersectMBO/ouroboros-network#1871

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
iohk-bors bot added a commit to cardano-foundation/cardano-wallet that referenced this pull request Mar 31, 2020
1523: Sync with libs used by cardano-node-1.9.3 r=KtorZ a=dcoutts

This includes the various fixes to the Windows named pipe support.

Most of those fixes were only relevant for the server side, i.e. the node, but one of them is relevant for the client side too.

IntersectMBO/ouroboros-network#1881

In particular this changes how we connect to a named pipe so that if the pipe instance is not initially available then it'll wait and retry. This is genuinely the MSDN recommended way to do it 🤦‍♂️. Otherwise there's a race condition when multiple clients connect, or a client established multiple connections quickly after each other.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
iohk-bors bot added a commit to cardano-foundation/cardano-wallet that referenced this pull request Mar 31, 2020
1523: Sync with libs used by cardano-node-1.9.3 r=disassembler a=dcoutts

This includes the various fixes to the Windows named pipe support.

Most of those fixes were only relevant for the server side, i.e. the node, but one of them is relevant for the client side too.

IntersectMBO/ouroboros-network#1881

In particular this changes how we connect to a named pipe so that if the pipe instance is not initially available then it'll wait and retry. This is genuinely the MSDN recommended way to do it 🤦‍♂️. Otherwise there's a race condition when multiple clients connect, or a client established multiple connections quickly after each other.

Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: KtorZ <matthias.benkort@gmail.com>
@vhulchenko-iohk vhulchenko-iohk added this to the S10 2020-04-09 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants