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

CancelIoEx and overal review of Win32-network #1627

Merged
merged 31 commits into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b46c2eb
Added OVERLAPPED data type
coot Feb 9, 2020
f8e90e5
Refactor System.Win32.Async.IOManager and System.Wind32.Async.File
coot Feb 10, 2020
d10752d
withIOManager: re-throw IOException back to the main thread
coot Feb 10, 2020
30f3f97
Use CancelIoEx in case of async exceptions
coot Feb 10, 2020
57dbe1d
Win32-network - documentation improvments & fixes
coot Feb 10, 2020
a43ab30
Win32-network: expanded connectNamedPipe tests
coot Feb 10, 2020
669a0aa
Added tests which trigger specific exceptions
coot Feb 11, 2020
f6b7616
prop_PingPongPipelined: don't limit number of test cases
coot Feb 11, 2020
ae98552
Added WSAOVERLAPPED data and WSAIODATA struct.
coot Feb 12, 2020
74d1457
withIOCPData added support for winsock2 interface
coot Feb 12, 2020
01a6bc2
Socket operations using withIOCPData
coot Feb 12, 2020
ab658d8
Win32-network: do not expose internal modules
coot Feb 12, 2020
5203b7f
Win32-network tests
coot Feb 12, 2020
404502b
Remove code by resourting to a type family
coot Feb 12, 2020
3b96a6d
Use malloc / free instead of HeapAlloc / HeapFree
coot Feb 19, 2020
714e490
Updated scripts/test.sh
coot Feb 19, 2020
daa0e9e
Remove GetQueuedCompletionStatus c wrappers
coot Feb 20, 2020
aa0b86d
Use CreateIoCompletionPort ffi to associate with IOCP
coot Feb 20, 2020
8e9e5e4
Added missing link to MSDN documentation
coot Feb 20, 2020
43905c6
Removed not needed CApiFFI extension
coot Feb 21, 2020
cf8069c
Added a comment in withIOManager
coot Mar 6, 2020
d7f969f
Make connectNamedPipe ffi import safe
coot Mar 16, 2020
8d1aab7
Addressed review comments
coot Mar 16, 2020
dd77362
Improved haddocks in tests
coot Mar 16, 2020
6578ad6
Added a unit test: close handle blocked on reading
coot Mar 16, 2020
aab8e9f
Mark all non-blocking ffi as unsafe
coot Mar 17, 2020
ec390db
Added a simple README.md file
coot Mar 17, 2020
96d55cb
address review comments
coot Mar 23, 2020
5c7ef9b
Refactor dequeueCompletionPackets
coot Mar 23, 2020
899ca61
Use -rtsopts when compiling demo-chain-sync
coot Mar 24, 2020
e22a9bc
Updated NOTICE, added acknoledgment to README.md
coot Mar 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Win32-network/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ Copyright 2019 Input Output (Hong Kong) Ltd.
limitations under the License.


Parts of this project is based on
The project was initially based on:
http://hackage.haskell.org/package/winio-0.1

The following license applies to:
* ./cbits/Win32Async.c
* ./src/System/Win32/Async.hs

Copyright 2007-2009 Felix Martini.

Redistribution and use in source and binary forms, with or without
Expand Down
21 changes: 21 additions & 0 deletions Win32-network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Asynchronious IO for Windows

`Win32-network` provides low level api for doing IO / networking on Windows
using Overlapped (or asynchronous) IO. It supports:

* `File` Api
* `NamedPipes` Api
* `winsock2` - Berkeley sockets api on Windows

`NamedPipes` provide a good alternative for the lack of Unix Sockets on
Windows, and there are ways of providing abstraction for both, though this is
not present in this package.

An application which is using this package should use `-threaded` option, as
the io manager thread runs a blocking ffi call (e.g.
[GetQueuedCompletionStatus](https://docs.microsoft.com/en-us/windows/win32/api/ioapiset/nf-ioapiset-getqueuedcompletionstatus)).

## Acknowledgement

The initial version of this library was based on
[winio](https://hackage.haskell.org/package/winio) by Felix Martini.
11 changes: 6 additions & 5 deletions Win32-network/Win32-network.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ maintainer: [email protected], [email protected]
copyright: 2019 Input Output (Hong Kong) Ltd.
category: System
build-type: Simple
-- extra-source-files: ChangeLog.md
extra-source-files: include/Win32-network.h
cabal-version: >=1.10

flag demo
Expand All @@ -27,13 +27,14 @@ library
System.Win32.Async.File
System.Win32.Async.ErrCode
System.Win32.Async.IOManager
System.Win32.Async.Internal
System.Win32.Async.WSABuf
System.Win32.Async.Socket
System.Win32.Async.Socket.ByteString
System.Win32.Async.Socket.ByteString.Lazy
c-sources: cbits/Win32Async.c
cbits/Win32Socket.c
other-modules: System.Win32.Async.IOData
System.Win32.Async.Overlapped
System.Win32.Async.Socket.Syscalls
System.Win32.Async.WSABuf
include-dirs: include
build-depends: base >= 4.5 && < 4.13,
bytestring >= 0.10 && < 0.11,
network >= 3.1 && < 3.2,
Expand Down
185 changes: 0 additions & 185 deletions Win32-network/cbits/Win32Async.c

This file was deleted.

80 changes: 0 additions & 80 deletions Win32-network/cbits/Win32Socket.c

This file was deleted.

19 changes: 19 additions & 0 deletions Win32-network/include/Win32-network.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <winsock2.h>
#include <windows.h>
#include <HsFFI.h>

// each OVERLAPPED struct is wrapped in IO_DATA; It is important to keep
// OVERLAPPED as the first member of the record. This allows us to cast
// an OVERLAPPED pointer to _IODATA and recover the second member..
typedef struct _IODATA {
OVERLAPPED iodOverlapped;
HsStablePtr iodData;
} IODATA;


// As for _IODATA: it is vital to keep WSAOVERLAPPED as the first member of
// the struct.
typedef struct _WSAIODATA {
WSAOVERLAPPED iodOverlapped;
HsStablePtr iodData;
} WSAIODATA;
Loading